Index: Source/core/rendering/svg/RenderSVGResourcePattern.h |
diff --git a/Source/core/rendering/svg/RenderSVGResourcePattern.h b/Source/core/rendering/svg/RenderSVGResourcePattern.h |
index 9184864b2897a910a17bb139f6baaa8caf066d67..dfb89113ede76b08118c1dfac492c479009ca609 100644 |
--- a/Source/core/rendering/svg/RenderSVGResourcePattern.h |
+++ b/Source/core/rendering/svg/RenderSVGResourcePattern.h |
@@ -1,6 +1,7 @@ |
/* |
* Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
* Copyright (C) Research In Motion Limited 2010. All rights reserved. |
+ * Copyright (C) 2014 Google Inc. All rights reserved. |
* |
* This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Library General Public |
@@ -23,24 +24,20 @@ |
#include "core/rendering/svg/RenderSVGResourceContainer.h" |
#include "core/svg/PatternAttributes.h" |
-#include "core/svg/SVGPatternElement.h" |
-#include "core/svg/SVGUnitTypes.h" |
-#include "platform/geometry/FloatRect.h" |
-#include "platform/graphics/ImageBuffer.h" |
-#include "platform/graphics/Pattern.h" |
-#include "platform/transforms/AffineTransform.h" |
#include "wtf/HashMap.h" |
#include "wtf/OwnPtr.h" |
+#include "wtf/RefPtr.h" |
namespace blink { |
-struct PatternData { |
- WTF_MAKE_FAST_ALLOCATED; |
-public: |
- RefPtr<Pattern> pattern; |
- AffineTransform transform; |
-}; |
+class AffineTransform; |
+class DisplayList; |
+class FloatRect; |
+class GraphicsContext; |
+class ImageBuffer; |
+class SVGPatternElement; |
+struct PatternData; |
class RenderSVGResourcePattern FINAL : public RenderSVGResourceContainer { |
public: |
@@ -58,15 +55,22 @@ public: |
static const RenderSVGResourceType s_resourceType; |
private: |
- bool buildTileImageTransform(RenderObject*, const PatternAttributes&, const SVGPatternElement*, FloatRect& patternBoundaries, AffineTransform& tileImageTransform) const; |
- |
- PassOwnPtr<ImageBuffer> createTileImage(const PatternAttributes&, const FloatRect& tileBoundaries, |
- const FloatRect& absoluteTileBoundaries, const AffineTransform& tileImageTransform) const; |
- |
- PatternData* buildPattern(RenderObject*, unsigned short resourceMode); |
+ bool computeTileMetrics(const RenderObject&, const SVGPatternElement&, FloatRect& bounds, |
+ AffineTransform&) const; |
+ PassOwnPtr<PatternData> buildPatternData(GraphicsContext&, RenderObject&); |
+ PassRefPtr<DisplayList> asDisplayList(GraphicsContext&, const FloatRect& tileBounds, |
+ const AffineTransform&) const; |
+ PatternData* patternForRenderer(GraphicsContext&, RenderObject&); |
bool m_shouldCollectPatternAttributes : 1; |
PatternAttributes m_attributes; |
+ |
+ // FIXME: we can almost do away with this per-object map, but not quite: the tile size can be |
+ // relative to the client bounding box, and it gets captured in the cached Pattern shader. |
+ // Hence, we need one Pattern shader per client. The display list OTOH is the same => we |
+ // should be able to cache a single display list per RenderSVGResourcePattern + one |
+ // Pattern(shader) for each client -- this would avoid re-recording when multiple clients |
+ // share the same pattern. |
HashMap<RenderObject*, OwnPtr<PatternData> > m_patternMap; |
}; |