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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 const GrMipLevel* texels, int mipLevelCount)
{ | 414 const GrMipLevel* texels, int mipLevelCount)
{ |
415 const GrCaps* caps = ctx->caps(); | 415 const GrCaps* caps = ctx->caps(); |
416 return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDe
sc(info, *caps), | 416 return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDe
sc(info, *caps), |
417 SkBudgeted::kYes, texe
ls, | 417 SkBudgeted::kYes, texe
ls, |
418 mipLevelCount); | 418 mipLevelCount); |
419 } | 419 } |
420 | 420 |
421 GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap, | 421 GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap, |
422 const GrTextureParams& params, | 422 const GrTextureParams& params, |
423 SkSourceGammaTreatment gammaTreatment) { | 423 SkSourceGammaTreatment gammaTreatment) { |
424 if (bitmap.getTexture()) { | |
425 return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params,
gammaTreatment, | |
426 nullptr)
; | |
427 } | |
428 return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, gammaTr
eatment); | 424 return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params, gammaTr
eatment); |
429 } | 425 } |
430 | 426 |
| 427 sk_sp<GrTexture> GrMakeCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitma
p, |
| 428 const GrTextureParams& params, |
| 429 SkSourceGammaTreatment gammaTreatment
) { |
| 430 GrTexture* tex = GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(param
s, gammaTreatment); |
| 431 return sk_sp<GrTexture>(tex); |
| 432 } |
| 433 |
431 /////////////////////////////////////////////////////////////////////////////// | 434 /////////////////////////////////////////////////////////////////////////////// |
432 | 435 |
433 // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass | 436 // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass |
434 // alpha info, that will be considered. | 437 // alpha info, that will be considered. |
435 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, const SkCol
orSpace* cs, | 438 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, const SkCol
orSpace* cs, |
436 const GrCaps& caps) { | 439 const GrCaps& caps) { |
437 // We intentionally ignore profile type for non-8888 formats. Anything we ca
n't support | 440 // We intentionally ignore profile type for non-8888 formats. Anything we ca
n't support |
438 // in hardware will be expanded to sRGB 8888 in GrUploadPixmapToTexture. | 441 // in hardware will be expanded to sRGB 8888 in GrUploadPixmapToTexture. |
439 switch (ct) { | 442 switch (ct) { |
440 case kUnknown_SkColorType: | 443 case kUnknown_SkColorType: |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 SkErrorInternals::SetError( kInvalidPaint_SkError, | 771 SkErrorInternals::SetError( kInvalidPaint_SkError, |
769 "Sorry, I don't understand the filtering
" | 772 "Sorry, I don't understand the filtering
" |
770 "mode you asked for. Falling back to " | 773 "mode you asked for. Falling back to " |
771 "MIPMaps."); | 774 "MIPMaps."); |
772 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 775 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
773 break; | 776 break; |
774 | 777 |
775 } | 778 } |
776 return textureFilterMode; | 779 return textureFilterMode; |
777 } | 780 } |
OLD | NEW |