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

Unified Diff: Source/core/platform/graphics/StrokeData.cpp

Issue 18551004: Miscellaneous cleanup to reduce number of includes in platform/graphics/ Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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/platform/graphics/StrokeData.cpp
diff --git a/Source/core/platform/graphics/StrokeData.cpp b/Source/core/platform/graphics/StrokeData.cpp
index 23e44243256e16bca9f39937378dc196c5e141e2..6522c8ef13bf14e15975d6a97f76525783b2af8f 100644
--- a/Source/core/platform/graphics/StrokeData.cpp
+++ b/Source/core/platform/graphics/StrokeData.cpp
@@ -29,10 +29,64 @@
#include "config.h"
#include "core/platform/graphics/StrokeData.h"
+#include "core/platform/graphics/Gradient.h"
+#include "core/platform/graphics/Pattern.h"
+#include "third_party/skia/include/core/SkRefCnt.h"
+#include "third_party/skia/include/effects/SkDashPathEffect.h"
+
namespace WebCore {
static const int dashRatio = 3; // Ratio of the length of a dash to its width.
+StrokeData::StrokeData()
+ : m_style(SolidStroke)
+ , m_thickness(0)
+ , m_color(Color::black)
+ , m_lineCap(SkPaint::kDefault_Cap)
+ , m_lineJoin(SkPaint::kDefault_Join)
+ , m_miterLimit(4)
+ , m_dash(0)
+{
+}
+
+StrokeData::StrokeData(const StrokeData& other)
+ : m_style(other.m_style)
+ , m_thickness(other.m_thickness)
+ , m_color(other.m_color)
+ , m_gradient(other.m_gradient)
+ , m_pattern(other.m_pattern)
+ , m_lineCap(other.m_lineCap)
+ , m_lineJoin(other.m_lineJoin)
+ , m_miterLimit(other.m_miterLimit)
+ , m_dash(other.m_dash)
+{
+ SkSafeRef(m_dash);
+}
+
+StrokeData::~StrokeData()
+{
+ SkSafeUnref(m_dash);
+}
+
+void StrokeData::setColor(const Color& color)
+{
+ m_color = color;
+ m_gradient.clear();
+ m_pattern.clear();
+}
+
+void StrokeData::setGradient(PassRefPtr<Gradient> gradient)
+{
+ m_gradient = gradient;
+ m_pattern.clear();
+}
+
+void StrokeData::setPattern(PassRefPtr<Pattern> pattern)
+{
+ m_pattern = pattern;
+ m_gradient.clear();
+}
+
void StrokeData::setLineDash(const DashArray& dashes, float dashOffset)
{
// FIXME: This is lifted directly off SkiaSupport, lines 49-74
« no previous file with comments | « Source/core/platform/graphics/StrokeData.h ('k') | Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698