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

Side by Side Diff: Source/platform/graphics/Gradient.h

Issue 206493002: Minor Gradient cleanup. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSGradientValue.cpp ('k') | Source/platform/graphics/Gradient.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2008 Torch Mobile, Inc. 4 * Copyright (C) 2008 Torch Mobile, Inc.
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 ~Gradient(); 59 ~Gradient();
60 60
61 struct ColorStop { 61 struct ColorStop {
62 float stop; 62 float stop;
63 Color color; 63 Color color;
64 64
65 ColorStop(float s, const Color& c) : stop(s), color(c) { } 65 ColorStop(float s, const Color& c) : stop(s), color(c) { }
66 }; 66 };
67 void addColorStop(const ColorStop&); 67 void addColorStop(const ColorStop&);
68 void addColorStop(float, const Color&); 68 void addColorStop(float value, const Color& color) { addColorStop(ColorStop( value, color)); }
69 69
70 bool hasAlpha() const; 70 bool hasAlpha() const;
71 bool shaderChanged() const { return !m_gradient; } 71 bool shaderChanged() const { return !m_gradient; }
72 72
73 bool isRadial() const { return m_radial; } 73 bool isRadial() const { return m_radial; }
74 bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y( ) && (!m_radial || m_r0 == m_r1); } 74 bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y( ) && (!m_radial || m_r0 == m_r1); }
75 75
76 const FloatPoint& p0() const { return m_p0; } 76 const FloatPoint& p0() const { return m_p0; }
77 const FloatPoint& p1() const { return m_p1; } 77 const FloatPoint& p1() const { return m_p1; }
78 78
(...skipping 29 matching lines...) Expand all
108 if (m_r1 == r) 108 if (m_r1 == r)
109 return; 109 return;
110 110
111 m_r1 = r; 111 m_r1 = r;
112 } 112 }
113 113
114 float aspectRatio() const { return m_aspectRatio; } 114 float aspectRatio() const { return m_aspectRatio; }
115 115
116 SkShader* shader(); 116 SkShader* shader();
117 117
118 void setStopsSorted(bool s) { m_stopsSorted = s; }
119
120 void setDrawsInPMColorSpace(bool drawInPMColorSpace); 118 void setDrawsInPMColorSpace(bool drawInPMColorSpace);
121 119
122 void setSpreadMethod(GradientSpreadMethod); 120 void setSpreadMethod(GradientSpreadMethod);
123 GradientSpreadMethod spreadMethod() { return m_spreadMethod; } 121 GradientSpreadMethod spreadMethod() { return m_spreadMethod; }
124 void setGradientSpaceTransform(const AffineTransform& gradientSpaceTransform ation); 122 void setGradientSpaceTransform(const AffineTransform& gradientSpaceTransform ation);
125 AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransformat ion; } 123 AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransformat ion; }
126 124
127 private: 125 private:
128 Gradient(const FloatPoint& p0, const FloatPoint& p1); 126 Gradient(const FloatPoint& p0, const FloatPoint& p1);
129 Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1, flo at aspectRatio); 127 Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1, flo at aspectRatio);
(...skipping 13 matching lines...) Expand all
143 bool m_drawInPMColorSpace; 141 bool m_drawInPMColorSpace;
144 GradientSpreadMethod m_spreadMethod; 142 GradientSpreadMethod m_spreadMethod;
145 AffineTransform m_gradientSpaceTransformation; 143 AffineTransform m_gradientSpaceTransformation;
146 144
147 RefPtr<SkShader> m_gradient; 145 RefPtr<SkShader> m_gradient;
148 }; 146 };
149 147
150 } // namespace WebCore 148 } // namespace WebCore
151 149
152 #endif 150 #endif
OLDNEW
« no previous file with comments | « Source/core/css/CSSGradientValue.cpp ('k') | Source/platform/graphics/Gradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698