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

Unified Diff: include/gpu/GrTypes.h

Issue 457333004: Consider index8 a compressed config. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 years, 4 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 | « no previous file | src/gpu/GrTexture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTypes.h
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 280bf4d40a290f95187de5108d21ba412216ac82..41cc7eab79171c422ab84de8ad0233a8d8bf324e 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -324,6 +324,7 @@ static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
// representation.
static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
switch (config) {
+ case kIndex_8_GrPixelConfig:
case kETC1_GrPixelConfig:
case kLATC_GrPixelConfig:
case kR11_EAC_GrPixelConfig:
@@ -359,9 +360,9 @@ static inline GrPixelConfig GrPixelConfigSwapRAndB(GrPixelConfig config) {
}
static inline size_t GrBytesPerPixel(GrPixelConfig config) {
+ SkASSERT(!GrPixelConfigIsCompressed(config));
switch (config) {
case kAlpha_8_GrPixelConfig:
- case kIndex_8_GrPixelConfig:
return 1;
case kRGB_565_GrPixelConfig:
case kRGBA_4444_GrPixelConfig:
@@ -377,9 +378,9 @@ static inline size_t GrBytesPerPixel(GrPixelConfig config) {
}
static inline size_t GrUnpackAlignment(GrPixelConfig config) {
+ SkASSERT(!GrPixelConfigIsCompressed(config));
switch (config) {
case kAlpha_8_GrPixelConfig:
- case kIndex_8_GrPixelConfig:
return 1;
case kRGB_565_GrPixelConfig:
case kRGBA_4444_GrPixelConfig:
@@ -448,13 +449,6 @@ enum GrTextureFlags {
GR_MAKE_BITFIELD_OPS(GrTextureFlags)
-enum {
- /**
- * For Index8 pixel config, the colortable must be 256 entries
- */
- kGrColorTableSize = 256 * 4 //sizeof(GrColor)
-};
-
/**
* Some textures will be stored such that the upper and left edges of the content meet at the
* the origin (in texture coord space) and for other textures the lower and left edges meet at
@@ -684,8 +678,11 @@ enum GrGLBackendState {
static inline size_t GrCompressedFormatDataSize(GrPixelConfig config,
int width, int height) {
SkASSERT(GrPixelConfigIsCompressed(config));
+ static const int kGrIndex8TableSize = 256 * 4; // 4 == sizeof(GrColor)
switch (config) {
+ case kIndex_8_GrPixelConfig:
+ return width * height + kGrIndex8TableSize;
case kR11_EAC_GrPixelConfig:
case kLATC_GrPixelConfig:
case kETC1_GrPixelConfig:
« no previous file with comments | « no previous file | src/gpu/GrTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698