mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1074012, part 1 - Temporarily expose some gfxContext fill/stroke API to help with porting to Moz2D. r=Bas
This commit is contained in:
parent
36eb7e1f75
commit
db9cf22c76
@ -261,34 +261,52 @@ gfxContext::CurrentPoint()
|
||||
|
||||
void
|
||||
gfxContext::Stroke()
|
||||
{
|
||||
Stroke(PatternFromState(this));
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::Stroke(const Pattern& aPattern)
|
||||
{
|
||||
AzureState &state = CurrentState();
|
||||
if (mPathIsRect) {
|
||||
MOZ_ASSERT(!mTransformChanged);
|
||||
|
||||
mDT->StrokeRect(mRect, PatternFromState(this),
|
||||
mDT->StrokeRect(mRect, aPattern,
|
||||
state.strokeOptions,
|
||||
DrawOptions(1.0f, GetOp(), state.aaMode));
|
||||
} else {
|
||||
EnsurePath();
|
||||
|
||||
mDT->Stroke(mPath, PatternFromState(this), state.strokeOptions,
|
||||
mDT->Stroke(mPath, aPattern, state.strokeOptions,
|
||||
DrawOptions(1.0f, GetOp(), state.aaMode));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::Fill()
|
||||
{
|
||||
Fill(PatternFromState(this));
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::Fill(const Pattern& aPattern)
|
||||
{
|
||||
PROFILER_LABEL("gfxContext", "Fill",
|
||||
js::ProfileEntry::Category::GRAPHICS);
|
||||
FillAzure(1.0f);
|
||||
FillAzure(aPattern, 1.0f);
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::FillWithOpacity(gfxFloat aOpacity)
|
||||
{
|
||||
FillAzure(Float(aOpacity));
|
||||
FillWithOpacity(PatternFromState(this), aOpacity);
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::FillWithOpacity(const Pattern& aPattern, gfxFloat aOpacity)
|
||||
{
|
||||
FillAzure(aPattern, Float(aOpacity));
|
||||
}
|
||||
|
||||
void
|
||||
@ -1385,7 +1403,7 @@ gfxContext::EnsurePathBuilder()
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::FillAzure(Float aOpacity)
|
||||
gfxContext::FillAzure(const Pattern& aPattern, Float aOpacity)
|
||||
{
|
||||
AzureState &state = CurrentState();
|
||||
|
||||
@ -1399,16 +1417,16 @@ gfxContext::FillAzure(Float aOpacity)
|
||||
} else if (op == CompositionOp::OP_SOURCE) {
|
||||
// Emulate cairo operator source which is bound by mask!
|
||||
mDT->ClearRect(mRect);
|
||||
mDT->FillRect(mRect, PatternFromState(this), DrawOptions(aOpacity));
|
||||
mDT->FillRect(mRect, aPattern, DrawOptions(aOpacity));
|
||||
} else {
|
||||
mDT->FillRect(mRect, PatternFromState(this), DrawOptions(aOpacity, op, state.aaMode));
|
||||
mDT->FillRect(mRect, aPattern, DrawOptions(aOpacity, op, state.aaMode));
|
||||
}
|
||||
} else {
|
||||
EnsurePath();
|
||||
|
||||
NS_ASSERTION(!state.opIsClear, "We shouldn't be clearing complex paths!");
|
||||
|
||||
mDT->Fill(mPath, PatternFromState(this), DrawOptions(aOpacity, op, state.aaMode));
|
||||
mDT->Fill(mPath, aPattern, DrawOptions(aOpacity, op, state.aaMode));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ template <typename T> class FallibleTArray;
|
||||
class gfxContext MOZ_FINAL {
|
||||
typedef mozilla::gfx::FillRule FillRule;
|
||||
typedef mozilla::gfx::Path Path;
|
||||
typedef mozilla::gfx::Pattern Pattern;
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(gfxContext)
|
||||
|
||||
@ -107,12 +108,14 @@ public:
|
||||
* Does not consume the current path.
|
||||
*/
|
||||
void Stroke();
|
||||
void Stroke(const Pattern& aPattern);
|
||||
/**
|
||||
* Fill the current path according to the current settings.
|
||||
*
|
||||
* Does not consume the current path.
|
||||
*/
|
||||
void Fill();
|
||||
void Fill(const Pattern& aPattern);
|
||||
|
||||
/**
|
||||
* Fill the current path according to the current settings and
|
||||
@ -121,6 +124,7 @@ public:
|
||||
* Does not consume the current path.
|
||||
*/
|
||||
void FillWithOpacity(gfxFloat aOpacity);
|
||||
void FillWithOpacity(const Pattern& aPattern, gfxFloat aOpacity);
|
||||
|
||||
/**
|
||||
* Forgets the current path.
|
||||
@ -724,7 +728,7 @@ private:
|
||||
void EnsurePath();
|
||||
// This ensures mPathBuilder contains a valid PathBuilder (in user space!)
|
||||
void EnsurePathBuilder();
|
||||
void FillAzure(mozilla::gfx::Float aOpacity);
|
||||
void FillAzure(const Pattern& aPattern, mozilla::gfx::Float aOpacity);
|
||||
void PushClipsToDT(mozilla::gfx::DrawTarget *aDT);
|
||||
CompositionOp GetOp();
|
||||
void ChangeTransform(const mozilla::gfx::Matrix &aNewMatrix, bool aUpdatePatternTransform = true);
|
||||
|
Loading…
Reference in New Issue
Block a user