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

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

Issue 2241353002: pin as texture api (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comments 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.h ('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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 dst->pixelRef()->setImmutableWithID(this->uniqueID()); 76 dst->pixelRef()->setImmutableWithID(this->uniqueID());
77 if (kAllow_CachingHint == chint) { 77 if (kAllow_CachingHint == chint) {
78 SkBitmapCache::Add(this->uniqueID(), *dst); 78 SkBitmapCache::Add(this->uniqueID(), *dst);
79 fAddedRasterVersionToCache.store(true); 79 fAddedRasterVersionToCache.store(true);
80 } 80 }
81 return true; 81 return true;
82 } 82 }
83 83
84 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para ms, 84 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para ms,
85 SkSourceGammaTreatment gammaTreatment) cons t { 85 SkSourceGammaTreatment gammaTreatment) cons t {
86 return GrImageTextureAdjuster(as_IB(this)).refTextureSafeForParams(params, g ammaTreatment, 86 GrTextureAdjuster adjuster(this->peekTexture(), this->bounds(), this->unique ID(),
87 nullptr); 87 this->onImageInfo().colorSpace());
88 return adjuster.refTextureSafeForParams(params, gammaTreatment, nullptr);
88 } 89 }
89 90
90 bool SkImage_Gpu::isOpaque() const { 91 bool SkImage_Gpu::isOpaque() const {
91 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk AlphaType; 92 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk AlphaType;
92 } 93 }
93 94
94 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) { 95 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) {
95 switch (info.colorType()) { 96 switch (info.colorType()) {
96 case kRGBA_8888_SkColorType: 97 case kRGBA_8888_SkColorType:
97 case kBGRA_8888_SkColorType: 98 case kBGRA_8888_SkColorType:
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 return nullptr; 571 return nullptr;
571 } 572 }
572 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount)); 573 SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, m ipLevelCount));
573 if (!texture) { 574 if (!texture) {
574 return nullptr; 575 return nullptr;
575 } 576 }
576 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID, 577 return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNew ImageUniqueID,
577 info.alphaType(), texture, sk_ref_sp(info.col orSpace()), 578 info.alphaType(), texture, sk_ref_sp(info.col orSpace()),
578 budgeted); 579 budgeted);
579 } 580 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698