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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkMatrix.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 Google Inc. 2 * Copyright 2008 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 // The copyright below was added in 2009, but I see no record of moto contributi ons...? 8 // The copyright below was added in 2009, but I see no record of moto contributi ons...?
9 9
10 /* NEON optimized code (C) COPYRIGHT 2009 Motorola 10 /* NEON optimized code (C) COPYRIGHT 2009 Motorola
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // only clamp lives in the right coord space to check for decal 88 // only clamp lives in the right coord space to check for decal
89 ClampX_ClampY_nofilter_scale, 89 ClampX_ClampY_nofilter_scale,
90 ClampX_ClampY_filter_scale, 90 ClampX_ClampY_filter_scale,
91 ClampX_ClampY_nofilter_affine, 91 ClampX_ClampY_nofilter_affine,
92 ClampX_ClampY_filter_affine, 92 ClampX_ClampY_filter_affine,
93 NoFilterProc_Persp<ClampTileProcs>, 93 NoFilterProc_Persp<ClampTileProcs>,
94 ClampX_ClampY_filter_persp 94 ClampX_ClampY_filter_persp
95 }; 95 };
96 96
97 #define MAKENAME(suffix) RepeatX_RepeatY ## suffix 97 #define MAKENAME(suffix) RepeatX_RepeatY ## suffix
98 #define TILEX_PROCF(fx, max) SK_USHIFT16(((fx) & 0xFFFF) * ((max) + 1)) 98 #define TILEX_PROCF(fx, max) SK_USHIFT16((unsigned)((fx) & 0xFFFF) * ((max) + 1))
99 #define TILEY_PROCF(fy, max) SK_USHIFT16(((fy) & 0xFFFF) * ((max) + 1)) 99 #define TILEY_PROCF(fy, max) SK_USHIFT16((unsigned)((fy) & 0xFFFF) * ((max) + 1))
100 #define TILEX_LOW_BITS(fx, max) ((((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF) 100 #define TILEX_LOW_BITS(fx, max) (((unsigned)((fx) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
101 #define TILEY_LOW_BITS(fy, max) ((((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF) 101 #define TILEY_LOW_BITS(fy, max) (((unsigned)((fy) & 0xFFFF) * ((max) + 1) >> 12) & 0xF)
102 #include "SkBitmapProcState_matrix.h" 102 #include "SkBitmapProcState_matrix.h"
103 103
104 struct RepeatTileProcs { 104 struct RepeatTileProcs {
105 static unsigned X(const SkBitmapProcState&, SkFixed fx, int max) { 105 static unsigned X(const SkBitmapProcState&, SkFixed fx, int max) {
106 return SK_USHIFT16(((fx) & 0xFFFF) * ((max) + 1)); 106 SkASSERT(max < 65535);
107 return SK_USHIFT16((unsigned)((fx) & 0xFFFF) * ((max) + 1));
107 } 108 }
108 static unsigned Y(const SkBitmapProcState&, SkFixed fy, int max) { 109 static unsigned Y(const SkBitmapProcState&, SkFixed fy, int max) {
109 return SK_USHIFT16(((fy) & 0xFFFF) * ((max) + 1)); 110 SkASSERT(max < 65535);
111 return SK_USHIFT16((unsigned)((fy) & 0xFFFF) * ((max) + 1));
110 } 112 }
111 }; 113 };
112 114
113 static SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs[] = { 115 static SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs[] = {
114 NoFilterProc_Scale<RepeatTileProcs, false>, 116 NoFilterProc_Scale<RepeatTileProcs, false>,
115 RepeatX_RepeatY_filter_scale, 117 RepeatX_RepeatY_filter_scale,
116 NoFilterProc_Affine<RepeatTileProcs>, 118 NoFilterProc_Affine<RepeatTileProcs>,
117 RepeatX_RepeatY_filter_affine, 119 RepeatX_RepeatY_filter_affine,
118 NoFilterProc_Persp<RepeatTileProcs>, 120 NoFilterProc_Persp<RepeatTileProcs>,
119 RepeatX_RepeatY_filter_persp 121 RepeatX_RepeatY_filter_persp
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (SkShader::kRepeat_TileMode == fTileModeX && SkShader::kRepeat_TileMode = = fTileModeY) { 524 if (SkShader::kRepeat_TileMode == fTileModeX && SkShader::kRepeat_TileMode = = fTileModeY) {
523 return SK_ARM_NEON_WRAP(RepeatX_RepeatY_Procs)[index]; 525 return SK_ARM_NEON_WRAP(RepeatX_RepeatY_Procs)[index];
524 } 526 }
525 527
526 fTileProcX = choose_tile_proc(fTileModeX); 528 fTileProcX = choose_tile_proc(fTileModeX);
527 fTileProcY = choose_tile_proc(fTileModeY); 529 fTileProcY = choose_tile_proc(fTileModeY);
528 fTileLowBitsProcX = choose_tile_lowbits_proc(fTileModeX); 530 fTileLowBitsProcX = choose_tile_lowbits_proc(fTileModeX);
529 fTileLowBitsProcY = choose_tile_lowbits_proc(fTileModeY); 531 fTileLowBitsProcY = choose_tile_lowbits_proc(fTileModeY);
530 return GeneralXY_Procs[index]; 532 return GeneralXY_Procs[index];
531 } 533 }
OLDNEW
« 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