Fix ClipToPicture() inside a BPicture

Mimic what is't done in clip_to_shape: call SetCanvasGeometry() and ResyncDrawState().

Change-Id: Ibbd77ec8cf90952d94ee35871736e145102a763e
This commit is contained in:
JackBurton79
2018-09-11 14:30:59 +02:00
parent 21e99b4766
commit 66f19f7201
+3 -2
View File
@@ -475,7 +475,6 @@ static void
clip_to_picture(void* _canvas, int32 pictureToken, const BPoint& where, clip_to_picture(void* _canvas, int32 pictureToken, const BPoint& where,
bool clipToInverse) bool clipToInverse)
{ {
// TODO: Doesn't seem to work
Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas); Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas);
ServerPicture* picture = canvas->GetPicture(pictureToken); ServerPicture* picture = canvas->GetPicture(pictureToken);
@@ -484,7 +483,9 @@ clip_to_picture(void* _canvas, int32 pictureToken, const BPoint& where,
AlphaMask* mask = new(std::nothrow) PictureAlphaMask(canvas->GetAlphaMask(), AlphaMask* mask = new(std::nothrow) PictureAlphaMask(canvas->GetAlphaMask(),
picture, *canvas->CurrentState(), where, clipToInverse); picture, *canvas->CurrentState(), where, clipToInverse);
canvas->SetAlphaMask(mask); canvas->SetAlphaMask(mask);
canvas->UpdateCurrentDrawingRegion(); canvas->CurrentState()->GetAlphaMask()->SetCanvasGeometry(BPoint(0, 0),
canvas->Bounds());
canvas->ResyncDrawState();
if (mask != NULL) if (mask != NULL)
mask->ReleaseReference(); mask->ReleaseReference();