582b3d5a72
instance by introducing Window::InitCheck(), use new (nothrow). * Window is responsible for the DrawingEngine instance, but forgot to delete it. * OffscreenWindow is no longer special, every Window owns a DrawingEngine, no need to delete it anymore, but since it already deletes the HWInterface instance, it needs to detach the DrawingEngine from it. * Use new (nothrow) in OffscreenWindow as well. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24308 a95241bf-73f2-0310-859d-f6bbb57e9c96
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
/*
|
|
* Copyright 2005-2008, Haiku, Inc. All rights reserved.
|
|
* Distributed under the terms of the MIT license.
|
|
*
|
|
* Author:
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
*/
|
|
|
|
|
|
#include "OffscreenWindow.h"
|
|
|
|
#include <new>
|
|
#include <stdio.h>
|
|
|
|
#include <Debug.h>
|
|
|
|
#include "BitmapHWInterface.h"
|
|
#include "DrawingEngine.h"
|
|
#include "ServerBitmap.h"
|
|
|
|
using std::nothrow;
|
|
|
|
|
|
OffscreenWindow::OffscreenWindow(ServerBitmap* bitmap,
|
|
const char* name, ::ServerWindow* window)
|
|
: Window(bitmap->Bounds(), name,
|
|
B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
|
0, 0, window, new (nothrow) DrawingEngine()),
|
|
fBitmap(bitmap),
|
|
fHWInterface(new (nothrow) BitmapHWInterface(fBitmap))
|
|
{
|
|
if (!fHWInterface || !GetDrawingEngine())
|
|
return;
|
|
|
|
fHWInterface->Initialize();
|
|
GetDrawingEngine()->SetHWInterface(fHWInterface);
|
|
|
|
fVisibleRegion.Set(fFrame);
|
|
fVisibleContentRegion.Set(fFrame);
|
|
fVisibleContentRegionValid = true;
|
|
fContentRegion.Set(fFrame);
|
|
fContentRegionValid = true;
|
|
}
|
|
|
|
|
|
OffscreenWindow::~OffscreenWindow()
|
|
{
|
|
if (GetDrawingEngine())
|
|
GetDrawingEngine()->SetHWInterface(NULL);
|
|
|
|
if (fHWInterface) {
|
|
fHWInterface->LockExclusiveAccess();
|
|
fHWInterface->Shutdown();
|
|
fHWInterface->UnlockExclusiveAccess();
|
|
delete fHWInterface;
|
|
}
|
|
}
|
|
|