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

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

Issue 2250403003: Add alpha type to texture producer (Closed) Base URL: https://skia.googlesource.com/skia.git@image-alpha-type
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 | « src/image/SkImage_Gpu.cpp ('k') | no next file » | 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 "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
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
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 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698