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

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

Issue 2177193004: Always supply a color space (sRGB for now) with F16 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix uploading of F16 textures with color spaces 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 | « samplecode/SampleApp.cpp ('k') | tests/TestConfigParsing.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 2010 Google Inc. 2 * Copyright 2010 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 8
9 #include "SkGr.h" 9 #include "SkGr.h"
10 #include "SkGrPriv.h" 10 #include "SkGrPriv.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud geted budgeted) { 238 GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud geted budgeted) {
239 const SkPixmap* pmap = &pixmap; 239 const SkPixmap* pmap = &pixmap;
240 SkPixmap tmpPixmap; 240 SkPixmap tmpPixmap;
241 SkBitmap tmpBitmap; 241 SkBitmap tmpBitmap;
242 242
243 const GrCaps* caps = ctx->caps(); 243 const GrCaps* caps = ctx->caps();
244 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps); 244 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps);
245 245
246 if (caps->srgbSupport() && !GrPixelConfigIsSRGB(desc.fConfig) && 246 if (caps->srgbSupport() &&
247 pixmap.info().colorSpace() && pixmap.info().colorSpace()->gammaCloseToSR GB()) { 247 pixmap.info().colorSpace() && pixmap.info().colorSpace()->gammaCloseToSR GB() &&
248 !(GrPixelConfigIsSRGB(desc.fConfig) ||
249 kRGBA_half_GrPixelConfig == desc.fConfig ||
250 kRGBA_float_GrPixelConfig == desc.fConfig)) {
248 // We were supplied an sRGB-like color space, but we don't have a suitab le pixel config. 251 // We were supplied an sRGB-like color space, but we don't have a suitab le pixel config.
249 // Convert to 8888 sRGB so we can handle the data correctly. The raster backend doesn't 252 // Convert to 8888 sRGB so we can handle the data correctly. The raster backend doesn't
250 // handle sRGB Index8 -> sRGB 8888 correctly (yet), so lie about both th e source and 253 // handle sRGB Index8 -> sRGB 8888 correctly (yet), so lie about both th e source and
251 // destination (claim they're linear): 254 // destination (claim they're linear):
252 SkImageInfo linSrcInfo = SkImageInfo::Make(pixmap.width(), pixmap.height (), 255 SkImageInfo linSrcInfo = SkImageInfo::Make(pixmap.width(), pixmap.height (),
253 pixmap.colorType(), pixmap.al phaType()); 256 pixmap.colorType(), pixmap.al phaType());
254 SkPixmap linSrcPixmap(linSrcInfo, pixmap.addr(), pixmap.rowBytes(), pixm ap.ctable()); 257 SkPixmap linSrcPixmap(linSrcInfo, pixmap.addr(), pixmap.rowBytes(), pixm ap.ctable());
255 258
256 SkImageInfo dstInfo = SkImageInfo::Make(pixmap.width(), pixmap.height(), 259 SkImageInfo dstInfo = SkImageInfo::Make(pixmap.width(), pixmap.height(),
257 kN32_SkColorType, kPremul_SkAlph aType, 260 kN32_SkColorType, kPremul_SkAlph aType,
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 SkErrorInternals::SetError( kInvalidPaint_SkError, 772 SkErrorInternals::SetError( kInvalidPaint_SkError,
770 "Sorry, I don't understand the filtering " 773 "Sorry, I don't understand the filtering "
771 "mode you asked for. Falling back to " 774 "mode you asked for. Falling back to "
772 "MIPMaps."); 775 "MIPMaps.");
773 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 776 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
774 break; 777 break;
775 778
776 } 779 }
777 return textureFilterMode; 780 return textureFilterMode;
778 } 781 }
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | tests/TestConfigParsing.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698