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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/PicturePattern.cpp

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/PicturePattern.h" 5 #include "platform/graphics/PicturePattern.h"
6 6
7 #include "platform/graphics/skia/SkiaUtils.h" 7 #include "platform/graphics/skia/SkiaUtils.h"
8 #include "third_party/skia/include/core/SkPicture.h" 8 #include "skia/ext/cdl_paint.h"
9 #include "skia/ext/cdl_picture.h"
10 #include "skia/ext/cdl_shader.h"
9 #include "third_party/skia/include/core/SkShader.h" 11 #include "third_party/skia/include/core/SkShader.h"
10 12
11 namespace blink { 13 namespace blink {
12 14
13 PassRefPtr<PicturePattern> PicturePattern::create(sk_sp<SkPicture> picture, 15 PassRefPtr<PicturePattern> PicturePattern::create(sk_sp<CdlPicture> picture,
14 RepeatMode repeatMode) { 16 RepeatMode repeatMode) {
15 return adoptRef(new PicturePattern(std::move(picture), repeatMode)); 17 return adoptRef(new PicturePattern(std::move(picture), repeatMode));
16 } 18 }
17 19
18 PicturePattern::PicturePattern(sk_sp<SkPicture> picture, RepeatMode mode) 20 PicturePattern::PicturePattern(sk_sp<CdlPicture> picture, RepeatMode mode)
19 : Pattern(mode), m_tilePicture(std::move(picture)) { 21 : Pattern(mode), m_tilePicture(std::move(picture)) {
20 // All current clients use RepeatModeXY, so we only support this mode for now. 22 // All current clients use RepeatModeXY, so we only support this mode for now.
21 ASSERT(isRepeatXY()); 23 ASSERT(isRepeatXY());
22 24
23 // FIXME: we don't have a good way to account for DL memory utilization. 25 // FIXME: we don't have a good way to account for DL memory utilization.
24 } 26 }
25 27
26 PicturePattern::~PicturePattern() {} 28 PicturePattern::~PicturePattern() {}
27 29
28 sk_sp<SkShader> PicturePattern::createShader(const SkMatrix& localMatrix) { 30 sk_sp<CdlShader> PicturePattern::createShader(const SkMatrix& localMatrix) {
29 SkRect tileBounds = m_tilePicture->cullRect(); 31 SkRect tileBounds = m_tilePicture->cullRect();
30 32
31 return SkShader::MakePictureShader(m_tilePicture, SkShader::kRepeat_TileMode, 33 return CdlShader::MakePictureShader(m_tilePicture, SkShader::kRepeat_TileMode,
32 SkShader::kRepeat_TileMode, &localMatrix, 34 SkShader::kRepeat_TileMode, &localMatrix,
33 &tileBounds); 35 &tileBounds);
34 } 36 }
35 37
36 } // namespace blink 38 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698