| 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 "third_party/skia/include/core/SkPicture.h" |
| 9 #include "third_party/skia/include/core/SkShader.h" | 9 #include "third_party/skia/include/core/SkShader.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 PassRefPtr<PicturePattern> PicturePattern::create(PassRefPtr<SkPicture> picture, | 13 PassRefPtr<PicturePattern> PicturePattern::create(PassRefPtr<const SkPicture> pi
cture, |
| 14 RepeatMode repeatMode) | 14 RepeatMode repeatMode) |
| 15 { | 15 { |
| 16 return adoptRef(new PicturePattern(picture, repeatMode)); | 16 return adoptRef(new PicturePattern(picture, repeatMode)); |
| 17 } | 17 } |
| 18 | 18 |
| 19 PicturePattern::PicturePattern(PassRefPtr<SkPicture> picture, RepeatMode mode) | 19 PicturePattern::PicturePattern(PassRefPtr<const SkPicture> picture, RepeatMode m
ode) |
| 20 : Pattern(mode) | 20 : Pattern(mode) |
| 21 , m_tilePicture(picture) | 21 , m_tilePicture(picture) |
| 22 { | 22 { |
| 23 // All current clients use RepeatModeXY, so we only support this mode for no
w. | 23 // All current clients use RepeatModeXY, so we only support this mode for no
w. |
| 24 ASSERT(isRepeatXY()); | 24 ASSERT(isRepeatXY()); |
| 25 | 25 |
| 26 // FIXME: we don't have a good way to account for DL memory utilization. | 26 // FIXME: we don't have a good way to account for DL memory utilization. |
| 27 } | 27 } |
| 28 | 28 |
| 29 PicturePattern::~PicturePattern() | 29 PicturePattern::~PicturePattern() |
| 30 { | 30 { |
| 31 } | 31 } |
| 32 | 32 |
| 33 PassRefPtr<SkShader> PicturePattern::createShader() | 33 PassRefPtr<SkShader> PicturePattern::createShader() |
| 34 { | 34 { |
| 35 SkMatrix localMatrix = affineTransformToSkMatrix(m_patternSpaceTransformatio
n); | 35 SkMatrix localMatrix = affineTransformToSkMatrix(m_patternSpaceTransformatio
n); |
| 36 SkRect tileBounds = m_tilePicture->cullRect(); | 36 SkRect tileBounds = m_tilePicture->cullRect(); |
| 37 | 37 |
| 38 return adoptRef(SkShader::MakePictureShader(adoptSkSp<SkPicture>(m_tilePictu
re), | 38 return adoptRef(SkShader::CreatePictureShader(m_tilePicture.get(), |
| 39 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &localMatrix, &t
ileBounds)); | 39 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &localMatrix, &t
ileBounds)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace blink | 42 } // namespace blink |
| OLD | NEW |