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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 SkMipMap::Level generatedMipLevel; | 387 SkMipMap::Level generatedMipLevel; |
388 mipmaps->getLevel(i - 1, &generatedMipLevel); | 388 mipmaps->getLevel(i - 1, &generatedMipLevel); |
389 texels[i].fPixels = generatedMipLevel.fPixmap.addr(); | 389 texels[i].fPixels = generatedMipLevel.fPixmap.addr(); |
390 texels[i].fRowBytes = generatedMipLevel.fPixmap.rowBytes(); | 390 texels[i].fRowBytes = generatedMipLevel.fPixmap.rowBytes(); |
391 } | 391 } |
392 | 392 |
393 return ctx->textureProvider()->createMipMappedTexture(desc, SkBudgeted::kYes
, texels.get(), | 393 return ctx->textureProvider()->createMipMappedTexture(desc, SkBudgeted::kYes
, texels.get(), |
394 mipLevelCount); | 394 mipLevelCount); |
395 } | 395 } |
396 | 396 |
| 397 GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info, |
| 398 const GrMipLevel* texels, int mipLevelCount)
{ |
| 399 const GrCaps* caps = ctx->caps(); |
| 400 return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDe
sc(info, *caps), |
| 401 SkBudgeted::kYes, texe
ls, |
| 402 mipLevelCount); |
| 403 } |
| 404 |
397 GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap, | 405 GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap, |
398 const GrTextureParams& params) { | 406 const GrTextureParams& params) { |
399 if (bitmap.getTexture()) { | 407 if (bitmap.getTexture()) { |
400 return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params,
nullptr); | 408 return GrBitmapTextureAdjuster(&bitmap).refTextureSafeForParams(params,
nullptr); |
401 } | 409 } |
402 return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params); | 410 return GrBitmapTextureMaker(ctx, bitmap).refTextureForParams(params); |
403 } | 411 } |
404 | 412 |
405 /////////////////////////////////////////////////////////////////////////////// | 413 /////////////////////////////////////////////////////////////////////////////// |
406 | 414 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 SkErrorInternals::SetError( kInvalidPaint_SkError, | 767 SkErrorInternals::SetError( kInvalidPaint_SkError, |
760 "Sorry, I don't understand the filtering
" | 768 "Sorry, I don't understand the filtering
" |
761 "mode you asked for. Falling back to " | 769 "mode you asked for. Falling back to " |
762 "MIPMaps."); | 770 "MIPMaps."); |
763 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 771 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
764 break; | 772 break; |
765 | 773 |
766 } | 774 } |
767 return textureFilterMode; | 775 return textureFilterMode; |
768 } | 776 } |
OLD | NEW |