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

Side by Side Diff: src/core/SkMatrix.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 | « src/core/SkBitmapProcState_matrixProcs.cpp ('k') | no next file » | 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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #include "SkMatrix.h" 8 #include "SkMatrix.h"
9 #include "SkFloatBits.h" 9 #include "SkFloatBits.h"
10 #include "SkRSXform.h" 10 #include "SkRSXform.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 m01 = m01 != 0; 149 m01 = m01 != 0;
150 m10 = m10 != 0; 150 m10 = m10 != 0;
151 151
152 int dp0 = 0 == (m00 | m11) ; // true if both are 0 152 int dp0 = 0 == (m00 | m11) ; // true if both are 0
153 int ds1 = m01 & m10; // true if both are 1 153 int ds1 = m01 & m10; // true if both are 1
154 154
155 mask |= (dp0 & ds1) << kRectStaysRect_Shift; 155 mask |= (dp0 & ds1) << kRectStaysRect_Shift;
156 } else { 156 } else {
157 // Only test for scale explicitly if not affine, since affine sets the 157 // Only test for scale explicitly if not affine, since affine sets the
158 // scale bit. 158 // scale bit.
159 if ((m00 - kScalar1Int) | (m11 - kScalar1Int)) { 159 if ((m00 ^ kScalar1Int) | (m11 ^ kScalar1Int)) {
160 mask |= kScale_Mask; 160 mask |= kScale_Mask;
161 } 161 }
162 162
163 // Not affine, therefore we already know secondary diagonal is 163 // Not affine, therefore we already know secondary diagonal is
164 // all zeros, so we just need to check that primary diagonal is 164 // all zeros, so we just need to check that primary diagonal is
165 // all non-zero. 165 // all non-zero.
166 166
167 // map non-zero to 1 167 // map non-zero to 1
168 m00 = m00 != 0; 168 m00 = m00 != 0;
169 m11 = m11 != 0; 169 m11 = m11 != 0;
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 const SkScalar m11 = m00; 1773 const SkScalar m11 = m00;
1774 const SkScalar m12 = fTy; 1774 const SkScalar m12 = fTy;
1775 1775
1776 quad[0].set(m02, m12); 1776 quad[0].set(m02, m12);
1777 quad[1].set(m00 * width + m02, m10 * width + m12); 1777 quad[1].set(m00 * width + m02, m10 * width + m12);
1778 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m 12); 1778 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m 12);
1779 quad[3].set(m01 * height + m02, m11 * height + m12); 1779 quad[3].set(m01 * height + m02, m11 * height + m12);
1780 #endif 1780 #endif
1781 } 1781 }
1782 1782
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState_matrixProcs.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698