Fix some linux build warnings
Review URL: https://codereview.appspot.com/6571050
git-svn-id: http://skia.googlecode.com/svn/trunk@5675 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index f35e729..7eb3422 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1388,10 +1388,13 @@
}
// Perform any conversions we weren't able to perfom using a scratch texture.
if (unpremul || swapRAndB || flipY) {
- SkCanvas::Config8888 srcC8888;
- SkCanvas::Config8888 dstC8888;
+ // These are initialized to suppress a warning
+ SkCanvas::Config8888 srcC8888 = SkCanvas::kNative_Premul_Config8888;
+ SkCanvas::Config8888 dstC8888 = SkCanvas::kNative_Premul_Config8888;
+
bool c8888IsValid = grconfig_to_config8888(config, false, &srcC8888);
grconfig_to_config8888(config, unpremul, &dstC8888);
+
if (swapRAndB) {
GrAssert(c8888IsValid); // we should only do r/b swap on 8888 configs
srcC8888 = swap_config8888_red_and_blue(srcC8888);
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index bcda7d8..4858041 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -300,6 +300,7 @@
return kRGBA_8888_GrPixelConfig;
default:
GrCrash("Unexpected Config8888.");
+ *flags = 0; // suppress warning
return kSkia8888_PM_GrPixelConfig;
}
}
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 755841e..80ced21 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -93,6 +93,9 @@
g = static_cast<U8CPU>(c[1]);
b = static_cast<U8CPU>(c[2]);
break;
+ default:
+ SkDEBUGFAIL("Unexpected Config8888");
+ return 0;
}
if (*premul) {
r = SkMulDiv255Ceiling(r, a);
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 9c3a5fb..e482fd5 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -190,7 +190,7 @@
break;
default:
SkDEBUGFAIL("Unexpected Config8888");
- break;
+ return 0;
}
if (*premul) {
r = SkMulDiv255Ceiling(r, a);