From a36c1c0590ef349e6fa4f501881f5c540f2b4123 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 27 Jan 2014 10:45:09 +0100 Subject: [PATCH] Fix clip_to_picture test app * We want the text to be drawn on the clipping bitmap with alpha blending, to get an useful mask. --- src/tests/servers/app/clip_to_picture/main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/tests/servers/app/clip_to_picture/main.cpp b/src/tests/servers/app/clip_to_picture/main.cpp index 96dc54a8be..ef229d2f49 100644 --- a/src/tests/servers/app/clip_to_picture/main.cpp +++ b/src/tests/servers/app/clip_to_picture/main.cpp @@ -32,22 +32,26 @@ TestView::TestView(BRect frame, const char* name, uint32 resizeFlags, void TestView::AttachedToWindow() { - BPicture picture; + BPicture clipper; + BeginPicture(&clipper); + PushState(); + + SetDrawingMode(B_OP_ALPHA); + SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE); - BeginPicture(&picture); DrawString("Hello World! - Clipping", BPoint(10, 10)); - FillRect(BRect(0, 20, 400, 40)); + + PopState(); EndPicture(); - ClipToPicture(&picture); + ClipToPicture(&clipper); } void TestView::Draw(BRect updateRect) { - SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR)); // opaque black. DrawString("Hello World! - Clipped", BPoint(10, 30)); FillRect(BRect(0, 0, 200, 20)); }