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 |