1848b8605Smrg/* 2848b8605Smrg * Copyright 2006-2012, Haiku. All rights reserved. 3848b8605Smrg * Distributed under the terms of the MIT License. 4848b8605Smrg * 5848b8605Smrg * Authors: 6848b8605Smrg * Jérôme Duval, korli@users.berlios.de 7848b8605Smrg * Philippe Houdoin, philippe.houdoin@free.fr 8848b8605Smrg * Stefano Ceccherini, burton666@libero.it 9848b8605Smrg */ 10848b8605Smrg 11848b8605Smrg#include <kernel/image.h> 12848b8605Smrg 13848b8605Smrg#include <GLView.h> 14848b8605Smrg 15848b8605Smrg#include <assert.h> 16848b8605Smrg#include <stdio.h> 17848b8605Smrg#include <stdlib.h> 18848b8605Smrg#include <string.h> 19848b8605Smrg 20848b8605Smrg#include <DirectWindow.h> 21848b8605Smrg#include <GLRenderer.h> 22848b8605Smrg 23848b8605Smrg#include "interface/DirectWindowPrivate.h" 24848b8605Smrg#include "GLDispatcher.h" 25848b8605Smrg#include "GLRendererRoster.h" 26848b8605Smrg 27848b8605Smrg 28848b8605Smrgstruct glview_direct_info { 29848b8605Smrg direct_buffer_info* direct_info; 30848b8605Smrg bool direct_connected; 31848b8605Smrg bool enable_direct_mode; 32848b8605Smrg 33848b8605Smrg glview_direct_info(); 34848b8605Smrg ~glview_direct_info(); 35848b8605Smrg}; 36848b8605Smrg 37848b8605Smrg 38848b8605SmrgBGLView::BGLView(BRect rect, const char* name, ulong resizingMode, ulong mode, 39848b8605Smrg ulong options) 40848b8605Smrg : 41848b8605Smrg BView(rect, name, B_FOLLOW_ALL_SIDES, mode | B_WILL_DRAW | B_FRAME_EVENTS), 42848b8605Smrg // | B_FULL_UPDATE_ON_RESIZE) 43848b8605Smrg fGc(NULL), 44848b8605Smrg fOptions(options), 45848b8605Smrg fDitherCount(0), 46848b8605Smrg fDrawLock("BGLView draw lock"), 47848b8605Smrg fDisplayLock("BGLView display lock"), 48848b8605Smrg fClipInfo(NULL), 49848b8605Smrg fRenderer(NULL), 50848b8605Smrg fRoster(NULL), 51848b8605Smrg fDitherMap(NULL) 52848b8605Smrg{ 53848b8605Smrg fRoster = new GLRendererRoster(this, options); 54848b8605Smrg} 55848b8605Smrg 56848b8605Smrg 57848b8605SmrgBGLView::~BGLView() 58848b8605Smrg{ 59848b8605Smrg delete fClipInfo; 60848b8605Smrg if (fRenderer) 61848b8605Smrg fRenderer->Release(); 62848b8605Smrg} 63848b8605Smrg 64848b8605Smrg 65848b8605Smrgvoid 66848b8605SmrgBGLView::LockGL() 67848b8605Smrg{ 68848b8605Smrg // TODO: acquire the OpenGL API lock it on this glview 69848b8605Smrg 70848b8605Smrg fDisplayLock.Lock(); 71848b8605Smrg if (fRenderer) 72848b8605Smrg fRenderer->LockGL(); 73848b8605Smrg} 74848b8605Smrg 75848b8605Smrg 76848b8605Smrgvoid 77848b8605SmrgBGLView::UnlockGL() 78848b8605Smrg{ 79848b8605Smrg if (fRenderer) 80848b8605Smrg fRenderer->UnlockGL(); 81848b8605Smrg fDisplayLock.Unlock(); 82848b8605Smrg 83848b8605Smrg // TODO: release the GL API lock to others glviews 84848b8605Smrg} 85848b8605Smrg 86848b8605Smrg 87848b8605Smrgvoid 88848b8605SmrgBGLView::SwapBuffers() 89848b8605Smrg{ 90848b8605Smrg SwapBuffers(false); 91848b8605Smrg} 92848b8605Smrg 93848b8605Smrg 94848b8605Smrgvoid 95848b8605SmrgBGLView::SwapBuffers(bool vSync) 96848b8605Smrg{ 97848b8605Smrg if (fRenderer) { 98848b8605Smrg _LockDraw(); 99848b8605Smrg fRenderer->SwapBuffers(vSync); 100848b8605Smrg _UnlockDraw(); 101848b8605Smrg } 102848b8605Smrg} 103848b8605Smrg 104848b8605Smrg 105848b8605SmrgBView* 106848b8605SmrgBGLView::EmbeddedView() 107848b8605Smrg{ 108848b8605Smrg return NULL; 109848b8605Smrg} 110848b8605Smrg 111848b8605Smrg 112848b8605Smrgvoid* 113848b8605SmrgBGLView::GetGLProcAddress(const char* procName) 114848b8605Smrg{ 115848b8605Smrg BGLDispatcher* glDispatcher = NULL; 116848b8605Smrg 117848b8605Smrg if (fRenderer) 118848b8605Smrg glDispatcher = fRenderer->GLDispatcher(); 119848b8605Smrg 120848b8605Smrg if (glDispatcher) 121848b8605Smrg return (void*)glDispatcher->AddressOf(procName); 122848b8605Smrg 123848b8605Smrg return NULL; 124848b8605Smrg} 125848b8605Smrg 126848b8605Smrg 127848b8605Smrgstatus_t 128848b8605SmrgBGLView::CopyPixelsOut(BPoint source, BBitmap* dest) 129848b8605Smrg{ 130848b8605Smrg if (!fRenderer) 131848b8605Smrg return B_ERROR; 132848b8605Smrg 133848b8605Smrg if (!dest || !dest->Bounds().IsValid()) 134848b8605Smrg return B_BAD_VALUE; 135848b8605Smrg 136848b8605Smrg return fRenderer->CopyPixelsOut(source, dest); 137848b8605Smrg} 138848b8605Smrg 139848b8605Smrg 140848b8605Smrgstatus_t 141848b8605SmrgBGLView::CopyPixelsIn(BBitmap* source, BPoint dest) 142848b8605Smrg{ 143848b8605Smrg if (!fRenderer) 144848b8605Smrg return B_ERROR; 145848b8605Smrg 146848b8605Smrg if (!source || !source->Bounds().IsValid()) 147848b8605Smrg return B_BAD_VALUE; 148848b8605Smrg 149848b8605Smrg return fRenderer->CopyPixelsIn(source, dest); 150848b8605Smrg} 151848b8605Smrg 152848b8605Smrg 153848b8605Smrg/*! Mesa's GLenum is not ulong but uint, so we can't use GLenum 154848b8605Smrg without breaking this method signature. 155848b8605Smrg Instead, we have to use the effective BeOS's SGI OpenGL GLenum type: 156848b8605Smrg unsigned long. 157848b8605Smrg */ 158848b8605Smrgvoid 159848b8605SmrgBGLView::ErrorCallback(unsigned long errorCode) 160848b8605Smrg{ 161848b8605Smrg char msg[32]; 162848b8605Smrg sprintf(msg, "GL: Error code $%04lx.", errorCode); 163848b8605Smrg // TODO: under BeOS R5, it call debugger(msg); 164848b8605Smrg fprintf(stderr, "%s\n", msg); 165848b8605Smrg} 166848b8605Smrg 167848b8605Smrg 168848b8605Smrgvoid 169848b8605SmrgBGLView::Draw(BRect updateRect) 170848b8605Smrg{ 171848b8605Smrg if (fRenderer) { 172848b8605Smrg _LockDraw(); 173848b8605Smrg fRenderer->Draw(updateRect); 174848b8605Smrg _UnlockDraw(); 175848b8605Smrg return; 176848b8605Smrg } 177848b8605Smrg // TODO: auto-size and center the string 178848b8605Smrg MovePenTo(8, 32); 179848b8605Smrg DrawString("No OpenGL renderer available!"); 180848b8605Smrg} 181848b8605Smrg 182848b8605Smrg 183848b8605Smrgvoid 184848b8605SmrgBGLView::AttachedToWindow() 185848b8605Smrg{ 186848b8605Smrg BView::AttachedToWindow(); 187848b8605Smrg 188848b8605Smrg fBounds = Bounds(); 189848b8605Smrg for (BView* view = this; view != NULL; view = view->Parent()) 190848b8605Smrg view->ConvertToParent(&fBounds); 191848b8605Smrg 192848b8605Smrg fRenderer = fRoster->GetRenderer(); 193848b8605Smrg if (fRenderer != NULL) { 194848b8605Smrg // Jackburton: The following code was commented because it doesn't look 195848b8605Smrg // good in "direct" mode: 196848b8605Smrg // when the window is moved, the app_server doesn't paint the view's 197848b8605Smrg // background, and the stuff behind the window itself shows up. 198848b8605Smrg // Setting the view color to black, instead, looks a bit more elegant. 199848b8605Smrg#if 0 200848b8605Smrg // Don't paint white window background when resized 201848b8605Smrg SetViewColor(B_TRANSPARENT_32_BIT); 202848b8605Smrg#else 203848b8605Smrg SetViewColor(0, 0, 0); 204848b8605Smrg#endif 205848b8605Smrg 206848b8605Smrg // Set default OpenGL viewport: 207848b8605Smrg LockGL(); 208848b8605Smrg glViewport(0, 0, Bounds().IntegerWidth(), Bounds().IntegerHeight()); 209848b8605Smrg UnlockGL(); 210848b8605Smrg fRenderer->FrameResized(Bounds().IntegerWidth(), 211848b8605Smrg Bounds().IntegerHeight()); 212848b8605Smrg 213848b8605Smrg if (fClipInfo) { 214848b8605Smrg fRenderer->DirectConnected(fClipInfo->direct_info); 215848b8605Smrg fRenderer->EnableDirectMode(fClipInfo->enable_direct_mode); 216848b8605Smrg } 217848b8605Smrg 218848b8605Smrg return; 219848b8605Smrg } 220848b8605Smrg 221848b8605Smrg fprintf(stderr, "no renderer found! \n"); 222848b8605Smrg 223848b8605Smrg // No Renderer, no rendering. Setup a minimal "No Renderer" string drawing 224848b8605Smrg // context 225848b8605Smrg SetFont(be_bold_font); 226848b8605Smrg // SetFontSize(16); 227848b8605Smrg} 228848b8605Smrg 229848b8605Smrg 230848b8605Smrgvoid 231848b8605SmrgBGLView::AllAttached() 232848b8605Smrg{ 233848b8605Smrg BView::AllAttached(); 234848b8605Smrg} 235848b8605Smrg 236848b8605Smrg 237848b8605Smrgvoid 238848b8605SmrgBGLView::DetachedFromWindow() 239848b8605Smrg{ 240848b8605Smrg if (fRenderer) 241848b8605Smrg fRenderer->Release(); 242848b8605Smrg fRenderer = NULL; 243848b8605Smrg 244848b8605Smrg BView::DetachedFromWindow(); 245848b8605Smrg} 246848b8605Smrg 247848b8605Smrg 248848b8605Smrgvoid 249848b8605SmrgBGLView::AllDetached() 250848b8605Smrg{ 251848b8605Smrg BView::AllDetached(); 252848b8605Smrg} 253848b8605Smrg 254848b8605Smrg 255848b8605Smrgvoid 256848b8605SmrgBGLView::FrameResized(float width, float height) 257848b8605Smrg{ 258848b8605Smrg fBounds = Bounds(); 259848b8605Smrg for (BView* v = this; v; v = v->Parent()) 260848b8605Smrg v->ConvertToParent(&fBounds); 261848b8605Smrg 262848b8605Smrg if (fRenderer) { 263848b8605Smrg LockGL(); 264848b8605Smrg _LockDraw(); 265848b8605Smrg _CallDirectConnected(); 266848b8605Smrg fRenderer->FrameResized(width, height); 267848b8605Smrg _UnlockDraw(); 268848b8605Smrg UnlockGL(); 269848b8605Smrg } 270848b8605Smrg 271848b8605Smrg BView::FrameResized(width, height); 272848b8605Smrg} 273848b8605Smrg 274848b8605Smrg 275848b8605Smrgstatus_t 276848b8605SmrgBGLView::Perform(perform_code d, void* arg) 277848b8605Smrg{ 278848b8605Smrg return BView::Perform(d, arg); 279848b8605Smrg} 280848b8605Smrg 281848b8605Smrg 282848b8605Smrgstatus_t 283848b8605SmrgBGLView::Archive(BMessage* data, bool deep) const 284848b8605Smrg{ 285848b8605Smrg return BView::Archive(data, deep); 286848b8605Smrg} 287848b8605Smrg 288848b8605Smrg 289848b8605Smrgvoid 290848b8605SmrgBGLView::MessageReceived(BMessage* msg) 291848b8605Smrg{ 292848b8605Smrg BView::MessageReceived(msg); 293848b8605Smrg} 294848b8605Smrg 295848b8605Smrg 296848b8605Smrgvoid 297848b8605SmrgBGLView::SetResizingMode(uint32 mode) 298848b8605Smrg{ 299848b8605Smrg BView::SetResizingMode(mode); 300848b8605Smrg} 301848b8605Smrg 302848b8605Smrg 303848b8605Smrgvoid 304848b8605SmrgBGLView::GetPreferredSize(float* _width, float* _height) 305848b8605Smrg{ 306848b8605Smrg if (_width) 307848b8605Smrg *_width = 0; 308848b8605Smrg if (_height) 309848b8605Smrg *_height = 0; 310848b8605Smrg} 311848b8605Smrg 312848b8605Smrg 313848b8605Smrgvoid 314848b8605SmrgBGLView::Show() 315848b8605Smrg{ 316848b8605Smrg BView::Show(); 317848b8605Smrg} 318848b8605Smrg 319848b8605Smrg 320848b8605Smrgvoid 321848b8605SmrgBGLView::Hide() 322848b8605Smrg{ 323848b8605Smrg BView::Hide(); 324848b8605Smrg} 325848b8605Smrg 326848b8605Smrg 327848b8605SmrgBHandler* 328848b8605SmrgBGLView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, 329848b8605Smrg int32 form, const char* property) 330848b8605Smrg{ 331848b8605Smrg return BView::ResolveSpecifier(msg, index, specifier, form, property); 332848b8605Smrg} 333848b8605Smrg 334848b8605Smrg 335848b8605Smrgstatus_t 336848b8605SmrgBGLView::GetSupportedSuites(BMessage* data) 337848b8605Smrg{ 338848b8605Smrg return BView::GetSupportedSuites(data); 339848b8605Smrg} 340848b8605Smrg 341848b8605Smrg 342848b8605Smrgvoid 343848b8605SmrgBGLView::DirectConnected(direct_buffer_info* info) 344848b8605Smrg{ 345848b8605Smrg if (fClipInfo == NULL) { 346848b8605Smrg fClipInfo = new (std::nothrow) glview_direct_info(); 347848b8605Smrg if (fClipInfo == NULL) 348848b8605Smrg return; 349848b8605Smrg } 350848b8605Smrg 351848b8605Smrg direct_buffer_info* localInfo = fClipInfo->direct_info; 352848b8605Smrg 353848b8605Smrg switch (info->buffer_state & B_DIRECT_MODE_MASK) { 354848b8605Smrg case B_DIRECT_START: 355848b8605Smrg fClipInfo->direct_connected = true; 356848b8605Smrg memcpy(localInfo, info, DIRECT_BUFFER_INFO_AREA_SIZE); 357848b8605Smrg _UnlockDraw(); 358848b8605Smrg break; 359848b8605Smrg 360848b8605Smrg case B_DIRECT_MODIFY: 361848b8605Smrg _LockDraw(); 362848b8605Smrg memcpy(localInfo, info, DIRECT_BUFFER_INFO_AREA_SIZE); 363848b8605Smrg _UnlockDraw(); 364848b8605Smrg break; 365848b8605Smrg 366848b8605Smrg case B_DIRECT_STOP: 367848b8605Smrg fClipInfo->direct_connected = false; 368848b8605Smrg _LockDraw(); 369848b8605Smrg break; 370848b8605Smrg } 371848b8605Smrg 372848b8605Smrg if (fRenderer) 373848b8605Smrg _CallDirectConnected(); 374848b8605Smrg} 375848b8605Smrg 376848b8605Smrg 377848b8605Smrgvoid 378848b8605SmrgBGLView::EnableDirectMode(bool enabled) 379848b8605Smrg{ 380848b8605Smrg if (fRenderer) 381848b8605Smrg fRenderer->EnableDirectMode(enabled); 382848b8605Smrg if (fClipInfo == NULL) { 383848b8605Smrg fClipInfo = new (std::nothrow) glview_direct_info(); 384848b8605Smrg if (fClipInfo == NULL) 385848b8605Smrg return; 386848b8605Smrg } 387848b8605Smrg 388848b8605Smrg fClipInfo->enable_direct_mode = enabled; 389848b8605Smrg} 390848b8605Smrg 391848b8605Smrg 392848b8605Smrgvoid 393848b8605SmrgBGLView::_LockDraw() 394848b8605Smrg{ 395848b8605Smrg if (!fClipInfo || !fClipInfo->enable_direct_mode) 396848b8605Smrg return; 397848b8605Smrg 398848b8605Smrg fDrawLock.Lock(); 399848b8605Smrg} 400848b8605Smrg 401848b8605Smrg 402848b8605Smrgvoid 403848b8605SmrgBGLView::_UnlockDraw() 404848b8605Smrg{ 405848b8605Smrg if (!fClipInfo || !fClipInfo->enable_direct_mode) 406848b8605Smrg return; 407848b8605Smrg 408848b8605Smrg fDrawLock.Unlock(); 409848b8605Smrg} 410848b8605Smrg 411848b8605Smrg 412848b8605Smrgvoid 413848b8605SmrgBGLView::_CallDirectConnected() 414848b8605Smrg{ 415848b8605Smrg if (!fClipInfo) 416848b8605Smrg return; 417848b8605Smrg 418848b8605Smrg direct_buffer_info* localInfo = fClipInfo->direct_info; 419848b8605Smrg direct_buffer_info* info = (direct_buffer_info*)malloc( 420848b8605Smrg DIRECT_BUFFER_INFO_AREA_SIZE); 421848b8605Smrg if (info == NULL) 422848b8605Smrg return; 423848b8605Smrg 424848b8605Smrg memcpy(info, localInfo, DIRECT_BUFFER_INFO_AREA_SIZE); 425848b8605Smrg 426848b8605Smrg // Collect the rects into a BRegion, then clip to the view's bounds 427848b8605Smrg BRegion region; 428848b8605Smrg for (uint32 c = 0; c < localInfo->clip_list_count; c++) 429848b8605Smrg region.Include(localInfo->clip_list[c]); 430848b8605Smrg BRegion boundsRegion = fBounds.OffsetByCopy(localInfo->window_bounds.left, 431848b8605Smrg localInfo->window_bounds.top); 432848b8605Smrg info->window_bounds = boundsRegion.RectAtInt(0); 433848b8605Smrg // window_bounds are now view bounds 434848b8605Smrg region.IntersectWith(&boundsRegion); 435848b8605Smrg 436848b8605Smrg info->clip_list_count = region.CountRects(); 437848b8605Smrg info->clip_bounds = region.FrameInt(); 438848b8605Smrg 439848b8605Smrg for (uint32 c = 0; c < info->clip_list_count; c++) 440848b8605Smrg info->clip_list[c] = region.RectAtInt(c); 441848b8605Smrg fRenderer->DirectConnected(info); 442848b8605Smrg free(info); 443848b8605Smrg} 444848b8605Smrg 445848b8605Smrg 446848b8605Smrg//---- virtual reserved methods ---------- 447848b8605Smrg 448848b8605Smrg 449848b8605Smrgvoid BGLView::_ReservedGLView1() {} 450848b8605Smrgvoid BGLView::_ReservedGLView2() {} 451848b8605Smrgvoid BGLView::_ReservedGLView3() {} 452848b8605Smrgvoid BGLView::_ReservedGLView4() {} 453848b8605Smrgvoid BGLView::_ReservedGLView5() {} 454848b8605Smrgvoid BGLView::_ReservedGLView6() {} 455848b8605Smrgvoid BGLView::_ReservedGLView7() {} 456848b8605Smrgvoid BGLView::_ReservedGLView8() {} 457848b8605Smrg 458848b8605Smrg 459848b8605Smrg// #pragma mark - 460848b8605Smrg 461848b8605Smrg 462848b8605Smrg// BeOS compatibility: contrary to others BView's contructors, 463848b8605Smrg// BGLView one wants a non-const name argument. 464848b8605SmrgBGLView::BGLView(BRect rect, char* name, ulong resizingMode, ulong mode, 465848b8605Smrg ulong options) 466848b8605Smrg : 467848b8605Smrg BView(rect, name, B_FOLLOW_ALL_SIDES, mode | B_WILL_DRAW | B_FRAME_EVENTS), 468848b8605Smrg fGc(NULL), 469848b8605Smrg fOptions(options), 470848b8605Smrg fDitherCount(0), 471848b8605Smrg fDrawLock("BGLView draw lock"), 472848b8605Smrg fDisplayLock("BGLView display lock"), 473848b8605Smrg fClipInfo(NULL), 474848b8605Smrg fRenderer(NULL), 475848b8605Smrg fRoster(NULL), 476848b8605Smrg fDitherMap(NULL) 477848b8605Smrg{ 478848b8605Smrg fRoster = new GLRendererRoster(this, options); 479848b8605Smrg} 480848b8605Smrg 481848b8605Smrg 482848b8605Smrg#if 0 483848b8605Smrg// TODO: implement BGLScreen class... 484848b8605Smrg 485848b8605Smrg 486848b8605SmrgBGLScreen::BGLScreen(char* name, ulong screenMode, ulong options, 487848b8605Smrg status_t* error, bool debug) 488848b8605Smrg : 489848b8605Smrg BWindowScreen(name, screenMode, error, debug) 490848b8605Smrg{ 491848b8605Smrg} 492848b8605Smrg 493848b8605Smrg 494848b8605SmrgBGLScreen::~BGLScreen() 495848b8605Smrg{ 496848b8605Smrg} 497848b8605Smrg 498848b8605Smrg 499848b8605Smrgvoid 500848b8605SmrgBGLScreen::LockGL() 501848b8605Smrg{ 502848b8605Smrg} 503848b8605Smrg 504848b8605Smrg 505848b8605Smrgvoid 506848b8605SmrgBGLScreen::UnlockGL() 507848b8605Smrg{ 508848b8605Smrg} 509848b8605Smrg 510848b8605Smrg 511848b8605Smrgvoid 512848b8605SmrgBGLScreen::SwapBuffers() 513848b8605Smrg{ 514848b8605Smrg} 515848b8605Smrg 516848b8605Smrg 517848b8605Smrgvoid 518848b8605SmrgBGLScreen::ErrorCallback(unsigned long errorCode) 519848b8605Smrg{ 520848b8605Smrg // Mesa's GLenum is not ulong but uint! 521848b8605Smrg char msg[32]; 522848b8605Smrg sprintf(msg, "GL: Error code $%04lx.", errorCode); 523848b8605Smrg // debugger(msg); 524848b8605Smrg fprintf(stderr, "%s\n", msg); 525848b8605Smrg return; 526848b8605Smrg} 527848b8605Smrg 528848b8605Smrg 529848b8605Smrgvoid 530848b8605SmrgBGLScreen::ScreenConnected(bool enabled) 531848b8605Smrg{ 532848b8605Smrg} 533848b8605Smrg 534848b8605Smrg 535848b8605Smrgvoid 536848b8605SmrgBGLScreen::FrameResized(float width, float height) 537848b8605Smrg{ 538848b8605Smrg return BWindowScreen::FrameResized(width, height); 539848b8605Smrg} 540848b8605Smrg 541848b8605Smrg 542848b8605Smrgstatus_t 543848b8605SmrgBGLScreen::Perform(perform_code d, void* arg) 544848b8605Smrg{ 545848b8605Smrg return BWindowScreen::Perform(d, arg); 546848b8605Smrg} 547848b8605Smrg 548848b8605Smrg 549848b8605Smrgstatus_t 550848b8605SmrgBGLScreen::Archive(BMessage* data, bool deep) const 551848b8605Smrg{ 552848b8605Smrg return BWindowScreen::Archive(data, deep); 553848b8605Smrg} 554848b8605Smrg 555848b8605Smrg 556848b8605Smrgvoid 557848b8605SmrgBGLScreen::MessageReceived(BMessage* msg) 558848b8605Smrg{ 559848b8605Smrg BWindowScreen::MessageReceived(msg); 560848b8605Smrg} 561848b8605Smrg 562848b8605Smrg 563848b8605Smrgvoid 564848b8605SmrgBGLScreen::Show() 565848b8605Smrg{ 566848b8605Smrg BWindowScreen::Show(); 567848b8605Smrg} 568848b8605Smrg 569848b8605Smrg 570848b8605Smrgvoid 571848b8605SmrgBGLScreen::Hide() 572848b8605Smrg{ 573848b8605Smrg BWindowScreen::Hide(); 574848b8605Smrg} 575848b8605Smrg 576848b8605Smrg 577848b8605SmrgBHandler* 578848b8605SmrgBGLScreen::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, 579848b8605Smrg int32 form, const char* property) 580848b8605Smrg{ 581848b8605Smrg return BWindowScreen::ResolveSpecifier(msg, index, specifier, 582848b8605Smrg form, property); 583848b8605Smrg} 584848b8605Smrg 585848b8605Smrg 586848b8605Smrgstatus_t 587848b8605SmrgBGLScreen::GetSupportedSuites(BMessage* data) 588848b8605Smrg{ 589848b8605Smrg return BWindowScreen::GetSupportedSuites(data); 590848b8605Smrg} 591848b8605Smrg 592848b8605Smrg 593848b8605Smrg//---- virtual reserved methods ---------- 594848b8605Smrg 595848b8605Smrgvoid BGLScreen::_ReservedGLScreen1() {} 596848b8605Smrgvoid BGLScreen::_ReservedGLScreen2() {} 597848b8605Smrgvoid BGLScreen::_ReservedGLScreen3() {} 598848b8605Smrgvoid BGLScreen::_ReservedGLScreen4() {} 599848b8605Smrgvoid BGLScreen::_ReservedGLScreen5() {} 600848b8605Smrgvoid BGLScreen::_ReservedGLScreen6() {} 601848b8605Smrgvoid BGLScreen::_ReservedGLScreen7() {} 602848b8605Smrgvoid BGLScreen::_ReservedGLScreen8() {} 603848b8605Smrg#endif 604848b8605Smrg 605848b8605Smrg 606848b8605Smrgconst char* color_space_name(color_space space) 607848b8605Smrg{ 608848b8605Smrg#define C2N(a) case a: return #a 609848b8605Smrg 610848b8605Smrg switch (space) { 611848b8605Smrg C2N(B_RGB24); 612848b8605Smrg C2N(B_RGB32); 613848b8605Smrg C2N(B_RGBA32); 614848b8605Smrg C2N(B_RGB32_BIG); 615848b8605Smrg C2N(B_RGBA32_BIG); 616848b8605Smrg C2N(B_GRAY8); 617848b8605Smrg C2N(B_GRAY1); 618848b8605Smrg C2N(B_RGB16); 619848b8605Smrg C2N(B_RGB15); 620848b8605Smrg C2N(B_RGBA15); 621848b8605Smrg C2N(B_CMAP8); 622848b8605Smrg default: 623848b8605Smrg return "Unknown!"; 624848b8605Smrg }; 625848b8605Smrg 626848b8605Smrg#undef C2N 627848b8605Smrg}; 628848b8605Smrg 629848b8605Smrg 630848b8605Smrgglview_direct_info::glview_direct_info() 631848b8605Smrg{ 632848b8605Smrg // TODO: See direct_window_data() in app_server's ServerWindow.cpp 633848b8605Smrg direct_info = (direct_buffer_info*)calloc(1, DIRECT_BUFFER_INFO_AREA_SIZE); 634848b8605Smrg direct_connected = false; 635848b8605Smrg enable_direct_mode = false; 636848b8605Smrg} 637848b8605Smrg 638848b8605Smrg 639848b8605Smrgglview_direct_info::~glview_direct_info() 640848b8605Smrg{ 641848b8605Smrg free(direct_info); 642848b8605Smrg} 643848b8605Smrg 644