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

Unified Diff: Source/platform/graphics/DisplayListPattern.cpp

Issue 453653003: [SVG] DisplayList-based patterns. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased 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/platform/graphics/DisplayListPattern.h ('k') | Source/platform/graphics/Pattern.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/DisplayListPattern.cpp
diff --git a/Source/platform/graphics/DisplayListPattern.cpp b/Source/platform/graphics/DisplayListPattern.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4abd881499f4d4f091f613d14e6726dcd8a6a84a
--- /dev/null
+++ b/Source/platform/graphics/DisplayListPattern.cpp
@@ -0,0 +1,38 @@
+// 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.
+
+#include "config.h"
+#include "platform/graphics/DisplayListPattern.h"
+
+#include "platform/graphics/DisplayList.h"
+#include "platform/graphics/skia/SkiaUtils.h"
+#include "third_party/skia/include/core/SkShader.h"
+
+namespace blink {
+
+DisplayListPattern::DisplayListPattern(PassRefPtr<DisplayList> displayList, RepeatMode mode)
+ : Pattern(mode)
+ , m_tileDisplayList(displayList)
+{
+ // All current clients use RepeatModeXY, so we only support this mode for now.
+ ASSERT(isRepeatXY());
+
+ // FIXME: we don't have a good way to account for DL memory utilization.
+}
+
+DisplayListPattern::~DisplayListPattern()
+{
+}
+
+PassRefPtr<SkShader> DisplayListPattern::createShader()
+{
+ SkMatrix localMatrix = affineTransformToSkMatrix(m_patternSpaceTransformation);
+ SkRect tileBounds = SkRect::MakeWH(m_tileDisplayList->bounds().width(),
+ m_tileDisplayList->bounds().height());
+
+ return adoptRef(SkShader::CreatePictureShader(m_tileDisplayList->picture(),
+ SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &localMatrix, &tileBounds));
+}
+
+} // namespace
« no previous file with comments | « Source/platform/graphics/DisplayListPattern.h ('k') | Source/platform/graphics/Pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698