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

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

Issue 1789663002: sRGB support in Ganesh. Several pieces: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Squelch assert when blurring sRGB 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(), SkImageInfo2Gr PixelConfig(fInfo), 174 if (!tex->readPixels(0, 0, bitmap->width(), bitmap->height(),
175 SkImageInfo2GrPixelConfig(fInfo, *tex->getContext()->ca ps()),
175 bitmap->getPixels(), bitmap->rowBytes(), pixelOpsFlags) ) { 176 bitmap->getPixels(), bitmap->rowBytes(), pixelOpsFlags) ) {
176 bitmap->reset(); 177 bitmap->reset();
177 return false; 178 return false;
178 } 179 }
179 180
180 bitmap->pixelRef()->setImmutableWithID(fUniqueID); 181 bitmap->pixelRef()->setImmutableWithID(fUniqueID);
181 if (SkImage::kAllow_CachingHint == chint) { 182 if (SkImage::kAllow_CachingHint == chint) {
182 SkBitmapCache::Add(fUniqueID, *bitmap); 183 SkBitmapCache::Add(fUniqueID, *bitmap);
183 if (client) { 184 if (client) {
184 as_IB(client)->notifyAddedToCache(); 185 as_IB(client)->notifyAddedToCache();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 { 267 {
267 ScopedGenerator generator(this); 268 ScopedGenerator generator(this);
268 SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width (), fInfo.height()); 269 SkIRect subset = SkIRect::MakeXYWH(fOrigin.x(), fOrigin.y(), fInfo.width (), fInfo.height());
269 if (GrTexture* tex = generator->generateTexture(ctx, &subset)) { 270 if (GrTexture* tex = generator->generateTexture(ctx, &subset)) {
270 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath, 271 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath,
271 kLockTexturePathCount); 272 kLockTexturePathCount);
272 return set_key_and_return(tex, key); 273 return set_key_and_return(tex, key);
273 } 274 }
274 } 275 }
275 276
276 const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(fInfo); 277 const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(fInfo, *ctx->caps());
277 278
278 // 3. Ask the generator to return a compressed form that the GPU might suppo rt 279 // 3. Ask the generator to return a compressed form that the GPU might suppo rt
279 SkAutoTUnref<SkData> data(this->refEncoded(ctx)); 280 SkAutoTUnref<SkData> data(this->refEncoded(ctx));
280 if (data) { 281 if (data) {
281 GrTexture* tex = load_compressed_into_texture(ctx, data, desc); 282 GrTexture* tex = load_compressed_into_texture(ctx, data, desc);
282 if (tex) { 283 if (tex) {
283 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kCompressed_LockTextureP ath, 284 SK_HISTOGRAM_ENUMERATION("LockTexturePath", kCompressed_LockTextureP ath,
284 kLockTexturePathCount); 285 kLockTexturePathCount);
285 return set_key_and_return(tex, key); 286 return set_key_and_return(tex, key);
286 } 287 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 333 }
333 334
334 #else 335 #else
335 336
336 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&, 337 GrTexture* SkImageCacherator::lockAsTexture(GrContext* ctx, const GrTextureParam s&,
337 const SkImage* client, SkImage::Cach ingHint) { 338 const SkImage* client, SkImage::Cach ingHint) {
338 return nullptr; 339 return nullptr;
339 } 340 }
340 341
341 #endif 342 #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