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

Unified Diff: Source/core/rendering/svg/RenderSVGResource.h

Issue 638933002: Introduce SVGPaintServer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Disambiguate. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/SVGInlineTextBoxPainter.cpp ('k') | Source/core/rendering/svg/RenderSVGResource.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGResource.h
diff --git a/Source/core/rendering/svg/RenderSVGResource.h b/Source/core/rendering/svg/RenderSVGResource.h
index 7c283a6ba82bf6e0123579e19a9fe25b493d05c3..1fe6ac71992bce430a6be5e3015116d2253a532f 100644
--- a/Source/core/rendering/svg/RenderSVGResource.h
+++ b/Source/core/rendering/svg/RenderSVGResource.h
@@ -20,6 +20,10 @@
#ifndef RenderSVGResource_h
#define RenderSVGResource_h
+#include "platform/graphics/Color.h"
+#include "platform/graphics/Gradient.h"
+#include "platform/graphics/Pattern.h"
+
namespace blink {
enum RenderSVGResourceType {
@@ -42,17 +46,36 @@ enum RenderSVGResourceMode {
typedef unsigned RenderSVGResourceModeFlags;
class GraphicsContext;
+class GraphicsContextStateSaver;
class RenderObject;
class RenderStyle;
class RenderSVGResourceSolidColor;
+class SVGPaintServer {
+public:
+ explicit SVGPaintServer(Color);
+ explicit SVGPaintServer(PassRefPtr<Gradient>);
+ explicit SVGPaintServer(PassRefPtr<Pattern>);
+
+ static SVGPaintServer requestForRenderer(RenderObject&, RenderStyle*, RenderSVGResourceModeFlags);
+
+ void apply(GraphicsContext&, RenderSVGResourceMode, GraphicsContextStateSaver* = 0);
+
+ static SVGPaintServer invalid() { return SVGPaintServer(Color(Color::transparent)); }
+ bool isValid() const { return m_color != Color::transparent; }
pdr. 2014/10/13 17:08:57 (For a followup) What do you think about isNonTran
+
+private:
+ RefPtr<Gradient> m_gradient;
+ RefPtr<Pattern> m_pattern;
+ Color m_color;
+};
+
class RenderSVGResource {
public:
RenderSVGResource() { }
virtual ~RenderSVGResource() { }
- virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*, RenderSVGResourceModeFlags);
- virtual void postApplyResource(GraphicsContext*) { }
+ virtual SVGPaintServer preparePaintServer(RenderObject*, RenderStyle*, RenderSVGResourceModeFlags);
virtual RenderSVGResourceType resourceType() const = 0;
@@ -62,10 +85,6 @@ public:
static RenderSVGResourceSolidColor* sharedSolidPaintingResource();
static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool needsLayout = true);
-
-protected:
- // Transfer fill/stroke style (except paint server) to the GC.
- static void updateGraphicsContext(GraphicsContext*, const RenderStyle*, const RenderObject&, unsigned resourceModeFlags);
};
#define DEFINE_RENDER_SVG_RESOURCE_TYPE_CASTS(thisType, typeName) \
« no previous file with comments | « Source/core/paint/SVGInlineTextBoxPainter.cpp ('k') | Source/core/rendering/svg/RenderSVGResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698