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

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

Issue 1214443002: Color dodge and burn with SkPMFloat. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: reed Created 5 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
« no previous file with comments | « src/core/Sk4pxXfermode.h ('k') | src/opts/SkNx_neon.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
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkColor.h" 12 #include "SkColor.h"
13 #include "SkColorPriv.h" 13 #include "SkColorPriv.h"
14 #include "SkNx.h" 14 #include "SkNx.h"
15 15
16 // This file may be included multiple times by .cpp files with different flags, leading 16 // This file may be included multiple times by .cpp files with different flags, leading
17 // to different definitions. Usually that doesn't matter because it's all inlin ed, but 17 // to different definitions. Usually that doesn't matter because it's all inlin ed, but
18 // in Debug modes the compilers may not inline everything. So wrap everything i n an 18 // in Debug modes the compilers may not inline everything. So wrap everything i n an
19 // anonymous namespace to give each includer their own silo of this code (or the linker 19 // anonymous namespace to give each includer their own silo of this code (or the linker
20 // will probably pick one randomly for us, which is rarely correct). 20 // will probably pick one randomly for us, which is rarely correct).
21 namespace { 21 namespace {
22 22
23 // A pre-multiplied color storing each component in the same order as SkPMColor, 23 // A pre-multiplied color storing each component in the same order as SkPMColor,
24 // but as a float in the range [0, 1]. 24 // but as a float in the range [0, 1].
25 class SkPMFloat : public Sk4f { 25 class SkPMFloat : public Sk4f {
26 public: 26 public:
27 static SkPMFloat FromPMColor(SkPMColor c) { return SkPMFloat(c); } 27 static SkPMFloat FromPMColor(SkPMColor c) { return SkPMFloat(c); }
28 static SkPMFloat FromARGB(float a, float r, float g, float b) { return SkPMF loat(a,r,g,b); } 28 static SkPMFloat FromARGB(float a, float r, float g, float b) { return SkPMF loat(a,r,g,b); }
29 29
30 Sk4f alphas() const; // argb -> aaaa, generally faster than the equivalent Sk4f(this->a()).
31
30 // Uninitialized. 32 // Uninitialized.
31 SkPMFloat() {} 33 SkPMFloat() {}
32 explicit SkPMFloat(SkPMColor); 34 explicit SkPMFloat(SkPMColor);
33 SkPMFloat(float a, float r, float g, float b) 35 SkPMFloat(float a, float r, float g, float b)
34 #ifdef SK_PMCOLOR_IS_RGBA 36 #ifdef SK_PMCOLOR_IS_RGBA
35 : INHERITED(r,g,b,a) {} 37 : INHERITED(r,g,b,a) {}
36 #else 38 #else
37 : INHERITED(b,g,r,a) {} 39 : INHERITED(b,g,r,a) {}
38 #endif 40 #endif
39 41
(...skipping 26 matching lines...) Expand all
66 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 68 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
67 #include "../opts/SkPMFloat_sse.h" 69 #include "../opts/SkPMFloat_sse.h"
68 #elif defined(SK_ARM_HAS_NEON) 70 #elif defined(SK_ARM_HAS_NEON)
69 #include "../opts/SkPMFloat_neon.h" 71 #include "../opts/SkPMFloat_neon.h"
70 #else 72 #else
71 #include "../opts/SkPMFloat_none.h" 73 #include "../opts/SkPMFloat_none.h"
72 #endif 74 #endif
73 #endif 75 #endif
74 76
75 #endif//SkPM_DEFINED 77 #endif//SkPM_DEFINED
OLDNEW
« no previous file with comments | « src/core/Sk4pxXfermode.h ('k') | src/opts/SkNx_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698