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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 } |
OLD | NEW |