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

Side by Side Diff: include/core/SkColor.h

Issue 2093763003: Change SkColor4f to RGBA channel order (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reorder Pin arguments, too Created 4 years, 5 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 | « gm/color4f.cpp ('k') | src/core/SkColor.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 SkColor_DEFINED 8 #ifndef SkColor_DEFINED
9 #define SkColor_DEFINED 9 #define SkColor_DEFINED
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst); 159 typedef SkPMColor (*SkXfermodeProc)(SkPMColor src, SkPMColor dst);
160 160
161 //////////////////////////////////////////////////////////////////////////////// /////////////////// 161 //////////////////////////////////////////////////////////////////////////////// ///////////////////
162 162
163 struct SkPM4f; 163 struct SkPM4f;
164 164
165 /* 165 /*
166 * The float values are 0...1 unpremultiplied 166 * The float values are 0...1 unpremultiplied
167 */ 167 */
168 struct SkColor4f { 168 struct SkColor4f {
169 float fA;
170 float fR; 169 float fR;
171 float fG; 170 float fG;
172 float fB; 171 float fB;
172 float fA;
173 173
174 bool operator==(const SkColor4f& other) const { 174 bool operator==(const SkColor4f& other) const {
175 return fA == other.fA && fR == other.fR && fG == other.fG && fB == other .fB; 175 return fA == other.fA && fR == other.fR && fG == other.fG && fB == other .fB;
176 } 176 }
177 bool operator!=(const SkColor4f& other) const { 177 bool operator!=(const SkColor4f& other) const {
178 return !(*this == other); 178 return !(*this == other);
179 } 179 }
180 180
181 const float* vec() const { return &fA; } 181 const float* vec() const { return &fR; }
182 float* vec() { return &fA; } 182 float* vec() { return &fR; }
183 183
184 static SkColor4f Pin(float a, float r, float g, float b); 184 static SkColor4f Pin(float r, float g, float b, float a);
185 static SkColor4f FromColor(SkColor); 185 static SkColor4f FromColor(SkColor);
186 186
187 SkColor toSkColor() const;
188
187 SkColor4f pin() const { 189 SkColor4f pin() const {
188 return Pin(fA, fR, fG, fB); 190 return Pin(fR, fG, fB, fA);
189 } 191 }
190 192
191 SkPM4f premul() const; 193 SkPM4f premul() const;
192 }; 194 };
193 195
194 #endif 196 #endif
OLDNEW
« no previous file with comments | « gm/color4f.cpp ('k') | src/core/SkColor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698