OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |