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

Unified Diff: third_party/WebKit/Source/platform/graphics/Gradient.h

Issue 2754783003: Remove two Gradient setters (Closed)
Patch Set: Created 3 years, 9 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: third_party/WebKit/Source/platform/graphics/Gradient.h
diff --git a/third_party/WebKit/Source/platform/graphics/Gradient.h b/third_party/WebKit/Source/platform/graphics/Gradient.h
index 273c1fed5dea1b0689f12dc72f44ce4d5a65a0a7..e4260b945c0e4f2b0061cbf7cb7be2f6ec394755 100644
--- a/third_party/WebKit/Source/platform/graphics/Gradient.h
+++ b/third_party/WebKit/Source/platform/graphics/Gradient.h
@@ -49,16 +49,28 @@ class PLATFORM_EXPORT Gradient : public RefCounted<Gradient> {
WTF_MAKE_NONCOPYABLE(Gradient);
public:
- static PassRefPtr<Gradient> create(const FloatPoint& p0,
- const FloatPoint& p1) {
- return adoptRef(new Gradient(p0, p1));
+ enum class ColorInterpolation {
+ Premultiplied,
+ Unpremultiplied,
+ };
+
+ static PassRefPtr<Gradient> create(
+ const FloatPoint& p0,
+ const FloatPoint& p1,
+ GradientSpreadMethod spreadMethod = SpreadMethodPad,
+ ColorInterpolation interpolation = ColorInterpolation::Unpremultiplied) {
+ return adoptRef(new Gradient(p0, p1, spreadMethod, interpolation));
}
- static PassRefPtr<Gradient> create(const FloatPoint& p0,
- float r0,
- const FloatPoint& p1,
- float r1,
- float aspectRatio = 1) {
- return adoptRef(new Gradient(p0, r0, p1, r1, aspectRatio));
+ static PassRefPtr<Gradient> create(
+ const FloatPoint& p0,
+ float r0,
+ const FloatPoint& p1,
+ float r1,
+ float aspectRatio = 1,
+ GradientSpreadMethod spreadMethod = SpreadMethodPad,
+ ColorInterpolation interpolation = ColorInterpolation::Unpremultiplied) {
+ return adoptRef(
+ new Gradient(p0, r0, p1, r1, aspectRatio, spreadMethod, interpolation));
}
~Gradient();
@@ -117,18 +129,20 @@ class PLATFORM_EXPORT Gradient : public RefCounted<Gradient> {
void applyToFlags(PaintFlags&, const SkMatrix& localMatrix);
- void setDrawsInPMColorSpace(bool drawInPMColorSpace);
-
- void setSpreadMethod(GradientSpreadMethod);
GradientSpreadMethod spreadMethod() const { return m_spreadMethod; }
private:
- Gradient(const FloatPoint& p0, const FloatPoint& p1);
+ Gradient(const FloatPoint& p0,
+ const FloatPoint& p1,
+ GradientSpreadMethod,
+ ColorInterpolation);
Gradient(const FloatPoint& p0,
float r0,
const FloatPoint& p1,
float r1,
- float aspectRatio);
+ float aspectRatio,
+ GradientSpreadMethod,
+ ColorInterpolation);
sk_sp<PaintShader> createShader(const SkMatrix& localMatrix);
@@ -142,8 +156,8 @@ class PLATFORM_EXPORT Gradient : public RefCounted<Gradient> {
Vector<ColorStop, 2> m_stops;
bool m_radial;
bool m_stopsSorted;
- bool m_drawInPMColorSpace;
GradientSpreadMethod m_spreadMethod;
+ ColorInterpolation m_colorInterpolation;
mutable sk_sp<PaintShader> m_cachedShader;
};

Powered by Google App Engine
This is Rietveld 408576698