summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-18 01:40:47 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-18 01:40:47 +0000
commit481c3e82e2dcbcb676501f18bc8f58900071b935 (patch)
treeb41b70589f0b082edffa7322b1c06af23c4b32bc /skia
parentcf85b9ad701b8363e3d1d54d54390dcdf4a45291 (diff)
downloadchromium_src-481c3e82e2dcbcb676501f18bc8f58900071b935.zip
chromium_src-481c3e82e2dcbcb676501f18bc8f58900071b935.tar.gz
chromium_src-481c3e82e2dcbcb676501f18bc8f58900071b935.tar.bz2
Fixes for re-enabling more MSVC level 4 warnings: misc edition #2
This contains fixes for the following sorts of issues: * Assignment inside conditional * Taking the address of a temporary * Octal escape sequence terminated by decimal number * Signedness mismatch * Possibly-uninitialized local variable This also contains a small number of cleanups to nearby code (e.g. no else after return). BUG=81439 TEST=none Review URL: https://codereview.chromium.org/382673002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/pixel_ref_utils_unittest.cc10
-rw-r--r--skia/ext/platform_canvas_unittest.cc23
2 files changed, 11 insertions, 22 deletions
diff --git a/skia/ext/pixel_ref_utils_unittest.cc b/skia/ext/pixel_ref_utils_unittest.cc
index bddbe65..65e1883 100644
--- a/skia/ext/pixel_ref_utils_unittest.cc
+++ b/skia/ext/pixel_ref_utils_unittest.cc
@@ -31,15 +31,7 @@ class TestDiscardableShader : public SkShader {
CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_);
}
- TestDiscardableShader(SkFlattenableReadBuffer& flattenable_buffer) {
- SkOrderedReadBuffer& buffer =
- static_cast<SkOrderedReadBuffer&>(flattenable_buffer);
- SkReader32* reader = buffer.getReader32();
-
- reader->skip(-4);
- uint32_t toSkip = reader->readU32();
- reader->skip(toSkip);
-
+ TestDiscardableShader(SkReadBuffer& buffer) : SkShader(buffer) {
CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_);
}
diff --git a/skia/ext/platform_canvas_unittest.cc b/skia/ext/platform_canvas_unittest.cc
index 2089755..3d8ef00 100644
--- a/skia/ext/platform_canvas_unittest.cc
+++ b/skia/ext/platform_canvas_unittest.cc
@@ -20,12 +20,20 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "third_party/skia/include/core/SkColorPriv.h"
#include "third_party/skia/include/core/SkPixelRef.h"
namespace skia {
namespace {
+bool IsOfColor(const SkBitmap& bitmap, int x, int y, uint32_t color) {
+ // For masking out the alpha values.
+ static uint32_t alpha_mask =
+ static_cast<uint32_t>(SK_A32_MASK) << SK_A32_SHIFT;
+ return (*bitmap.getAddr32(x, y) | alpha_mask) == (color | alpha_mask);
+}
+
// Return true if the canvas is filled to canvas_color, and contains a single
// rectangle filled to rect_color. This function ignores the alpha channel,
// since Windows will sometimes clear the alpha channel when drawing, and we
@@ -37,21 +45,16 @@ bool VerifyRect(const PlatformCanvas& canvas,
const SkBitmap& bitmap = device->accessBitmap(false);
SkAutoLockPixels lock(bitmap);
- // For masking out the alpha values.
- uint32_t alpha_mask = 0xFF << SK_A32_SHIFT;
-
for (int cur_y = 0; cur_y < bitmap.height(); cur_y++) {
for (int cur_x = 0; cur_x < bitmap.width(); cur_x++) {
if (cur_x >= x && cur_x < x + w &&
cur_y >= y && cur_y < y + h) {
// Inside the square should be rect_color
- if ((*bitmap.getAddr32(cur_x, cur_y) | alpha_mask) !=
- (rect_color | alpha_mask))
+ if (!IsOfColor(bitmap, cur_x, cur_y, rect_color))
return false;
} else {
// Outside the square should be canvas_color
- if ((*bitmap.getAddr32(cur_x, cur_y) | alpha_mask) !=
- (canvas_color | alpha_mask))
+ if (!IsOfColor(bitmap, cur_x, cur_y, canvas_color))
return false;
}
}
@@ -60,12 +63,6 @@ bool VerifyRect(const PlatformCanvas& canvas,
}
#if !defined(OS_MACOSX)
-bool IsOfColor(const SkBitmap& bitmap, int x, int y, uint32_t color) {
- // For masking out the alpha values.
- static uint32_t alpha_mask = 0xFF << SK_A32_SHIFT;
- return (*bitmap.getAddr32(x, y) | alpha_mask) == (color | alpha_mask);
-}
-
// Return true if canvas has something that passes for a rounded-corner
// rectangle. Basically, we're just checking to make sure that the pixels in the
// middle are of rect_color and pixels in the corners are of canvas_color.