OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SVGPaintServer_h |
| 6 #define SVGPaintServer_h |
| 7 |
| 8 #include "core/rendering/svg/RenderSVGResource.h" |
| 9 #include "platform/graphics/Gradient.h" |
| 10 #include "platform/graphics/Pattern.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class GraphicsContext; |
| 15 class GraphicsContextStateSaver; |
| 16 |
| 17 class SVGPaintServer { |
| 18 public: |
| 19 explicit SVGPaintServer(Color); |
| 20 explicit SVGPaintServer(PassRefPtr<Gradient>); |
| 21 explicit SVGPaintServer(PassRefPtr<Pattern>); |
| 22 |
| 23 static SVGPaintServer invalid() { return SVGPaintServer(Color::transparent);
} |
| 24 |
| 25 // Update the GC state (on |stateSaver.context()|) for painting |renderer| |
| 26 // using |style|. |resourceModeFlags| is used to decide between fill/stroke. |
| 27 // Previous state will be saved (if needed) using |stateSaver|. |
| 28 static bool updateGraphicsContext(GraphicsContextStateSaver&, RenderStyle*,
RenderObject&, RenderSVGResourceModeFlags); |
| 29 |
| 30 void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSave
r* = 0); |
| 31 |
| 32 bool isValid() const { return m_color != Color::transparent; } |
| 33 |
| 34 private: |
| 35 static SVGPaintServer requestForRenderer(RenderObject&, RenderStyle*, Render
SVGResourceModeFlags); |
| 36 |
| 37 RefPtr<Gradient> m_gradient; |
| 38 RefPtr<Pattern> m_pattern; |
| 39 Color m_color; |
| 40 }; |
| 41 |
| 42 } // namespace blink |
| 43 |
| 44 #endif // SVGPaintServer_h |
OLD | NEW |