OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |