| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 class SkPaint; | 28 class SkPaint; |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 enum LayoutSVGResourceMode { | 32 enum LayoutSVGResourceMode { |
| 33 ApplyToFillMode, | 33 ApplyToFillMode, |
| 34 ApplyToStrokeMode, | 34 ApplyToStrokeMode, |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class GraphicsContext; | |
| 38 class GraphicsContextStateSaver; | |
| 39 class LayoutObject; | 37 class LayoutObject; |
| 40 class LayoutSVGResourcePaintServer; | 38 class LayoutSVGResourcePaintServer; |
| 41 class ComputedStyle; | 39 class ComputedStyle; |
| 42 | 40 |
| 43 class SVGPaintServer { | 41 class SVGPaintServer { |
| 44 public: | 42 public: |
| 45 explicit SVGPaintServer(Color); | 43 explicit SVGPaintServer(Color); |
| 46 explicit SVGPaintServer(PassRefPtr<Gradient>); | 44 explicit SVGPaintServer(PassRefPtr<Gradient>); |
| 47 explicit SVGPaintServer(PassRefPtr<Pattern>); | 45 explicit SVGPaintServer(PassRefPtr<Pattern>); |
| 48 | 46 |
| 49 static SVGPaintServer requestForLayoutObject(const LayoutObject&, const Comp
utedStyle&, LayoutSVGResourceMode); | 47 static SVGPaintServer requestForLayoutObject(const LayoutObject&, const Comp
utedStyle&, LayoutSVGResourceMode); |
| 50 static bool existsForLayoutObject(const LayoutObject&, const ComputedStyle&,
LayoutSVGResourceMode); | 48 static bool existsForLayoutObject(const LayoutObject&, const ComputedStyle&,
LayoutSVGResourceMode); |
| 51 | 49 |
| 52 void applyToSkPaint(SkPaint&, float paintAlpha); | 50 void applyToSkPaint(SkPaint&, float paintAlpha); |
| 53 void apply(GraphicsContext&, LayoutSVGResourceMode, float paintAlpha, Graphi
csContextStateSaver&); | |
| 54 | 51 |
| 55 static SVGPaintServer invalid() { return SVGPaintServer(Color(Color::transpa
rent)); } | 52 static SVGPaintServer invalid() { return SVGPaintServer(Color(Color::transpa
rent)); } |
| 56 bool isValid() const { return m_color != Color::transparent; } | 53 bool isValid() const { return m_color != Color::transparent; } |
| 57 | 54 |
| 58 bool isTransformDependent() const { return m_gradient || m_pattern; } | 55 bool isTransformDependent() const { return m_gradient || m_pattern; } |
| 59 void prependTransform(const AffineTransform&); | 56 void prependTransform(const AffineTransform&); |
| 60 | 57 |
| 61 private: | 58 private: |
| 62 RefPtr<Gradient> m_gradient; | 59 RefPtr<Gradient> m_gradient; |
| 63 RefPtr<Pattern> m_pattern; | 60 RefPtr<Pattern> m_pattern; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 86 | 83 |
| 87 // Helper utilities used in to access the underlying resources for DRT. | 84 // Helper utilities used in to access the underlying resources for DRT. |
| 88 static SVGPaintDescription requestPaintDescription(const LayoutObject&, cons
t ComputedStyle&, LayoutSVGResourceMode); | 85 static SVGPaintDescription requestPaintDescription(const LayoutObject&, cons
t ComputedStyle&, LayoutSVGResourceMode); |
| 89 }; | 86 }; |
| 90 | 87 |
| 91 DEFINE_TYPE_CASTS(LayoutSVGResourcePaintServer, LayoutSVGResourceContainer, reso
urce, resource->isSVGPaintServer(), resource.isSVGPaintServer()); | 88 DEFINE_TYPE_CASTS(LayoutSVGResourcePaintServer, LayoutSVGResourceContainer, reso
urce, resource->isSVGPaintServer(), resource.isSVGPaintServer()); |
| 92 | 89 |
| 93 } | 90 } |
| 94 | 91 |
| 95 #endif | 92 #endif |
| OLD | NEW |