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

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

Issue 1154523004: Everyone gets a namespace {}. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/SkNx.h ('k') | src/opts/Sk4px_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
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
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).
21 namespace {
22
16 // 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,
17 // but as a float in the range [0, 255]. 24 // but as a float in the range [0, 255].
18 class SkPMFloat : public Sk4f { 25 class SkPMFloat : public Sk4f {
19 public: 26 public:
20 static SkPMFloat FromPMColor(SkPMColor c) { return SkPMFloat(c); } 27 static SkPMFloat FromPMColor(SkPMColor c) { return SkPMFloat(c); }
21 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); }
22 29
23 // May be more efficient than one at a time. No special alignment assumed f or SkPMColors. 30 // May be more efficient than one at a time. No special alignment assumed f or SkPMColors.
24 static void From4PMColors(const SkPMColor[4], SkPMFloat*, SkPMFloat*, SkPMFl oat*, SkPMFloat*); 31 static void From4PMColors(const SkPMColor[4], SkPMFloat*, SkPMFloat*, SkPMFl oat*, SkPMFloat*);
25 32
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return this->a() >= 0 && this->a() <= 255 67 return this->a() >= 0 && this->a() <= 255
61 && this->r() >= 0 && this->r() <= this->a() 68 && this->r() >= 0 && this->r() <= this->a()
62 && this->g() >= 0 && this->g() <= this->a() 69 && this->g() >= 0 && this->g() <= this->a()
63 && this->b() >= 0 && this->b() <= this->a(); 70 && this->b() >= 0 && this->b() <= this->a();
64 } 71 }
65 72
66 private: 73 private:
67 typedef Sk4f INHERITED; 74 typedef Sk4f INHERITED;
68 }; 75 };
69 76
77 } // namespace
78
70 #ifdef SKNX_NO_SIMD 79 #ifdef SKNX_NO_SIMD
71 // Platform implementations of SkPMFloat assume Sk4f uses SSE or NEON. _non e is generic. 80 // Platform implementations of SkPMFloat assume Sk4f uses SSE or NEON. _non e is generic.
72 #include "../opts/SkPMFloat_none.h" 81 #include "../opts/SkPMFloat_none.h"
73 #else 82 #else
74 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3 83 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3
75 #include "../opts/SkPMFloat_SSSE3.h" 84 #include "../opts/SkPMFloat_SSSE3.h"
76 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 85 #elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
77 #include "../opts/SkPMFloat_SSE2.h" 86 #include "../opts/SkPMFloat_SSE2.h"
78 #elif defined(SK_ARM_HAS_NEON) 87 #elif defined(SK_ARM_HAS_NEON)
79 #include "../opts/SkPMFloat_neon.h" 88 #include "../opts/SkPMFloat_neon.h"
80 #else 89 #else
81 #include "../opts/SkPMFloat_none.h" 90 #include "../opts/SkPMFloat_none.h"
82 #endif 91 #endif
83 #endif 92 #endif
84 93
85 #endif//SkPM_DEFINED 94 #endif//SkPM_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkNx.h ('k') | src/opts/Sk4px_NEON.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698