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

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

Issue 2290903002: Change (Pass)RefPtr<SkXxx> into sk_sp<SkXxx>. (Closed)
Patch Set: Rebasing... Created 4 years, 3 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/ImagePattern.h" 5 #include "platform/graphics/ImagePattern.h"
6 6
7 #include "platform/graphics/Image.h" 7 #include "platform/graphics/Image.h"
8 #include "platform/graphics/skia/SkiaUtils.h" 8 #include "platform/graphics/skia/SkiaUtils.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkImage.h" 10 #include "third_party/skia/include/core/SkImage.h"
11 #include "third_party/skia/include/core/SkShader.h" 11 #include "third_party/skia/include/core/SkShader.h"
12 #include "third_party/skia/include/core/SkSurface.h" 12 #include "third_party/skia/include/core/SkSurface.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 PassRefPtr<ImagePattern> ImagePattern::create(PassRefPtr<Image> image, RepeatMod e repeatMode) 16 PassRefPtr<ImagePattern> ImagePattern::create(PassRefPtr<Image> image, RepeatMod e repeatMode)
17 { 17 {
18 return adoptRef(new ImagePattern(image, repeatMode)); 18 return adoptRef(new ImagePattern(image, repeatMode));
19 } 19 }
20 20
21 ImagePattern::ImagePattern(PassRefPtr<Image> image, RepeatMode repeatMode) 21 ImagePattern::ImagePattern(PassRefPtr<Image> image, RepeatMode repeatMode)
22 : Pattern(repeatMode) 22 : Pattern(repeatMode)
23 , m_tileImage(toSkSp(image->imageForCurrentFrame())) 23 , m_tileImage(image->imageForCurrentFrame())
24 { 24 {
25 m_previousLocalMatrix.setIdentity(); 25 m_previousLocalMatrix.setIdentity();
26 if (m_tileImage) { 26 if (m_tileImage) {
27 // TODO(fmalita): mechanism to extract the actual SkImageInfo from an Sk Image? 27 // TODO(fmalita): mechanism to extract the actual SkImageInfo from an Sk Image?
28 const SkImageInfo info = SkImageInfo::MakeN32Premul( 28 const SkImageInfo info = SkImageInfo::MakeN32Premul(
29 m_tileImage->width() + (isRepeatX() ? 0 : 2), 29 m_tileImage->width() + (isRepeatX() ? 0 : 2),
30 m_tileImage->height() + (isRepeatY() ? 0 : 2)); 30 m_tileImage->height() + (isRepeatY() ? 0 : 2));
31 adjustExternalMemoryAllocated(info.getSafeSize(info.minRowBytes())); 31 adjustExternalMemoryAllocated(info.getSafeSize(info.minRowBytes()));
32 } 32 }
33 } 33 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 return surface->makeImageSnapshot()->makeShader(tileModeX, tileModeY, &adjus tedMatrix); 80 return surface->makeImageSnapshot()->makeShader(tileModeX, tileModeY, &adjus tedMatrix);
81 } 81 }
82 82
83 bool ImagePattern::isTextureBacked() const 83 bool ImagePattern::isTextureBacked() const
84 { 84 {
85 return m_tileImage && m_tileImage->isTextureBacked(); 85 return m_tileImage && m_tileImage->isTextureBacked();
86 } 86 }
87 87
88 } // namespace blink 88 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698