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/SkBitmapProcState_sample.h

Issue 1556003003: remove shadeSpan16 from shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup unused macro-generated procs Created 4 years, 11 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/SkBitmapProcState_procs.h ('k') | src/core/SkBitmapProcState_shaderproc.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 2011 Google Inc. 2 * Copyright 2011 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 #include "SkUtils.h" 8 #include "SkUtils.h"
9 9
10 #if DSTSIZE==32
11 #define DSTTYPE SkPMColor
12 #elif DSTSIZE==16
13 #define DSTTYPE uint16_t
14 #else
15 #error "need DSTSIZE to be 32 or 16"
16 #endif
17
18 #if (DSTSIZE == 32)
19 #define BITMAPPROC_MEMSET(ptr, value, n) sk_memset32(ptr, value, n)
20 #elif (DSTSIZE == 16)
21 #define BITMAPPROC_MEMSET(ptr, value, n) sk_memset16(ptr, value, n)
22 #else
23 #error "unsupported DSTSIZE"
24 #endif
25
26
27 // declare functions externally to suppress warnings. 10 // declare functions externally to suppress warnings.
28 void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s, 11 void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
29 const uint32_t* SK_RESTRICT xy, 12 const uint32_t* SK_RESTRICT xy,
30 int count, DSTTYPE* SK_RESTRICT colors); 13 int count, SkPMColor* SK_RESTRICT colors);
31 void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s, 14 void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s,
32 const uint32_t* SK_RESTRICT xy, 15 const uint32_t* SK_RESTRICT xy,
33 int count, DSTTYPE* SK_RESTRICT colors); 16 int count, SkPMColor* SK_RESTRICT colors);
34 void MAKENAME(_filter_DX)(const SkBitmapProcState& s, 17 void MAKENAME(_filter_DX)(const SkBitmapProcState& s,
35 const uint32_t* SK_RESTRICT xy, 18 const uint32_t* SK_RESTRICT xy,
36 int count, DSTTYPE* SK_RESTRICT colors); 19 int count, SkPMColor* SK_RESTRICT colors);
37 void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s, 20 void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s,
38 const uint32_t* SK_RESTRICT xy, 21 const uint32_t* SK_RESTRICT xy,
39 int count, DSTTYPE* SK_RESTRICT colors); 22 int count, SkPMColor* SK_RESTRICT colors);
40 23
41 void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s, 24 void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
42 const uint32_t* SK_RESTRICT xy, 25 const uint32_t* SK_RESTRICT xy,
43 int count, DSTTYPE* SK_RESTRICT colors) { 26 int count, SkPMColor* SK_RESTRICT colors) {
44 SkASSERT(count > 0 && colors != nullptr); 27 SkASSERT(count > 0 && colors != nullptr);
45 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); 28 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
46 SkDEBUGCODE(CHECKSTATE(s);) 29 SkDEBUGCODE(CHECKSTATE(s);)
47 30
48 #ifdef PREAMBLE 31 #ifdef PREAMBLE
49 PREAMBLE(s); 32 PREAMBLE(s);
50 #endif 33 #endif
51 const char* SK_RESTRICT srcAddr = (const char*)s.fPixmap.addr(); 34 const char* SK_RESTRICT srcAddr = (const char*)s.fPixmap.addr();
52 size_t rb = s.fPixmap.rowBytes(); 35 size_t rb = s.fPixmap.rowBytes();
53 36
(...skipping 21 matching lines...) Expand all
75 *colors++ = RETURNDST(src); 58 *colors++ = RETURNDST(src);
76 } 59 }
77 60
78 #ifdef POSTAMBLE 61 #ifdef POSTAMBLE
79 POSTAMBLE(s); 62 POSTAMBLE(s);
80 #endif 63 #endif
81 } 64 }
82 65
83 void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s, 66 void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s,
84 const uint32_t* SK_RESTRICT xy, 67 const uint32_t* SK_RESTRICT xy,
85 int count, DSTTYPE* SK_RESTRICT colors) { 68 int count, SkPMColor* SK_RESTRICT colors) {
86 SkASSERT(count > 0 && colors != nullptr); 69 SkASSERT(count > 0 && colors != nullptr);
87 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); 70 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
88 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); 71 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
89 SkDEBUGCODE(CHECKSTATE(s);) 72 SkDEBUGCODE(CHECKSTATE(s);)
90 73
91 #ifdef PREAMBLE 74 #ifdef PREAMBLE
92 PREAMBLE(s); 75 PREAMBLE(s);
93 #endif 76 #endif
94 const SRCTYPE* SK_RESTRICT srcAddr = (const SRCTYPE*)s.fPixmap.addr(); 77 const SRCTYPE* SK_RESTRICT srcAddr = (const SRCTYPE*)s.fPixmap.addr();
95 78
96 // buffer is y32, x16, x16, x16, x16, x16 79 // buffer is y32, x16, x16, x16, x16, x16
97 // bump srcAddr to the proper row, since we're told Y never changes 80 // bump srcAddr to the proper row, since we're told Y never changes
98 SkASSERT((unsigned)xy[0] < (unsigned)s.fPixmap.height()); 81 SkASSERT((unsigned)xy[0] < (unsigned)s.fPixmap.height());
99 srcAddr = (const SRCTYPE*)((const char*)srcAddr + 82 srcAddr = (const SRCTYPE*)((const char*)srcAddr +
100 xy[0] * s.fPixmap.rowBytes()); 83 xy[0] * s.fPixmap.rowBytes());
101 xy += 1; 84 xy += 1;
102 85
103 SRCTYPE src; 86 SRCTYPE src;
104 87
105 if (1 == s.fPixmap.width()) { 88 if (1 == s.fPixmap.width()) {
106 src = srcAddr[0]; 89 src = srcAddr[0];
107 DSTTYPE dstValue = RETURNDST(src); 90 SkPMColor dstValue = RETURNDST(src);
108 BITMAPPROC_MEMSET(colors, dstValue, count); 91 sk_memset32(colors, dstValue, count);
109 } else { 92 } else {
110 int i; 93 int i;
111 for (i = (count >> 2); i > 0; --i) { 94 for (i = (count >> 2); i > 0; --i) {
112 uint32_t xx0 = *xy++; 95 uint32_t xx0 = *xy++;
113 uint32_t xx1 = *xy++; 96 uint32_t xx1 = *xy++;
114 SRCTYPE x0 = srcAddr[UNPACK_PRIMARY_SHORT(xx0)]; 97 SRCTYPE x0 = srcAddr[UNPACK_PRIMARY_SHORT(xx0)];
115 SRCTYPE x1 = srcAddr[UNPACK_SECONDARY_SHORT(xx0)]; 98 SRCTYPE x1 = srcAddr[UNPACK_SECONDARY_SHORT(xx0)];
116 SRCTYPE x2 = srcAddr[UNPACK_PRIMARY_SHORT(xx1)]; 99 SRCTYPE x2 = srcAddr[UNPACK_PRIMARY_SHORT(xx1)];
117 SRCTYPE x3 = srcAddr[UNPACK_SECONDARY_SHORT(xx1)]; 100 SRCTYPE x3 = srcAddr[UNPACK_SECONDARY_SHORT(xx1)];
118 101
(...skipping 11 matching lines...) Expand all
130 113
131 #ifdef POSTAMBLE 114 #ifdef POSTAMBLE
132 POSTAMBLE(s); 115 POSTAMBLE(s);
133 #endif 116 #endif
134 } 117 }
135 118
136 /////////////////////////////////////////////////////////////////////////////// 119 ///////////////////////////////////////////////////////////////////////////////
137 120
138 void MAKENAME(_filter_DX)(const SkBitmapProcState& s, 121 void MAKENAME(_filter_DX)(const SkBitmapProcState& s,
139 const uint32_t* SK_RESTRICT xy, 122 const uint32_t* SK_RESTRICT xy,
140 int count, DSTTYPE* SK_RESTRICT colors) { 123 int count, SkPMColor* SK_RESTRICT colors) {
141 SkASSERT(count > 0 && colors != nullptr); 124 SkASSERT(count > 0 && colors != nullptr);
142 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); 125 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
143 SkDEBUGCODE(CHECKSTATE(s);) 126 SkDEBUGCODE(CHECKSTATE(s);)
144 127
145 #ifdef PREAMBLE 128 #ifdef PREAMBLE
146 PREAMBLE(s); 129 PREAMBLE(s);
147 #endif 130 #endif
148 const char* SK_RESTRICT srcAddr = (const char*)s.fPixmap.addr(); 131 const char* SK_RESTRICT srcAddr = (const char*)s.fPixmap.addr();
149 size_t rb = s.fPixmap.rowBytes(); 132 size_t rb = s.fPixmap.rowBytes();
150 unsigned subY; 133 unsigned subY;
(...skipping 25 matching lines...) Expand all
176 colors += 1; 159 colors += 1;
177 160
178 } while (--count != 0); 161 } while (--count != 0);
179 162
180 #ifdef POSTAMBLE 163 #ifdef POSTAMBLE
181 POSTAMBLE(s); 164 POSTAMBLE(s);
182 #endif 165 #endif
183 } 166 }
184 void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s, 167 void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s,
185 const uint32_t* SK_RESTRICT xy, 168 const uint32_t* SK_RESTRICT xy,
186 int count, DSTTYPE* SK_RESTRICT colors) { 169 int count, SkPMColor* SK_RESTRICT colors) {
187 SkASSERT(count > 0 && colors != nullptr); 170 SkASSERT(count > 0 && colors != nullptr);
188 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); 171 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality);
189 SkDEBUGCODE(CHECKSTATE(s);) 172 SkDEBUGCODE(CHECKSTATE(s);)
190 173
191 #ifdef PREAMBLE 174 #ifdef PREAMBLE
192 PREAMBLE(s); 175 PREAMBLE(s);
193 #endif 176 #endif
194 const char* SK_RESTRICT srcAddr = (const char*)s.fPixmap.addr(); 177 const char* SK_RESTRICT srcAddr = (const char*)s.fPixmap.addr();
195 size_t rb = s.fPixmap.rowBytes(); 178 size_t rb = s.fPixmap.rowBytes();
196 179
(...skipping 21 matching lines...) Expand all
218 colors); 201 colors);
219 colors += 1; 202 colors += 1;
220 } while (--count != 0); 203 } while (--count != 0);
221 204
222 #ifdef POSTAMBLE 205 #ifdef POSTAMBLE
223 POSTAMBLE(s); 206 POSTAMBLE(s);
224 #endif 207 #endif
225 } 208 }
226 209
227 #undef MAKENAME 210 #undef MAKENAME
228 #undef DSTSIZE
229 #undef DSTTYPE
230 #undef SRCTYPE 211 #undef SRCTYPE
231 #undef CHECKSTATE 212 #undef CHECKSTATE
232 #undef RETURNDST 213 #undef RETURNDST
233 #undef SRC_TO_FILTER 214 #undef SRC_TO_FILTER
234 #undef FILTER_TO_DST 215 #undef FILTER_TO_DST
235 216
236 #ifdef PREAMBLE 217 #ifdef PREAMBLE
237 #undef PREAMBLE 218 #undef PREAMBLE
238 #endif 219 #endif
239 #ifdef POSTAMBLE 220 #ifdef POSTAMBLE
240 #undef POSTAMBLE 221 #undef POSTAMBLE
241 #endif 222 #endif
242 223
243 #undef FILTER_PROC_TYPE 224 #undef FILTER_PROC_TYPE
244 #undef GET_FILTER_TABLE 225 #undef GET_FILTER_TABLE
245 #undef GET_FILTER_ROW 226 #undef GET_FILTER_ROW
246 #undef GET_FILTER_ROW_PROC 227 #undef GET_FILTER_ROW_PROC
247 #undef GET_FILTER_PROC 228 #undef GET_FILTER_PROC
248 #undef BITMAPPROC_MEMSET
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState_procs.h ('k') | src/core/SkBitmapProcState_shaderproc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698