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

Side by Side Diff: src/pathops/SkOpAngle.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/images/SkImageDecoder_libico.cpp ('k') | src/ports/SkFontMgr_android_parser.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 #include "SkOpAngle.h" 7 #include "SkOpAngle.h"
8 #include "SkOpSegment.h" 8 #include "SkOpSegment.h"
9 #include "SkPathOpsCurve.h" 9 #include "SkPathOpsCurve.h"
10 #include "SkTSort.h" 10 #include "SkTSort.h"
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 } 1009 }
1010 if ((fSectorEnd & 3) == 3) { 1010 if ((fSectorEnd & 3) == 3) {
1011 fSectorEnd = (fSectorEnd + (curveBendsCCW ? 31 : 1)) & 0x1f; 1011 fSectorEnd = (fSectorEnd + (curveBendsCCW ? 31 : 1)) & 0x1f;
1012 } 1012 }
1013 crossesZero = this->checkCrossesZero(); 1013 crossesZero = this->checkCrossesZero();
1014 start = SkTMin(fSectorStart, fSectorEnd); 1014 start = SkTMin(fSectorStart, fSectorEnd);
1015 int end = SkTMax(fSectorStart, fSectorEnd); 1015 int end = SkTMax(fSectorStart, fSectorEnd);
1016 if (!crossesZero) { 1016 if (!crossesZero) {
1017 fSectorMask = (unsigned) -1 >> (31 - end + start) << start; 1017 fSectorMask = (unsigned) -1 >> (31 - end + start) << start;
1018 } else { 1018 } else {
1019 fSectorMask = (unsigned) -1 >> (31 - start) | (-1 << end); 1019 fSectorMask = (unsigned) -1 >> (31 - start) | ((unsigned) -1 << end);
1020 } 1020 }
1021 } 1021 }
1022 1022
1023 SkOpSpan* SkOpAngle::starter() { 1023 SkOpSpan* SkOpAngle::starter() {
1024 return fStart->starter(fEnd); 1024 return fStart->starter(fEnd);
1025 } 1025 }
1026 1026
1027 bool SkOpAngle::tangentsDiverge(const SkOpAngle* rh, double s0xt0) const { 1027 bool SkOpAngle::tangentsDiverge(const SkOpAngle* rh, double s0xt0) const {
1028 if (s0xt0 == 0) { 1028 if (s0xt0 == 0) {
1029 return false; 1029 return false;
(...skipping 14 matching lines...) Expand all
1044 return true; 1044 return true;
1045 } 1045 }
1046 SkASSERT(s0dt0 != 0); 1046 SkASSERT(s0dt0 != 0);
1047 double m = s0xt0 / s0dt0; 1047 double m = s0xt0 / s0dt0;
1048 double sDist = sweep[0].length() * m; 1048 double sDist = sweep[0].length() * m;
1049 double tDist = tweep[0].length() * m; 1049 double tDist = tweep[0].length() * m;
1050 bool useS = fabs(sDist) < fabs(tDist); 1050 bool useS = fabs(sDist) < fabs(tDist);
1051 double mFactor = fabs(useS ? this->distEndRatio(sDist) : rh->distEndRatio(tD ist)); 1051 double mFactor = fabs(useS ? this->distEndRatio(sDist) : rh->distEndRatio(tD ist));
1052 return mFactor < 2400; // empirically found limit 1052 return mFactor < 2400; // empirically found limit
1053 } 1053 }
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libico.cpp ('k') | src/ports/SkFontMgr_android_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698