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

Unified Diff: Source/core/paint/SVGPaintServer.h

Issue 638933002: Introduce SVGPaintServer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Clean away stuff again. 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
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

Powered by Google App Engine
This is Rietveld 408576698