| OLD | NEW |
| 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 |
| OLD | NEW |