| 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/paint/PaintFlags.h" |
| 8 #include "platform/graphics/paint/PaintRecord.h" |
| 9 #include "platform/graphics/paint/PaintShader.h" |
| 7 #include "platform/graphics/skia/SkiaUtils.h" | 10 #include "platform/graphics/skia/SkiaUtils.h" |
| 8 #include "third_party/skia/include/core/SkPicture.h" | |
| 9 #include "third_party/skia/include/core/SkShader.h" | |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 PassRefPtr<PicturePattern> PicturePattern::create(sk_sp<SkPicture> picture, | 14 PassRefPtr<PicturePattern> PicturePattern::create(sk_sp<PaintRecord> picture, |
| 14 RepeatMode repeatMode) { | 15 RepeatMode repeatMode) { |
| 15 return adoptRef(new PicturePattern(std::move(picture), repeatMode)); | 16 return adoptRef(new PicturePattern(std::move(picture), repeatMode)); |
| 16 } | 17 } |
| 17 | 18 |
| 18 PicturePattern::PicturePattern(sk_sp<SkPicture> picture, RepeatMode mode) | 19 PicturePattern::PicturePattern(sk_sp<PaintRecord> picture, RepeatMode mode) |
| 19 : Pattern(mode), m_tilePicture(std::move(picture)) { | 20 : Pattern(mode), m_tilePicture(std::move(picture)) { |
| 20 // All current clients use RepeatModeXY, so we only support this mode for now. | 21 // All current clients use RepeatModeXY, so we only support this mode for now. |
| 21 ASSERT(isRepeatXY()); | 22 ASSERT(isRepeatXY()); |
| 22 | 23 |
| 23 // FIXME: we don't have a good way to account for DL memory utilization. | 24 // FIXME: we don't have a good way to account for DL memory utilization. |
| 24 } | 25 } |
| 25 | 26 |
| 26 PicturePattern::~PicturePattern() {} | 27 PicturePattern::~PicturePattern() {} |
| 27 | 28 |
| 28 sk_sp<SkShader> PicturePattern::createShader(const SkMatrix& localMatrix) { | 29 sk_sp<PaintShader> PicturePattern::createShader(const SkMatrix& localMatrix) { |
| 29 SkRect tileBounds = m_tilePicture->cullRect(); | 30 SkRect tileBounds = m_tilePicture->cullRect(); |
| 30 | 31 |
| 31 return SkShader::MakePictureShader(m_tilePicture, SkShader::kRepeat_TileMode, | 32 return MakePaintShaderRecord(m_tilePicture, SkShader::kRepeat_TileMode, |
| 32 SkShader::kRepeat_TileMode, &localMatrix, | 33 SkShader::kRepeat_TileMode, &localMatrix, |
| 33 &tileBounds); | 34 &tileBounds); |
| 34 } | 35 } |
| 35 | 36 |
| 36 } // namespace blink | 37 } // namespace blink |
| OLD | NEW |