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

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

Issue 2239723002: fix memory leak, remake Imageshader to use sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if (as_IB(this)->getROPixels(&bm)) { 101 if (as_IB(this)->getROPixels(&bm)) {
102 bm.lockPixels(); 102 bm.lockPixels();
103 bm.unlockPixels(); 103 bm.unlockPixels();
104 } 104 }
105 } 105 }
106 106
107 //////////////////////////////////////////////////////////////////////////////// /////////////////// 107 //////////////////////////////////////////////////////////////////////////////// ///////////////////
108 108
109 sk_sp<SkShader> SkImage::makeShader(SkShader::TileMode tileX, SkShader::TileMode tileY, 109 sk_sp<SkShader> SkImage::makeShader(SkShader::TileMode tileX, SkShader::TileMode tileY,
110 const SkMatrix* localMatrix) const { 110 const SkMatrix* localMatrix) const {
111 return SkImageShader::Make(this, tileX, tileY, localMatrix); 111 return SkImageShader::Make(sk_ref_sp(const_cast<SkImage*>(this)), tileX, til eY, localMatrix);
112 } 112 }
113 113
114 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR 114 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR
115 SkShader* SkImage::newShader(SkShader::TileMode tileX, SkShader::TileMode tileY, 115 SkShader* SkImage::newShader(SkShader::TileMode tileX, SkShader::TileMode tileY,
116 const SkMatrix* localMatrix) const { 116 const SkMatrix* localMatrix) const {
117 return this->makeShader(tileX, tileY, localMatrix).release(); 117 return this->makeShader(tileX, tileY, localMatrix).release();
118 } 118 }
119 #endif 119 #endif
120 120
121 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { 121 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 //////////////////////////////////////////////////////////////////////////////// /////////////////// 504 //////////////////////////////////////////////////////////////////////////////// ///////////////////
505 #include "SkImageDeserializer.h" 505 #include "SkImageDeserializer.h"
506 506
507 sk_sp<SkImage> SkImageDeserializer::makeFromData(SkData* data, const SkIRect* su bset) { 507 sk_sp<SkImage> SkImageDeserializer::makeFromData(SkData* data, const SkIRect* su bset) {
508 return SkImage::MakeFromEncoded(sk_ref_sp(data), subset); 508 return SkImage::MakeFromEncoded(sk_ref_sp(data), subset);
509 } 509 }
510 sk_sp<SkImage> SkImageDeserializer::makeFromMemory(const void* data, size_t leng th, 510 sk_sp<SkImage> SkImageDeserializer::makeFromMemory(const void* data, size_t leng th,
511 const SkIRect* subset) { 511 const SkIRect* subset) {
512 return SkImage::MakeFromEncoded(SkData::MakeWithCopy(data, length), subset); 512 return SkImage::MakeFromEncoded(SkData::MakeWithCopy(data, length), subset);
513 } 513 }
OLDNEW
« no previous file with comments | « no previous file | src/image/SkImageShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698