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

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

Issue 1295873004: SkColorCubeFilter: require alpha == 0xFF. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: just perf Created 5 years, 4 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
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 static SkPMFloat FromBGRx(SkColor c); // Ignores c's alpha, instead forcing it to 1. 29 static SkPMFloat FromOpaqueColor(SkColor c); // Requires c's alpha == 0xFF.
30 30
31 Sk4f alphas() const; // argb -> aaaa, generally faster than the equivalent Sk4f(this->a()). 31 Sk4f alphas() const; // argb -> aaaa, generally faster than the equivalent Sk4f(this->a()).
32 32
33 // Uninitialized. 33 // Uninitialized.
34 SkPMFloat() {} 34 SkPMFloat() {}
35 explicit SkPMFloat(SkPMColor); 35 explicit SkPMFloat(SkPMColor);
36 SkPMFloat(float a, float r, float g, float b) 36 SkPMFloat(float a, float r, float g, float b)
37 #ifdef SK_PMCOLOR_IS_RGBA 37 #ifdef SK_PMCOLOR_IS_RGBA
38 : INHERITED(r,g,b,a) {} 38 : INHERITED(r,g,b,a) {}
39 #else 39 #else
(...skipping 29 matching lines...) Expand all
69 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 69 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
70 #include "../opts/SkPMFloat_sse.h" 70 #include "../opts/SkPMFloat_sse.h"
71 #elif defined(SK_ARM_HAS_NEON) 71 #elif defined(SK_ARM_HAS_NEON)
72 #include "../opts/SkPMFloat_neon.h" 72 #include "../opts/SkPMFloat_neon.h"
73 #else 73 #else
74 #include "../opts/SkPMFloat_none.h" 74 #include "../opts/SkPMFloat_none.h"
75 #endif 75 #endif
76 #endif 76 #endif
77 77
78 #endif//SkPM_DEFINED 78 #endif//SkPM_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698