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

Side by Side Diff: src/image/SkImage.cpp

Issue 1785473002: SkImage now has makeShader to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use build guard for impl of newShader Created 4 years, 9 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
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkImageShader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // 84 //
85 SkBitmap bm; 85 SkBitmap bm;
86 if (as_IB(this)->getROPixels(&bm)) { 86 if (as_IB(this)->getROPixels(&bm)) {
87 bm.lockPixels(); 87 bm.lockPixels();
88 bm.unlockPixels(); 88 bm.unlockPixels();
89 } 89 }
90 } 90 }
91 91
92 //////////////////////////////////////////////////////////////////////////////// /////////////////// 92 //////////////////////////////////////////////////////////////////////////////// ///////////////////
93 93
94 SkShader* SkImage::newShader(SkShader::TileMode tileX, 94 sk_sp<SkShader> SkImage::makeShader(SkShader::TileMode tileX, SkShader::TileMode tileY,
95 SkShader::TileMode tileY, 95 const SkMatrix* localMatrix) const {
96 return SkImageShader::Make(this, tileX, tileY, localMatrix);
97 }
98
99 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR
100 SkShader* SkImage::newShader(SkShader::TileMode tileX, SkShader::TileMode tileY,
96 const SkMatrix* localMatrix) const { 101 const SkMatrix* localMatrix) const {
97 return SkImageShader::Create(this, tileX, tileY, localMatrix); 102 return this->makeShader(tileX, tileY, localMatrix).release();
98 } 103 }
104 #endif
99 105
100 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { 106 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
101 SkBitmap bm; 107 SkBitmap bm;
102 if (as_IB(this)->getROPixels(&bm)) { 108 if (as_IB(this)->getROPixels(&bm)) {
103 return SkImageEncoder::EncodeData(bm, type, quality); 109 return SkImageEncoder::EncodeData(bm, type, quality);
104 } 110 }
105 return nullptr; 111 return nullptr;
106 } 112 }
107 113
108 SkData* SkImage::encode(SkPixelSerializer* serializer) const { 114 SkData* SkImage::encode(SkPixelSerializer* serializer) const {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 364
359 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) { 365 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) {
360 return nullptr; 366 return nullptr;
361 } 367 }
362 368
363 SkImage* SkImage::newTextureImage(GrContext*) const { 369 SkImage* SkImage::newTextureImage(GrContext*) const {
364 return nullptr; 370 return nullptr;
365 } 371 }
366 372
367 #endif 373 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkImageShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698