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

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

Issue 1055093002: SkPMFloat: fewer internal this->isValid() assertions. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: doc Created 5 years, 8 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
« no previous file with comments | « no previous file | src/opts/SkPMFloat_SSE2.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 2015 Google Inc. 2 * Copyright 2015 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 SkPM_DEFINED 8 #ifndef SkPM_DEFINED
9 #define SkPM_DEFINED 9 #define SkPM_DEFINED
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 // Freely autoconvert between SkPMFloat and Sk4f. 37 // Freely autoconvert between SkPMFloat and Sk4f.
38 /*implicit*/ SkPMFloat(const Sk4f& fs) { fColors = fs; } 38 /*implicit*/ SkPMFloat(const Sk4f& fs) { fColors = fs; }
39 /*implicit*/ operator Sk4f() const { return fColors; } 39 /*implicit*/ operator Sk4f() const { return fColors; }
40 40
41 float a() const { return fColors[SK_A32_SHIFT / 8]; } 41 float a() const { return fColors[SK_A32_SHIFT / 8]; }
42 float r() const { return fColors[SK_R32_SHIFT / 8]; } 42 float r() const { return fColors[SK_R32_SHIFT / 8]; }
43 float g() const { return fColors[SK_G32_SHIFT / 8]; } 43 float g() const { return fColors[SK_G32_SHIFT / 8]; }
44 float b() const { return fColors[SK_B32_SHIFT / 8]; } 44 float b() const { return fColors[SK_B32_SHIFT / 8]; }
45 45
46 // N.B. All methods returning an SkPMColor call SkPMColorAssert on that resu lt before returning.
47
46 // get() and clamped() round component values to the nearest integer. 48 // get() and clamped() round component values to the nearest integer.
47 SkPMColor get() const; // May SkASSERT(this->isValid()). Some implemen tations may clamp. 49 SkPMColor get() const; // Assumes all values in [0, 255]. Some impleme ntations may clamp.
48 SkPMColor clamped() const; // Will clamp all values to [0, 255]. Then may assert isValid(). 50 SkPMColor clamped() const; // Will clamp all values to [0, 255].
49 51
50 // Like get(), but truncates instead of rounding. 52 // Like get(), but truncates instead of rounding.
51 // The domain of this function is (-1.0f, 256.0f). Values in (-1.0f, 0.0f] trunc to a zero. 53 // The domain of this function is (-1.0f, 256.0f). Values in (-1.0f, 0.0f] trunc to a zero.
52 SkPMColor trunc() const; 54 SkPMColor trunc() const;
53 55
54 // 4-at-a-time versions of get() and clamped(). Like From4PMColors(), no al ignment assumed. 56 // 4-at-a-time versions of get() and clamped(). Like From4PMColors(), no al ignment assumed.
55 static void To4PMColors( 57 static void To4PMColors(
56 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa t&, SkPMColor[4]); 58 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa t&, SkPMColor[4]);
57 static void ClampTo4PMColors( 59 static void ClampTo4PMColors(
58 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa t&, SkPMColor[4]); 60 const SkPMFloat&, const SkPMFloat&, const SkPMFloat&, const SkPMFloa t&, SkPMColor[4]);
(...skipping 18 matching lines...) Expand all
77 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 79 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
78 #include "../opts/SkPMFloat_SSE2.h" 80 #include "../opts/SkPMFloat_SSE2.h"
79 #elif defined(SK_ARM_HAS_NEON) 81 #elif defined(SK_ARM_HAS_NEON)
80 #include "../opts/SkPMFloat_neon.h" 82 #include "../opts/SkPMFloat_neon.h"
81 #else 83 #else
82 #include "../opts/SkPMFloat_none.h" 84 #include "../opts/SkPMFloat_none.h"
83 #endif 85 #endif
84 #endif 86 #endif
85 87
86 #endif//SkPM_DEFINED 88 #endif//SkPM_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/opts/SkPMFloat_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698