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

Side by Side Diff: include/core/SkTypes.h

Issue 729373004: Watch out for SkFixed overflow in SkMipMap.cpp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nan Created 6 years, 1 month 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/SkMipMap.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 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 #ifndef SkTypes_DEFINED 8 #ifndef SkTypes_DEFINED
9 #define SkTypes_DEFINED 9 #define SkTypes_DEFINED
10 10
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 /** Generic swap function. Classes with efficient swaps should specialize this f unction to take 346 /** Generic swap function. Classes with efficient swaps should specialize this f unction to take
347 their fast path. This function is used by SkTSort. */ 347 their fast path. This function is used by SkTSort. */
348 template <typename T> inline void SkTSwap(T& a, T& b) { 348 template <typename T> inline void SkTSwap(T& a, T& b) {
349 T c(a); 349 T c(a);
350 a = b; 350 a = b;
351 b = c; 351 b = c;
352 } 352 }
353 353
354 static inline int32_t SkAbs32(int32_t value) { 354 static inline int32_t SkAbs32(int32_t value) {
355 SkASSERT(value != SK_NaN32); // The most negative int32_t can't be negated.
355 if (value < 0) { 356 if (value < 0) {
356 value = -value; 357 value = -value;
357 } 358 }
358 return value; 359 return value;
359 } 360 }
360 361
361 template <typename T> inline T SkTAbs(T value) { 362 template <typename T> inline T SkTAbs(T value) {
362 if (value < 0) { 363 if (value < 0) {
363 value = -value; 364 value = -value;
364 } 365 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 private: 669 private:
669 void* fPtr; 670 void* fPtr;
670 size_t fSize; // can be larger than the requested size (see kReuse) 671 size_t fSize; // can be larger than the requested size (see kReuse)
671 uint32_t fStorage[(kSize + 3) >> 2]; 672 uint32_t fStorage[(kSize + 3) >> 2];
672 }; 673 };
673 // Can't guard the constructor because it's a template class. 674 // Can't guard the constructor because it's a template class.
674 675
675 #endif /* C++ */ 676 #endif /* C++ */
676 677
677 #endif 678 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkMipMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698