Index: Source/core/paint/SVGPaintServer.h |
diff --git a/Source/core/paint/SVGPaintServer.h b/Source/core/paint/SVGPaintServer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..857b59207c2946e1cdfa7720108fd517d83cd68c |
--- /dev/null |
+++ b/Source/core/paint/SVGPaintServer.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SVGPaintServer_h |
+#define SVGPaintServer_h |
+ |
+#include "core/rendering/svg/RenderSVGResource.h" |
+#include "platform/graphics/Gradient.h" |
+#include "platform/graphics/Pattern.h" |
+ |
+namespace blink { |
+ |
+class GraphicsContext; |
+class GraphicsContextStateSaver; |
+ |
+class SVGPaintServer { |
+public: |
+ explicit SVGPaintServer(Color); |
+ explicit SVGPaintServer(PassRefPtr<Gradient>); |
+ explicit SVGPaintServer(PassRefPtr<Pattern>); |
+ |
+ static SVGPaintServer invalid() { return SVGPaintServer(Color::transparent); } |
+ |
+ // Update the GC state (on |stateSaver.context()|) for painting |renderer| |
+ // using |style|. |resourceModeFlags| is used to decide between fill/stroke. |
+ // Previous state will be saved (if needed) using |stateSaver|. |
+ static bool updateGraphicsContext(GraphicsContextStateSaver&, RenderStyle*, RenderObject&, RenderSVGResourceModeFlags); |
+ |
+ void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSaver* = 0); |
+ |
+ bool isValid() const { return m_color != Color::transparent; } |
+ |
+private: |
+ static SVGPaintServer requestForRenderer(RenderObject&, RenderStyle*, RenderSVGResourceModeFlags); |
+ |
+ RefPtr<Gradient> m_gradient; |
+ RefPtr<Pattern> m_pattern; |
+ Color m_color; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // SVGPaintServer_h |