aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawTarget.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-14 15:33:45 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-14 15:33:45 +0000
commit7388051d745590d7759e7ed49c233caec6bea0f7 (patch)
tree67bd975976b29d4221902e771586fa8f587b2924 /src/gpu/GrDrawTarget.cpp
parent2887119a63e314704673b971e9bc9a3461313a2c (diff)
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
Diffstat (limited to 'src/gpu/GrDrawTarget.cpp')
-rw-r--r--src/gpu/GrDrawTarget.cpp29
1 files changed, 29 insertions, 0 deletions
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]]);
+ }
+ }
}