mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1208283 (part 1) - Change gfxPattern's single-arg constructor to take a gfx::Color& instead of a gfxRGBA&. r=jwatt.
This commit is contained in:
parent
a7bf7f520a
commit
323718acf6
@ -772,7 +772,7 @@ gfxContext::GetPattern()
|
||||
} else if (state.sourceSurface) {
|
||||
NS_ASSERTION(false, "Ugh, this isn't good.");
|
||||
} else {
|
||||
pat = new gfxPattern(ThebesRGBA(state.color));
|
||||
pat = new gfxPattern(state.color);
|
||||
}
|
||||
return pat.forget();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
gfxPattern::gfxPattern(const gfxRGBA& aColor)
|
||||
gfxPattern::gfxPattern(const Color& aColor)
|
||||
: mExtend(EXTEND_NONE)
|
||||
{
|
||||
mGfxPattern.InitColorPattern(ToDeviceColor(aColor));
|
||||
@ -51,7 +51,7 @@ gfxPattern::gfxPattern(SourceSurface *aSurface, const Matrix &aPatternToUserSpac
|
||||
}
|
||||
|
||||
void
|
||||
gfxPattern::AddColorStop(gfxFloat offset, const gfxRGBA& c)
|
||||
gfxPattern::AddColorStop(gfxFloat offset, const Color& c)
|
||||
{
|
||||
if (mGfxPattern.GetPattern()->GetType() != PatternType::LINEAR_GRADIENT &&
|
||||
mGfxPattern.GetPattern()->GetType() != PatternType::RADIAL_GRADIENT) {
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
struct gfxRGBA;
|
||||
typedef struct _cairo_pattern cairo_pattern_t;
|
||||
|
||||
|
||||
@ -25,7 +24,7 @@ class gfxPattern final{
|
||||
NS_INLINE_DECL_REFCOUNTING(gfxPattern)
|
||||
|
||||
public:
|
||||
explicit gfxPattern(const gfxRGBA& aColor);
|
||||
explicit gfxPattern(const mozilla::gfx::Color& aColor);
|
||||
// linear
|
||||
gfxPattern(gfxFloat x0, gfxFloat y0, gfxFloat x1, gfxFloat y1); // linear
|
||||
gfxPattern(gfxFloat cx0, gfxFloat cy0, gfxFloat radius0,
|
||||
@ -33,7 +32,7 @@ public:
|
||||
gfxPattern(mozilla::gfx::SourceSurface *aSurface,
|
||||
const mozilla::gfx::Matrix &aPatternToUserSpace);
|
||||
|
||||
void AddColorStop(gfxFloat offset, const gfxRGBA& c);
|
||||
void AddColorStop(gfxFloat offset, const mozilla::gfx::Color& c);
|
||||
void SetColorStops(mozilla::gfx::GradientStops* aStops);
|
||||
|
||||
// This should only be called on a cairo pattern that we want to use with
|
||||
|
@ -40,7 +40,7 @@ typedef mozilla::dom::Element Element;
|
||||
|
||||
mozilla::gfx::UserDataKey gfxTextContextPaint::sUserDataKey;
|
||||
|
||||
const gfxRGBA SimpleTextContextPaint::sZero = gfxRGBA(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
/* static */ const Color SimpleTextContextPaint::sZero = Color();
|
||||
|
||||
gfxSVGGlyphs::gfxSVGGlyphs(hb_blob_t *aSVGTable, gfxFontEntry *aFontEntry)
|
||||
: mSVGData(aSVGTable)
|
||||
|
@ -229,7 +229,7 @@ private:
|
||||
class SimpleTextContextPaint : public gfxTextContextPaint
|
||||
{
|
||||
private:
|
||||
static const gfxRGBA sZero;
|
||||
static const mozilla::gfx::Color sZero;
|
||||
|
||||
public:
|
||||
static gfxMatrix SetupDeviceToPatternMatrix(gfxPattern *aPattern,
|
||||
|
@ -3096,16 +3096,16 @@ SVGTextContextPaint::Paint::GetPattern(const DrawTarget* aDrawTarget,
|
||||
|
||||
switch (mPaintType) {
|
||||
case eStyleSVGPaintType_None:
|
||||
pattern = new gfxPattern(gfxRGBA(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
pattern = new gfxPattern(Color());
|
||||
mPatternMatrix = gfxMatrix();
|
||||
break;
|
||||
case eStyleSVGPaintType_Color:
|
||||
pattern = new gfxPattern(gfxRGBA(NS_GET_R(mPaintDefinition.mColor) / 255.0,
|
||||
NS_GET_G(mPaintDefinition.mColor) / 255.0,
|
||||
NS_GET_B(mPaintDefinition.mColor) / 255.0,
|
||||
NS_GET_A(mPaintDefinition.mColor) / 255.0 * aOpacity));
|
||||
case eStyleSVGPaintType_Color: {
|
||||
Color color = Color::FromABGR(mPaintDefinition.mColor);
|
||||
color.a *= aOpacity;
|
||||
pattern = new gfxPattern(color);
|
||||
mPatternMatrix = gfxMatrix();
|
||||
break;
|
||||
}
|
||||
case eStyleSVGPaintType_Server:
|
||||
pattern = mPaintDefinition.mPaintServerFrame->GetPaintServerPattern(mFrame,
|
||||
aDrawTarget,
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Helper classes
|
||||
@ -235,7 +236,7 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
|
||||
// SVG specification says that no stops should be treated like
|
||||
// the corresponding fill or stroke had "none" specified.
|
||||
if (nStops == 0) {
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(gfxRGBA(0, 0, 0, 0));
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(Color());
|
||||
return pattern.forget();
|
||||
}
|
||||
|
||||
@ -245,12 +246,9 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
|
||||
float stopOpacity = stopFrames[nStops-1]->StyleSVGReset()->mStopOpacity;
|
||||
nscolor stopColor = stopFrames[nStops-1]->StyleSVGReset()->mStopColor;
|
||||
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(
|
||||
gfxRGBA(NS_GET_R(stopColor)/255.0,
|
||||
NS_GET_G(stopColor)/255.0,
|
||||
NS_GET_B(stopColor)/255.0,
|
||||
NS_GET_A(stopColor)/255.0 *
|
||||
stopOpacity * aGraphicOpacity));
|
||||
Color stopColor2 = Color::FromABGR(stopColor);
|
||||
stopColor2.a *= stopOpacity * aGraphicOpacity;
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(stopColor2);
|
||||
return pattern.forget();
|
||||
}
|
||||
|
||||
@ -303,12 +301,9 @@ nsSVGGradientFrame::GetPaintServerPattern(nsIFrame* aSource,
|
||||
else
|
||||
lastOffset = offset;
|
||||
|
||||
gradient->AddColorStop(offset,
|
||||
gfxRGBA(NS_GET_R(stopColor)/255.0,
|
||||
NS_GET_G(stopColor)/255.0,
|
||||
NS_GET_B(stopColor)/255.0,
|
||||
NS_GET_A(stopColor)/255.0 *
|
||||
stopOpacity * aGraphicOpacity));
|
||||
Color stopColor2 = Color::FromABGR(stopColor);
|
||||
stopColor2.a *= stopOpacity * aGraphicOpacity;
|
||||
gradient->AddColorStop(offset, stopColor2);
|
||||
}
|
||||
|
||||
return gradient.forget();
|
||||
|
@ -705,7 +705,7 @@ nsSVGPatternFrame::GetPaintServerPattern(nsIFrame *aSource,
|
||||
const gfxRect *aOverrideBounds)
|
||||
{
|
||||
if (aGraphicOpacity == 0.0f) {
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(gfxRGBA(0, 0, 0, 0));
|
||||
nsRefPtr<gfxPattern> pattern = new gfxPattern(Color());
|
||||
return pattern.forget();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user