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

Side by Side Diff: src/core/SkImageCacherator.cpp

Issue 1814533003: Revert of sRGB support in Ganesh. Several pieces: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « samplecode/SampleApp.cpp ('k') | src/core/SkSpecialImage.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 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkImage_Base.h" 10 #include "SkImage_Base.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bitmap->reset(); 164 bitmap->reset();
165 return false; 165 return false;
166 } 166 }
167 167
168 if (!bitmap->tryAllocPixels(fInfo)) { 168 if (!bitmap->tryAllocPixels(fInfo)) {
169 bitmap->reset(); 169 bitmap->reset();
170 return false; 170 return false;
171 } 171 }
172 172
173 const uint32_t pixelOpsFlags = 0; 173 const uint32_t pixelOpsFlags = 0;
174 if (!tex->readPixels(0, 0, bitmap->width(), bitmap->height(), 174 if (!tex->readPixels(0, 0, bitmap->width(), bitmap->height(), SkImageInfo2Gr PixelConfig(fInfo),
175 SkImageInfo2GrPixelConfig(fInfo, *tex->getContext()->ca ps()),
176 bitmap->getPixels(), bitmap->rowBytes(), pixelOpsFlags) ) { 175 bitmap->getPixels(), bitmap->rowBytes(), pixelOpsFlags) ) {
177 bitmap->reset(); 176 bitmap->reset();
178 return false; 177 return false;
179 } 178 }
180 179
181 bitmap->pixelRef()->setImmutableWithID(fUniqueID); 180 bitmap->pixelRef()->setImmutableWithID(fUniqueID);
182 if (SkImage::kAllow_CachingHint == chint) { 181 if (SkImage::kAllow_CachingHint == chint) {
183 SkBitmapCache::Add(fUniqueID, *bitmap); 182 SkBitmapCache::Add(fUniqueID, *bitmap);
184 if (client) { 183 if (client) {
185 as_IB(client)->notifyAddedToCache(); 184 as_IB(client)->notifyAddedToCache();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 { 266 {
268 ScopedGenerator generator(this); 267 ScopedGenerator generator(this);
269 SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width (), fInfo.height()); 268 SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width (), fInfo.height());
270 if (GrTexture* tex = generator->generateTexture(ctx, &subset)) { 269 if (GrTexture* tex = generator->generateTexture(ctx, &subset)) {
271 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath, 270 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath,
272 kLockTexturePathCount); 271 kLockTexturePathCount);
273 return set_key_and_return(tex, key); 272 return set_key_and_return(tex, key);
274 } 273 }
275 } 274 }
276 275
277 const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(fInfo, *ctx->caps()); 276 const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(fInfo);
278 277
279 // 3. Ask the generator to return a compressed form that the GPU might suppo rt 278 // 3. Ask the generator to return a compressed form that the GPU might suppo rt
280 SkAutoTUnref<SkData> data(this->refEncoded(ctx)); 279 SkAutoTUnref<SkData> data(this->refEncoded(ctx));
281 if (data) { 280 if (data) {
282 GrTexture* tex = load_compressed_into_texture(ctx, data, desc); 281 GrTexture* tex = load_compressed_into_texture(ctx, data, desc);
283 if (tex) { 282 if (tex) {
284 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kCompressed_LockTextureP ath, 283 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kCompressed_LockTextureP ath,
285 kLockTexturePathCount); 284 kLockTexturePathCount);
286 return set_key_and_return(tex, key); 285 return set_key_and_return(tex, key);
287 } 286 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } 332 }
334 333
335 #else 334 #else
336 335
337 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&, 336 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&,
338 const SkImage* client, SkImage::Cach ingHint) { 337 const SkImage* client, SkImage::Cach ingHint) {
339 return nullptr; 338 return nullptr;
340 } 339 }
341 340
342 #endif 341 #endif
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698