Chromium Code Reviews| Index: src/gpu/GrDrawTarget.cpp |
| diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
| index fa2223d4c464a6f0ad75a190d19431da567d92eb..8ce7dc68956e80958fdf2db359e3938971c06ca2 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, |
| + "Index 8", // 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]); |
|
robertphillips
2013/10/14 14:43:51
Very minor nit: why not start at 1 and skip the if
bsalomon
2013/10/14 14:48:31
I was just thinking that all of the peering into t
robertphillips
2013/10/16 12:12:36
Fair enough
|
| + for (int i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
| + if (i != kUnknown_GrPixelConfig) { |
| + GrPrintf("%s is renderable: %s\n", kConfigNames[i], gNY[fConfigRenderSupport[i]]); |
| + } |
| + } |
| } |