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

Side by Side Diff: src/core/SkValidationUtils.h

Issue 308683005: setConfig -> setInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: missed one setConfig (release only) Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkScalerContext.cpp ('k') | src/effects/SkPerlinNoiseShader.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 2013 Google Inc. 2 * Copyright 2013 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 #ifndef SkValidationUtils_DEFINED 8 #ifndef SkValidationUtils_DEFINED
9 #define SkValidationUtils_DEFINED 9 #define SkValidationUtils_DEFINED
10 10
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkXfermode.h" 12 #include "SkXfermode.h"
13 13
14 /** Returns true if coeff's value is in the SkXfermode::Coeff enum. 14 /** Returns true if coeff's value is in the SkXfermode::Coeff enum.
15 */ 15 */
16 static inline bool SkIsValidCoeff(SkXfermode::Coeff coeff) { 16 static inline bool SkIsValidCoeff(SkXfermode::Coeff coeff) {
17 return coeff >= 0 && coeff < SkXfermode::kCoeffCount; 17 return coeff >= 0 && coeff < SkXfermode::kCoeffCount;
18 } 18 }
19 19
20 /** Returns true if mode's value is in the SkXfermode::Mode enum. 20 /** Returns true if mode's value is in the SkXfermode::Mode enum.
21 */ 21 */
22 static inline bool SkIsValidMode(SkXfermode::Mode mode) { 22 static inline bool SkIsValidMode(SkXfermode::Mode mode) {
23 return (mode >= 0) && (mode <= SkXfermode::kLastMode); 23 return (mode >= 0) && (mode <= SkXfermode::kLastMode);
24 } 24 }
25 25
26 /** Returns true if config's value is in the SkBitmap::Config enum.
27 */
28 static inline bool SkIsValidConfig(SkBitmap::Config config) {
29 return (config >= 0) && (config <= static_cast<int>(SkBitmap::kConfigCount)) ;
30 }
31
32 /** Returns true if the rect's dimensions are between 0 and SK_MaxS32 26 /** Returns true if the rect's dimensions are between 0 and SK_MaxS32
33 */ 27 */
34 static inline bool SkIsValidIRect(const SkIRect& rect) { 28 static inline bool SkIsValidIRect(const SkIRect& rect) {
35 return rect.width() >= 0 && rect.height() >= 0; 29 return rect.width() >= 0 && rect.height() >= 0;
36 } 30 }
37 31
38 /** Returns true if the rect's dimensions are between 0 and SK_ScalarMax 32 /** Returns true if the rect's dimensions are between 0 and SK_ScalarMax
39 */ 33 */
40 static inline bool SkIsValidRect(const SkRect& rect) { 34 static inline bool SkIsValidRect(const SkRect& rect) {
41 return (rect.fLeft <= rect.fRight) && 35 return (rect.fLeft <= rect.fRight) &&
42 (rect.fTop <= rect.fBottom) && 36 (rect.fTop <= rect.fBottom) &&
43 SkScalarIsFinite(rect.width()) && 37 SkScalarIsFinite(rect.width()) &&
44 SkScalarIsFinite(rect.height()); 38 SkScalarIsFinite(rect.height());
45 } 39 }
46 40
47 #endif 41 #endif
OLDNEW
« no previous file with comments | « src/core/SkScalerContext.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698