Fix WritePixels test on ANGLE.
Don't upload BGRA to RGBA if not supported (ES2 w/ EXT BGRA extension).
R=senorblanco@chromium.org
Review URL: https://codereview.appspot.com/7305046
git-svn-id: http://skia.googlecode.com/svn/trunk@7622 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index dc69766..3b5e9c4 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -531,8 +531,11 @@
* @param rowBytes number of bytes between consecutive rows. Zero means rows are tightly
* packed.
* @param pixelOpsFlags see PixelOpsFlags enum above.
+ *
+ * @return true if the write succeeded, false if not. The write can fail because of an
+ * unsupported combination of target and pixel configs.
*/
- void writeRenderTargetPixels(GrRenderTarget* target,
+ bool writeRenderTargetPixels(GrRenderTarget* target,
int left, int top, int width, int height,
GrPixelConfig config, const void* buffer,
size_t rowBytes = 0,
@@ -572,8 +575,10 @@
* @param rowBytes number of bytes between consecutive rows. Zero
* means rows are tightly packed.
* @param pixelOpsFlags see PixelOpsFlags enum above.
+ * @return true if the write succeeded, false if not. The write can fail because of an
+ * unsupported combination of texture and pixel configs.
*/
- void writeTexturePixels(GrTexture* texture,
+ bool writeTexturePixels(GrTexture* texture,
int left, int top, int width, int height,
GrPixelConfig config, const void* buffer,
size_t rowBytes,
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 9f1eb03..6b484de 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -310,30 +310,8 @@
// This alias is deprecated and will be removed.
static const GrPixelConfig kSkia8888_PM_GrPixelConfig = kSkia8888_GrPixelConfig;
-// Returns true if the pixel config has 8bit r,g,b,a components in that byte
-// order
-static inline bool GrPixelConfigIsRGBA8888(GrPixelConfig config) {
- switch (config) {
- case kRGBA_8888_GrPixelConfig:
- return true;
- default:
- return false;
- }
-}
-
-// Returns true if the pixel config has 8bit b,g,r,a components in that byte
-// order
-static inline bool GrPixelConfigIsBGRA8888(GrPixelConfig config) {
- switch (config) {
- case kBGRA_8888_GrPixelConfig:
- return true;
- default:
- return false;
- }
-}
-
// Returns true if the pixel config is 32 bits per pixel
-static inline bool GrPixelConfigIs32Bit(GrPixelConfig config) {
+static inline bool GrPixelConfigIs8888(GrPixelConfig config) {
switch (config) {
case kRGBA_8888_GrPixelConfig:
case kBGRA_8888_GrPixelConfig: