From 7388051d745590d7759e7ed49c233caec6bea0f7 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Mon, 14 Oct 2013 15:33:45 +0000 Subject: Move renderable config list to GrDrawTargetCaps R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/26342006 git-svn-id: http://skia.googlecode.com/svn/trunk@11756 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/GrDrawTarget.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/gpu/GrDrawTarget.cpp') diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index fa2223d4c4..fc3014e398 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -981,6 +981,8 @@ void GrDrawTargetCaps::reset() { fMaxRenderTargetSize = 0; fMaxTextureSize = 0; fMaxSampleCount = 0; + + memset(fConfigRenderSupport, 0, sizeof(fConfigRenderSupport)); } GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { @@ -1001,6 +1003,8 @@ GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { fMaxTextureSize = other.fMaxTextureSize; fMaxSampleCount = other.fMaxSampleCount; + memcpy(fConfigRenderSupport, other.fConfigRenderSupport, sizeof(fConfigRenderSupport)); + return *this; } @@ -1021,4 +1025,29 @@ void GrDrawTargetCaps::print() const { GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); + + static const char* kConfigNames[] = { + "Unknown", // kUnknown_GrPixelConfig + "Alpha8", // kAlpha_8_GrPixelConfig, + "Index8", // kIndex_8_GrPixelConfig, + "RGB565", // kRGB_565_GrPixelConfig, + "RGBA444", // kRGBA_4444_GrPixelConfig, + "RGBA8888", // kRGBA_8888_GrPixelConfig, + "BGRA8888", // kBGRA_8888_GrPixelConfig, + }; + GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig); + GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig); + GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig); + GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig); + GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig); + GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig); + GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); + GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt); + + SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig]); + for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { + if (i != kUnknown_GrPixelConfig) { + GrPrintf("%s is renderable: %s\n", kConfigNames[i], gNY[fConfigRenderSupport[i]]); + } + } } -- cgit v1.2.3