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

Side by Side Diff: src/image/SkImage_Gpu.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/gpu/SkGpuDevice.cpp ('k') | src/image/SkImage_Raster.cpp » ('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 "SkAutoPixmapStorage.h" 8 #include "SkAutoPixmapStorage.h"
9 #include "GrCaps.h" 9 #include "GrCaps.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 dst->pixelRef()->setImmutableWithID(this->uniqueID()); 75 dst->pixelRef()->setImmutableWithID(this->uniqueID());
76 if (kAllow_CachingHint == chint) { 76 if (kAllow_CachingHint == chint) {
77 SkBitmapCache::Add(this->uniqueID(), *dst); 77 SkBitmapCache::Add(this->uniqueID(), *dst);
78 fAddedRasterVersionToCache.store(true); 78 fAddedRasterVersionToCache.store(true);
79 } 79 }
80 return true; 80 return true;
81 } 81 }
82 82
83 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para ms, 83 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para ms,
84 SkSourceGammaTreatment gammaTreatment) cons t { 84 SkSourceGammaTreatment gammaTreatment) cons t {
85 GrTextureAdjuster adjuster(this->peekTexture(), this->bounds(), this->unique ID(), 85 GrTextureAdjuster adjuster(this->peekTexture(), this->alphaType(), this->bou nds(), this->uniqueID(),
86 this->onImageInfo().colorSpace()); 86 this->onImageInfo().colorSpace());
87 return adjuster.refTextureSafeForParams(params, gammaTreatment, nullptr); 87 return adjuster.refTextureSafeForParams(params, gammaTreatment, nullptr);
88 } 88 }
89 89
90 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) { 90 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) {
91 switch (info.colorType()) { 91 switch (info.colorType()) {
92 case kRGBA_8888_SkColorType: 92 case kRGBA_8888_SkColorType:
93 case kBGRA_8888_SkColorType: 93 case kBGRA_8888_SkColorType:
94 break; 94 break;
95 default: 95 default:
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 return nullptr; 563 return nullptr;
564 } 564 }
565 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); 565 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount));
566 if (!texture) { 566 if (!texture) {
567 return nullptr; 567 return nullptr;
568 } 568 }
569 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, 569 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID,
570 info.alphaType(), texture, sk_ref_sp(info.col orSpace()), 570 info.alphaType(), texture, sk_ref_sp(info.col orSpace()),
571 budgeted); 571 budgeted);
572 } 572 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698