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

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

Issue 1915763002: CSS conic gradient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 d50203119a39538a60b8036419addedd6290f60d..693646c5d8f1bc53b29eb34f752ff36fe8c45ec9 100644
--- a/third_party/WebKit/Source/platform/graphics/Gradient.h
+++ b/third_party/WebKit/Source/platform/graphics/Gradient.h
@@ -52,6 +52,10 @@ public:
{
return adoptRef(new Gradient(p0, p1));
}
+ static PassRefPtr<Gradient> create(const FloatPoint& p0, float startAngle)
+ {
+ return adoptRef(new Gradient(p0, startAngle));
+ }
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));
@@ -70,8 +74,8 @@ public:
bool shaderChanged() const { return !m_gradient; }
- bool isRadial() const { return m_radial; }
- bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y() && (!m_radial || m_r0 == m_r1); }
+ bool isRadial() const { return m_class == RadialClass; }
+ bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y() && (!isRadial() || m_r0 == m_r1); }
const FloatPoint& p0() const { return m_p0; }
const FloatPoint& p1() const { return m_p1; }
@@ -124,19 +128,26 @@ public:
private:
Gradient(const FloatPoint& p0, const FloatPoint& p1);
+ Gradient(const FloatPoint& p0, float starAngle);
Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1, float aspectRatio);
sk_sp<SkShader> createShader();
void sortStopsIfNecessary();
+ enum GradientClass {
+ LinearClass,
+ RadialClass,
+ ConicClass,
+ };
+
FloatPoint m_p0;
FloatPoint m_p1;
float m_r0;
float m_r1;
float m_aspectRatio; // For elliptical gradient, width / height.
Vector<ColorStop, 2> m_stops;
- bool m_radial;
+ GradientClass m_class;
bool m_stopsSorted;
bool m_drawInPMColorSpace;
GradientSpreadMethod m_spreadMethod;

Powered by Google App Engine
This is Rietveld 408576698