Index: include/gpu/GrTypes.h |
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h |
index 53e633da573207f77d632209683051323e1eb8bd..0d85652b55145ccd33bbd676419dd8f480ad16d1 100644 |
--- a/include/gpu/GrTypes.h |
+++ b/include/gpu/GrTypes.h |
@@ -641,6 +641,27 @@ enum GrGLBackendState { |
}; |
/** |
+ * Returns the data size for the given compressed pixel config |
+ */ |
+static inline size_t GrCompressedFormatDataSize(GrPixelConfig config, |
+ int width, int height) { |
+ SkASSERT(GrPixelConfigIsCompressed(config)); |
+ |
+ switch (config) { |
+ case kLATC_GrPixelConfig: |
+ case kETC1_GrPixelConfig: |
+ SkASSERT((width & 3) == 0); |
+ SkASSERT((height & 3) == 0); |
+ return (width >> 2) * (height >> 2) * 8; |
+ |
+ default: |
+ // Unknown pixel config... |
robertphillips
2014/05/30 15:00:22
SkFAIL here?
krajcevski
2014/05/30 16:21:50
Done.
|
+ SkASSERT(false); |
+ return 4 * width * height; |
+ } |
+} |
+ |
+/** |
* This value translates to reseting all the context state for any backend. |
*/ |
static const uint32_t kAll_GrBackendState = 0xffffffff; |