Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 26342006: Move renderable config list to GrDrawTargetCaps (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix size_t/int comparison Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawTargetCaps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index fa2223d4c464a6f0ad75a190d19431da567d92eb..fc3014e398935697ea43f05118cb9c5cfaa3b4b1 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]]);
+ }
+ }
}
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawTargetCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698