AlphaMasks: Use correct DrawState when playing picture
The current drawing state when the picture starts playing is the base state that drawing commands in the picture itself should not be able to modify. In the ClipToPicture test, the nested state test now at least draws the last picture at the correctly scaled location.
This commit is contained in:
parent
ce2c561521
commit
b971358df3
|
@ -116,9 +116,9 @@ AlphaMask::_RenderPicture() const
|
|||
return NULL;
|
||||
}
|
||||
|
||||
engine->SetDrawState(&fDrawState);
|
||||
OffscreenContext context(engine, fDrawState);
|
||||
context.PushState();
|
||||
|
||||
OffscreenContext context(engine);
|
||||
if (engine->LockParallelAccess()) {
|
||||
// FIXME ConstrainClippingRegion docs says passing NULL disables
|
||||
// all clipping. This doesn't work and will crash in Painter.
|
||||
|
@ -128,6 +128,8 @@ AlphaMask::_RenderPicture() const
|
|||
fPicture->Play(&context);
|
||||
engine->UnlockParallelAccess();
|
||||
}
|
||||
|
||||
context.PopState();
|
||||
delete engine;
|
||||
|
||||
if (!fInverse)
|
||||
|
|
|
@ -23,12 +23,20 @@
|
|||
#include <GradientConic.h>
|
||||
#include <Region.h>
|
||||
|
||||
#include "DrawingEngine.h"
|
||||
#include "DrawState.h"
|
||||
|
||||
|
||||
DrawingContext::DrawingContext()
|
||||
:
|
||||
fDrawState(new (std::nothrow) DrawState)
|
||||
fDrawState(new(std::nothrow) DrawState())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DrawingContext::DrawingContext(const DrawState& state)
|
||||
:
|
||||
fDrawState(new(std::nothrow) DrawState(state))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -304,3 +312,14 @@ DrawingContext::ConvertFromScreenForDrawing(BPoint* point) const
|
|||
}
|
||||
|
||||
|
||||
// #pragma mark - OffscreenContext
|
||||
|
||||
|
||||
OffscreenContext::OffscreenContext(DrawingEngine* engine,
|
||||
const DrawState& state)
|
||||
:
|
||||
DrawingContext(state),
|
||||
fDrawingEngine(engine)
|
||||
{
|
||||
fDrawingEngine->SetDrawState(fDrawState);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ class ServerPicture;
|
|||
class DrawingContext {
|
||||
public:
|
||||
DrawingContext();
|
||||
DrawingContext(const DrawState& state);
|
||||
virtual ~DrawingContext();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
@ -83,9 +84,8 @@ protected:
|
|||
|
||||
class OffscreenContext: public DrawingContext {
|
||||
public:
|
||||
OffscreenContext(DrawingEngine* engine)
|
||||
: fDrawingEngine(engine)
|
||||
{};
|
||||
OffscreenContext(DrawingEngine* engine,
|
||||
const DrawState& state);
|
||||
|
||||
// Screen and View coordinates are the same for us.
|
||||
// DrawState already takes care of World<>View
|
||||
|
|
Loading…
Reference in New Issue