From 3bc4dacf9a9063a40322817b1a907ac7cc9d75f5 Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Thu, 28 Aug 2008 12:01:46 +0000 Subject: [PATCH] * We need to update the drawing state in case SetHighColor, SetDrawingMode etc. is called after BeginPicture on a freshly created view. This is necessary because a second invocation on this view with BeginPicture would have caused ServerPicture::SyncState to write the default drawing state into the picture. This happens because to BView had now cached the values and therefor won't go to the app_server and tell about the change. The first call did not change anything as picture recording is handled in _DispatchPictureMessage while view changes that modify drawing state are handled in _DispatchViewMessage, thus leading to default draw state values beeing written. This fixes invalid ticket #2534. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27218 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerWindow.cpp | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 7763c3cbed..aa82419129 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -2429,6 +2429,9 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) link.Read(&drawingMode); picture->WriteSetDrawingMode((drawing_mode)drawingMode); + + fCurrentView->CurrentState()->SetDrawingMode((drawing_mode)drawingMode); + fWindow->GetDrawingEngine()->SetDrawingMode((drawing_mode)drawingMode); break; } @@ -2438,6 +2441,8 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) link.Read(&x); link.Read(&y); picture->WriteSetPenLocation(BPoint(x, y)); + + fCurrentView->CurrentState()->SetPenLocation(BPoint(x, y)); break; } case AS_VIEW_SET_PEN_SIZE: @@ -2445,6 +2450,10 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) float penSize; link.Read(&penSize); picture->WriteSetPenSize(penSize); + + fCurrentView->CurrentState()->SetPenSize(penSize); + fWindow->GetDrawingEngine()->SetPenSize( + fCurrentView->CurrentState()->PenSize()); break; } @@ -2459,6 +2468,12 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) picture->WriteSetLineMode((cap_mode)lineCap, (join_mode)lineJoin, miterLimit); + fCurrentView->CurrentState()->SetLineCapMode((cap_mode)lineCap); + fCurrentView->CurrentState()->SetLineJoinMode((join_mode)lineJoin); + fCurrentView->CurrentState()->SetMiterLimit(miterLimit); + + fWindow->GetDrawingEngine()->SetStrokeMode((cap_mode)lineCap, + (join_mode)lineJoin, miterLimit); break; } case AS_VIEW_SET_SCALE: @@ -2466,6 +2481,9 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) float scale; link.Read(&scale); picture->WriteSetScale(scale); + + fCurrentView->SetScale(scale); + _UpdateDrawState(fCurrentView); break; } @@ -2641,12 +2659,16 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) rgb_color color; link.Read(&color, sizeof(rgb_color)); - if (code == AS_VIEW_SET_HIGH_COLOR) + if (code == AS_VIEW_SET_HIGH_COLOR) { picture->WriteSetHighColor(color); - else + fCurrentView->CurrentState()->SetHighColor(color); + fWindow->GetDrawingEngine()->SetHighColor(color); + } else { picture->WriteSetLowColor(color); - break; - } + fCurrentView->CurrentState()->SetLowColor(color); + fWindow->GetDrawingEngine()->SetLowColor(color); + } + } break; case AS_DRAW_STRING: case AS_DRAW_STRING_WITH_DELTA: @@ -2815,6 +2837,10 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link) picture->AddInt16((int16)alphaFunc); picture->EndOp(); + fCurrentView->CurrentState()->SetBlendingMode((source_alpha)srcAlpha, + (alpha_function)alphaFunc); + fWindow->GetDrawingEngine()->SetBlendingMode((source_alpha)srcAlpha, + (alpha_function)alphaFunc); break; }*/ default: