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

Side by Side Diff: src/gpu/GrImageIDTextureAdjuster.cpp

Issue 2037413002: Add SkSourceGammaTreatment enum so we know how to create mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix DM compilation Created 4 years, 6 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/GrImageIDTextureAdjuster.h ('k') | src/gpu/GrTextureParamsAdjuster.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 "GrImageIDTextureAdjuster.h" 8 #include "GrImageIDTextureAdjuster.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 , fBitmap(bitmap) { 74 , fBitmap(bitmap) {
75 SkASSERT(!bitmap.getTexture()); 75 SkASSERT(!bitmap.getTexture());
76 if (!bitmap.isVolatile()) { 76 if (!bitmap.isVolatile()) {
77 SkIPoint origin = bitmap.pixelRefOrigin(); 77 SkIPoint origin = bitmap.pixelRefOrigin();
78 SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bitmap.width(), 78 SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bitmap.width(),
79 bitmap.height()); 79 bitmap.height());
80 GrMakeKeyFromImageID(&fOriginalKey, bitmap.pixelRef()->getGenerationID() , subset); 80 GrMakeKeyFromImageID(&fOriginalKey, bitmap.pixelRef()->getGenerationID() , subset);
81 } 81 }
82 } 82 }
83 83
84 GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) { 84 GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped,
85 SkSourceGammaTreatment gamma Treatment) {
85 GrTexture* tex = nullptr; 86 GrTexture* tex = nullptr;
86 87
87 if (fOriginalKey.isValid()) { 88 if (fOriginalKey.isValid()) {
88 tex = this->context()->textureProvider()->findAndRefTextureByUniqueKey(f OriginalKey); 89 tex = this->context()->textureProvider()->findAndRefTextureByUniqueKey(f OriginalKey);
89 if (tex) { 90 if (tex) {
90 return tex; 91 return tex;
91 } 92 }
92 } 93 }
93 if (willBeMipped) { 94 if (willBeMipped) {
94 tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap); 95 tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap, gamm aTreatment);
95 } 96 }
96 if (!tex) { 97 if (!tex) {
97 tex = GrUploadBitmapToTexture(this->context(), fBitmap); 98 tex = GrUploadBitmapToTexture(this->context(), fBitmap);
98 } 99 }
99 if (tex && fOriginalKey.isValid()) { 100 if (tex && fOriginalKey.isValid()) {
100 tex->resourcePriv().setUniqueKey(fOriginalKey); 101 tex->resourcePriv().setUniqueKey(fOriginalKey);
101 GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef()); 102 GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef());
102 } 103 }
103 return tex; 104 return tex;
104 } 105 }
(...skipping 18 matching lines...) Expand all
123 cacher_is_alpha_only(*cacher)) 124 cacher_is_alpha_only(*cacher))
124 , fCacher(cacher) 125 , fCacher(cacher)
125 , fClient(client) 126 , fClient(client)
126 , fCachingHint(chint) { 127 , fCachingHint(chint) {
127 if (client) { 128 if (client) {
128 GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(), 129 GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(),
129 SkIRect::MakeWH(this->width(), this->height())); 130 SkIRect::MakeWH(this->width(), this->height()));
130 } 131 }
131 } 132 }
132 133
133 GrTexture* GrImageTextureMaker::refOriginalTexture(bool willBeMipped) { 134 GrTexture* GrImageTextureMaker::refOriginalTexture(bool willBeMipped,
134 return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCaching Hint, willBeMipped); 135 SkSourceGammaTreatment gammaT reatment) {
136 return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCaching Hint, willBeMipped,
137 gammaTreatment);
135 } 138 }
136 139
137 void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* pa ramsCopyKey) { 140 void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* pa ramsCopyKey) {
138 if (fOriginalKey.isValid() && SkImage::kAllow_CachingHint == fCachingHint) { 141 if (fOriginalKey.isValid() && SkImage::kAllow_CachingHint == fCachingHint) {
139 MakeCopyKeyFromOrigKey(fOriginalKey, stretch, paramsCopyKey); 142 MakeCopyKeyFromOrigKey(fOriginalKey, stretch, paramsCopyKey);
140 } 143 }
141 } 144 }
142 145
143 void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) { 146 void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
144 if (fClient) { 147 if (fClient) {
145 as_IB(fClient)->notifyAddedToCache(); 148 as_IB(fClient)->notifyAddedToCache();
146 } 149 }
147 } 150 }
OLDNEW
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/GrTextureParamsAdjuster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698