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 "SkImage_Base.h" | 8 #include "SkImage_Base.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkBitmapProcShader.h" | 10 #include "SkBitmapProcShader.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& p
arams, | 201 GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& p
arams, |
202 SkSourceGammaTreatment gammaTreatment) c
onst { | 202 SkSourceGammaTreatment gammaTreatment) c
onst { |
203 #if SK_SUPPORT_GPU | 203 #if SK_SUPPORT_GPU |
204 if (!ctx) { | 204 if (!ctx) { |
205 return nullptr; | 205 return nullptr; |
206 } | 206 } |
207 | 207 |
208 uint32_t uniqueID; | 208 uint32_t uniqueID; |
209 sk_sp<GrTexture> tex = this->refPinnedTexture(&uniqueID); | 209 sk_sp<GrTexture> tex = this->refPinnedTexture(&uniqueID); |
210 if (tex) { | 210 if (tex) { |
211 GrTextureAdjuster adjuster(fPinnedTexture.get(), fBitmap.bounds(), | 211 GrTextureAdjuster adjuster(fPinnedTexture.get(), fBitmap.alphaType(), fB
itmap.bounds(), |
212 fPinnedUniqueID, fBitmap.colorSpace()); | 212 fPinnedUniqueID, fBitmap.colorSpace()); |
213 return adjuster.refTextureSafeForParams(params, gammaTreatment, nullptr)
; | 213 return adjuster.refTextureSafeForParams(params, gammaTreatment, nullptr)
; |
214 } | 214 } |
215 | 215 |
216 return GrRefCachedBitmapTexture(ctx, fBitmap, params, gammaTreatment); | 216 return GrRefCachedBitmapTexture(ctx, fBitmap, params, gammaTreatment); |
217 #endif | 217 #endif |
218 | 218 |
219 return nullptr; | 219 return nullptr; |
220 } | 220 } |
221 | 221 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // pixelref since the caller might call setImmutable() themselves | 369 // pixelref since the caller might call setImmutable() themselves |
370 // (thus changing our state). | 370 // (thus changing our state). |
371 if (fBitmap.isImmutable()) { | 371 if (fBitmap.isImmutable()) { |
372 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); | 372 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); |
373 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); | 373 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); |
374 return true; | 374 return true; |
375 } | 375 } |
376 } | 376 } |
377 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); | 377 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); |
378 } | 378 } |
OLD | NEW |