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

Side by Side Diff: include/gpu/GrColor.h

Issue 435743002: Always use both a color and coverage attribute in GrAARectRenderer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix unsigned/signed issue Created 6 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
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | src/gpu/GrAARectRenderer.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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 /** Converts a GrColor to an rgba array of GrGLfloat */ 82 /** Converts a GrColor to an rgba array of GrGLfloat */
83 static inline void GrColorToRGBAFloat(GrColor color, float rgba[4]) { 83 static inline void GrColorToRGBAFloat(GrColor color, float rgba[4]) {
84 static const float ONE_OVER_255 = 1.f / 255.f; 84 static const float ONE_OVER_255 = 1.f / 255.f;
85 rgba[0] = GrColorUnpackR(color) * ONE_OVER_255; 85 rgba[0] = GrColorUnpackR(color) * ONE_OVER_255;
86 rgba[1] = GrColorUnpackG(color) * ONE_OVER_255; 86 rgba[1] = GrColorUnpackG(color) * ONE_OVER_255;
87 rgba[2] = GrColorUnpackB(color) * ONE_OVER_255; 87 rgba[2] = GrColorUnpackB(color) * ONE_OVER_255;
88 rgba[3] = GrColorUnpackA(color) * ONE_OVER_255; 88 rgba[3] = GrColorUnpackA(color) * ONE_OVER_255;
89 } 89 }
90 90
91 /** Determines whether the color is opaque or not. */
92 static inline bool GrColorIsOpaque(GrColor color) {
93 return (color & (0xFFU << GrColor_SHIFT_A)) == (0xFFU << GrColor_SHIFT_A);
94 }
95
91 /** 96 /**
92 * Flags used for bitfields of color components. They are defined so that the bi t order reflects the 97 * Flags used for bitfields of color components. They are defined so that the bi t order reflects the
93 * GrColor shift order. 98 * GrColor shift order.
94 */ 99 */
95 enum GrColorComponentFlags { 100 enum GrColorComponentFlags {
96 kR_GrColorComponentFlag = 1 << (GrColor_SHIFT_R / 8), 101 kR_GrColorComponentFlag = 1 << (GrColor_SHIFT_R / 8),
97 kG_GrColorComponentFlag = 1 << (GrColor_SHIFT_G / 8), 102 kG_GrColorComponentFlag = 1 << (GrColor_SHIFT_G / 8),
98 kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8), 103 kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8),
99 kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8), 104 kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8),
100 105
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); 154 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig);
150 GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig); 155 GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig);
151 GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig); 156 GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig);
152 GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig); 157 GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig);
153 GR_STATIC_ASSERT(10 == kASTC_12x12_GrPixelConfig); 158 GR_STATIC_ASSERT(10 == kASTC_12x12_GrPixelConfig);
154 GR_STATIC_ASSERT(11 == kRGBA_float_GrPixelConfig); 159 GR_STATIC_ASSERT(11 == kRGBA_float_GrPixelConfig);
155 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); 160 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
156 } 161 }
157 162
158 #endif 163 #endif
OLDNEW
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | src/gpu/GrAARectRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698