Memory allocation fixes.
This commit is contained in:
@@ -3768,9 +3768,14 @@ ServerWindow::PictureToRegion(ServerPicture* picture, BRegion& region,
|
||||
* 32 - 1;
|
||||
}
|
||||
|
||||
// TODO: I used a RGBA32 bitmap because drawing on a GRAY8 doesn't work.
|
||||
region.MakeEmpty();
|
||||
|
||||
// TODO: Only the alpha channel is relevant, but there is no B_ALPHA8
|
||||
// color space, so we use 75% more memory.
|
||||
UtilityBitmap* bitmap = new UtilityBitmap(bounds, B_RGBA32, 0);
|
||||
if (bitmap != NULL) {
|
||||
if (bitmap == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* TODO stippi says we could use OffscreenWindow to do this, but there
|
||||
@@ -3789,6 +3794,11 @@ ServerWindow::PictureToRegion(ServerPicture* picture, BRegion& region,
|
||||
// Render the picture to the bitmap
|
||||
BitmapHWInterface interface(bitmap);
|
||||
DrawingEngine* engine = interface.CreateDrawingEngine();
|
||||
if (engine == NULL) {
|
||||
delete bitmap;
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
// Copy the current state of the client view, so we draw with the right
|
||||
// font, color and everything
|
||||
engine->SetDrawState(fCurrentView->CurrentState());
|
||||
@@ -3803,12 +3813,11 @@ ServerWindow::PictureToRegion(ServerPicture* picture, BRegion& region,
|
||||
picture->Play(&context);
|
||||
engine->UnlockParallelAccess();
|
||||
}
|
||||
}
|
||||
delete engine;
|
||||
|
||||
// TODO stop here: we want agg to clip using the bitmap (with alpha), not
|
||||
// the region.
|
||||
|
||||
region.MakeEmpty();
|
||||
int32 width = bounds.IntegerWidth() + 1;
|
||||
int32 height = bounds.IntegerHeight() + 1;
|
||||
if (bitmap != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user