diff options
author | 2015-05-28 08:13:16 -0700 | |
---|---|---|
committer | 2015-05-28 08:13:16 -0700 | |
commit | 9138c46e572085870638b6f7ad7fcdfcdf3cac99 (patch) | |
tree | 81724ed66336cfc21c7139860914d70fb726e34c /src/gpu/SkGr.cpp | |
parent | 9c240a1e6d314056fe0d6a8a33a3c60a6e19288f (diff) |
Add direct getter for GrCaps to GrContext.
TBR=joshualitt@google.com
Review URL: https://codereview.chromium.org/1149773005
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r-- | src/gpu/SkGr.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index decb35848e..70c81f930a 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -7,6 +7,7 @@ #include "SkGr.h" +#include "GrCaps.h" #include "GrDrawContext.h" #include "GrXferProcessor.h" #include "SkColorFilter.h" @@ -96,7 +97,7 @@ enum Stretch { static Stretch get_stretch_type(const GrContext* ctx, int width, int height, const GrTextureParams* params) { if (params && params->isTiled()) { - if (!ctx->npotTextureTileSupport() && (!SkIsPow2(width) || !SkIsPow2(height))) { + if (!ctx->caps()->npotTextureTileSupport() && (!SkIsPow2(width) || !SkIsPow2(height))) { switch(params->filterMode()) { case GrTextureParams::kNone_FilterMode: return kNearest_Stretch; @@ -198,6 +199,7 @@ GrTexture* stretch_texture_to_next_pot(GrTexture* inputTexture, Stretch stretch, GrContext* context = inputTexture->getContext(); SkASSERT(context); + const GrCaps* caps = context->caps(); // Either it's a cache miss or the original wasn't cached to begin with. GrSurfaceDesc rtDesc = inputTexture->desc(); @@ -208,18 +210,18 @@ GrTexture* stretch_texture_to_next_pot(GrTexture* inputTexture, Stretch stretch, // If the config isn't renderable try converting to either A8 or an 32 bit config. Otherwise, // fail. - if (!context->isConfigRenderable(rtDesc.fConfig, false)) { + if (!caps->isConfigRenderable(rtDesc.fConfig, false)) { if (GrPixelConfigIsAlphaOnly(rtDesc.fConfig)) { - if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { + if (caps->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { rtDesc.fConfig = kAlpha_8_GrPixelConfig; - } else if (context->isConfigRenderable(kSkia8888_GrPixelConfig, false)) { + } else if (caps->isConfigRenderable(kSkia8888_GrPixelConfig, false)) { rtDesc.fConfig = kSkia8888_GrPixelConfig; } else { return NULL; } } else if (kRGB_GrColorComponentFlags == (kRGB_GrColorComponentFlags & GrPixelConfigComponentMask(rtDesc.fConfig))) { - if (context->isConfigRenderable(kSkia8888_GrPixelConfig, false)) { + if (caps->isConfigRenderable(kSkia8888_GrPixelConfig, false)) { rtDesc.fConfig = kSkia8888_GrPixelConfig; } else { return NULL; @@ -423,9 +425,10 @@ static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx, GrSurfaceDesc desc; generate_bitmap_texture_desc(*bitmap, &desc); + const GrCaps* caps = ctx->caps(); if (kIndex_8_SkColorType == bitmap->colorType()) { - if (ctx->isConfigTexturable(kIndex_8_GrPixelConfig)) { + if (caps->isConfigTexturable(kIndex_8_GrPixelConfig)) { size_t imageSize = GrCompressedFormatDataSize(kIndex_8_GrPixelConfig, bitmap->width(), bitmap->height()); SkAutoMalloc storage(imageSize); @@ -447,7 +450,7 @@ static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx, #ifndef SK_IGNORE_ETC1_SUPPORT // Make sure that the underlying device supports ETC1 textures before we go ahead // and check the data. - else if (ctx->isConfigTexturable(kETC1_GrPixelConfig) + else if (caps->isConfigTexturable(kETC1_GrPixelConfig) // If the bitmap had compressed data and was then uncompressed, it'll still return // compressed data on 'refEncodedData' and upload it. Probably not good, since if // the bitmap has available pixels, then they might not be what the decompressed |