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

Unified Diff: src/core/SkBitmapProcState_matrixProcs.cpp

Issue 1504933002: Fix up signed-integer-overflow warnings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reed@'s verbal review Created 5 years 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/core/SkMatrix.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcState_matrixProcs.cpp
diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp
index 1870a0e50e90f896a49c3d57102d426bd628612d..ee61ee8556c1dd7a398c7c316640f8b64924ec39 100644
--- a/src/core/SkBitmapProcState_matrixProcs.cpp
+++ b/src/core/SkBitmapProcState_matrixProcs.cpp
@@ -95,18 +95,20 @@ static SkBitmapProcState::MatrixProc ClampX_ClampY_Procs[] = {
};
#define MAKENAME(suffix) RepeatX_RepeatY ## suffix
-#define TILEX_PROCF(fx, max) SK_USHIFT16(((fx) & 0xFFFF) * ((max) + 1))
-#define TILEY_PROCF(fy, max) SK_USHIFT16(((fy) & 0xFFFF) * ((max) + 1))
-#define TILEX_LOW_BITS(fx, max) ((((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
-#define TILEY_LOW_BITS(fy, max) ((((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
+#define TILEX_PROCF(fx, max) SK_USHIFT16((unsigned)((fx) & 0xFFFF) * ((max) + 1))
+#define TILEY_PROCF(fy, max) SK_USHIFT16((unsigned)((fy) & 0xFFFF) * ((max) + 1))
+#define TILEX_LOW_BITS(fx, max) (((unsigned)((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
+#define TILEY_LOW_BITS(fy, max) (((unsigned)((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
#include "SkBitmapProcState_matrix.h"
struct RepeatTileProcs {
static unsigned X(const SkBitmapProcState&, SkFixed fx, int max) {
- return SK_USHIFT16(((fx) & 0xFFFF) * ((max) + 1));
+ SkASSERT(max < 65535);
+ return SK_USHIFT16((unsigned)((fx) & 0xFFFF) * ((max) + 1));
}
static unsigned Y(const SkBitmapProcState&, SkFixed fy, int max) {
- return SK_USHIFT16(((fy) & 0xFFFF) * ((max) + 1));
+ SkASSERT(max < 65535);
+ return SK_USHIFT16((unsigned)((fy) & 0xFFFF) * ((max) + 1));
}
};
« no previous file with comments | « no previous file | src/core/SkMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698