Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: Source/platform/graphics/GraphicsContext.h

Issue 900463002: Make SVG painting independent of GraphicsContext's alpha state (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/graphics/GraphicsContext.h
diff --git a/Source/platform/graphics/GraphicsContext.h b/Source/platform/graphics/GraphicsContext.h
index 75b8c56644bbdd2e967c99e3a65b8bf7e5e4d560..7a9660518003a603b50b89365f3f1e28b337792e 100644
--- a/Source/platform/graphics/GraphicsContext.h
+++ b/Source/platform/graphics/GraphicsContext.h
@@ -120,10 +120,10 @@ public:
SkColor effectiveStrokeColor() const { return immutableState()->effectiveStrokeColor(); }
Pattern* strokePattern() const { return immutableState()->strokePattern(); }
- void setStrokePattern(PassRefPtr<Pattern>);
+ void setStrokePattern(PassRefPtr<Pattern>, float additionalAlpha = 1);
Gradient* strokeGradient() const { return immutableState()->strokeGradient(); }
- void setStrokeGradient(PassRefPtr<Gradient>);
+ void setStrokeGradient(PassRefPtr<Gradient>, float additionalAlpha = 1);
void setLineCap(LineCap cap) { mutableState()->setLineCap(cap); }
void setLineDash(const DashArray& dashes, float dashOffset) { mutableState()->setLineDash(dashes, dashOffset); }
@@ -137,10 +137,10 @@ public:
void setFillColor(const Color& color) { mutableState()->setFillColor(color); }
SkColor effectiveFillColor() const { return immutableState()->effectiveFillColor(); }
- void setFillPattern(PassRefPtr<Pattern>);
+ void setFillPattern(PassRefPtr<Pattern>, float additionalAlpha = 1);
Pattern* fillPattern() const { return immutableState()->fillPattern(); }
- void setFillGradient(PassRefPtr<Gradient>);
+ void setFillGradient(PassRefPtr<Gradient>, float additionalAlpha = 1);
Gradient* fillGradient() const { return immutableState()->fillGradient(); }
SkDrawLooper* drawLooper() const { return immutableState()->drawLooper(); }
@@ -396,6 +396,13 @@ public:
void setInDrawingRecorder(bool);
#endif
+ // Multiply a color's alpha channel by an additional alpha factor. This is
+ // similar to Color::combineWithAlpha but uses Skia's rounding approach.
+ static SkColor combineWithAlpha(SkColor color, float alpha)
+ {
+ return GraphicsContextState::combineWithAlpha(color, alpha);
+ }
+
private:
const GraphicsContextState* immutableState() const { return m_paintState; }

Powered by Google App Engine
This is Rietveld 408576698