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

Side by Side Diff: src/core/SkScan_Antihair.cpp

Issue 1503423003: ubsan shift fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add cast to work around win compiler 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 | « src/core/SkScan_AntiPath.cpp ('k') | src/core/SkScan_Path.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 /* 2 /*
3 * Copyright 2011 The Android Open Source Project 3 * Copyright 2011 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkScan.h" 10 #include "SkScan.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 uint8_t a = (uint8_t)(fx >> 8); 243 uint8_t a = (uint8_t)(fx >> 8);
244 this->getBlitter()->blitAntiH2(x - 1, y, 255 - a, a); 244 this->getBlitter()->blitAntiH2(x - 1, y, 255 - a, a);
245 fx += dx; 245 fx += dx;
246 } while (++y < stopy); 246 } while (++y < stopy);
247 247
248 return fx - SK_Fixed1/2; 248 return fx - SK_Fixed1/2;
249 } 249 }
250 }; 250 };
251 251
252 static inline SkFixed fastfixdiv(SkFDot6 a, SkFDot6 b) { 252 static inline SkFixed fastfixdiv(SkFDot6 a, SkFDot6 b) {
253 SkASSERT((a << 16 >> 16) == a); 253 SkASSERT((SkLeftShift(a, 16) >> 16) == a);
254 SkASSERT(b != 0); 254 SkASSERT(b != 0);
255 return (a << 16) / b; 255 return SkLeftShift(a, 16) / b;
256 } 256 }
257 257
258 #define SkBITCOUNT(x) (sizeof(x) << 3) 258 #define SkBITCOUNT(x) (sizeof(x) << 3)
259 259
260 #if 1 260 #if 1
261 // returns high-bit set iff x==0x8000... 261 // returns high-bit set iff x==0x8000...
262 static inline int bad_int(int x) { 262 static inline int bad_int(int x) {
263 return x & -x; 263 return x & -x;
264 } 264 }
265 265
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 998
999 void SkScan::AntiFrameRect(const SkRect& r, const SkPoint& strokeSize, 999 void SkScan::AntiFrameRect(const SkRect& r, const SkPoint& strokeSize,
1000 const SkRasterClip& clip, SkBlitter* blitter) { 1000 const SkRasterClip& clip, SkBlitter* blitter) {
1001 if (clip.isBW()) { 1001 if (clip.isBW()) {
1002 AntiFrameRect(r, strokeSize, &clip.bwRgn(), blitter); 1002 AntiFrameRect(r, strokeSize, &clip.bwRgn(), blitter);
1003 } else { 1003 } else {
1004 SkAAClipBlitterWrapper wrap(clip, blitter); 1004 SkAAClipBlitterWrapper wrap(clip, blitter);
1005 AntiFrameRect(r, strokeSize, &wrap.getRgn(), wrap.getBlitter()); 1005 AntiFrameRect(r, strokeSize, &wrap.getRgn(), wrap.getBlitter());
1006 } 1006 }
1007 } 1007 }
OLDNEW
« no previous file with comments | « src/core/SkScan_AntiPath.cpp ('k') | src/core/SkScan_Path.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698