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

Side by Side Diff: src/codec/SkSwizzler.cpp

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use SkWebpCodec native scaling, update comments and spacing 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
« src/codec/SkScaledCodec.cpp ('K') | « src/codec/SkSwizzler.h ('k') | no next file » | 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 #include "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkSwizzler.h" 10 #include "SkSwizzler.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 x++; 65 x++;
66 } 66 }
67 } 67 }
68 return COMPUTE_RESULT_ALPHA; 68 return COMPUTE_RESULT_ALPHA;
69 } 69 }
70 70
71 // kIndex 71 // kIndex
72 72
73 static SkSwizzler::ResultAlpha swizzle_index_to_index( 73 static SkSwizzler::ResultAlpha swizzle_index_to_index(
74 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 74 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
75 int bytesPerPixel, int y, const SkPMColor ctable[]) { 75 int deltaSrc, int y, const SkPMColor ctable[]) {
76 76
77 uint8_t* SK_RESTRICT dst = (uint8_t*) dstRow; 77 uint8_t* SK_RESTRICT dst = (uint8_t*) dstRow;
78 memcpy(dst, src, width); 78 if (1 == deltaSrc) {
79 memcpy(dst, src, width);
80 } else {
81 for (int x = 0; x < width; x++) {
82 dst[x] = src[0];
83 src += deltaSrc;
84 }
85 }
79 // TODO (msarett): Should we skip the loop here and guess that the row is op aque/not opaque? 86 // TODO (msarett): Should we skip the loop here and guess that the row is op aque/not opaque?
80 // SkScaledBitmap sampler just guesses that it is opaque. T his is dangerous 87 // SkScaledBitmap sampler just guesses that it is opaque. T his is dangerous
81 // and probably wrong since gif and bmp (rarely) may have al pha. 88 // and probably wrong since gif and bmp (rarely) may have al pha.
82 INIT_RESULT_ALPHA; 89 INIT_RESULT_ALPHA;
83 for (int x = 0; x < width; x++) { 90 for (int x = 0; x < width; x++) {
84 UPDATE_RESULT_ALPHA(ctable[src[x]] >> SK_A32_SHIFT); 91 UPDATE_RESULT_ALPHA(ctable[src[x]] >> SK_A32_SHIFT);
85 } 92 }
86 return COMPUTE_RESULT_ALPHA; 93 return COMPUTE_RESULT_ALPHA;
87 } 94 }
88 95
89 static SkSwizzler::ResultAlpha swizzle_index_to_n32( 96 static SkSwizzler::ResultAlpha swizzle_index_to_n32(
90 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 97 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
91 int bytesPerPixel, int y, const SkPMColor ctable[]) { 98 int deltaSrc, int y, const SkPMColor ctable[]) {
92 99
93 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 100 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
94 INIT_RESULT_ALPHA; 101 INIT_RESULT_ALPHA;
95 for (int x = 0; x < width; x++) { 102 for (int x = 0; x < width; x++) {
96 SkPMColor c = ctable[src[x]]; 103 SkPMColor c = ctable[*src];
97 UPDATE_RESULT_ALPHA(c >> SK_A32_SHIFT); 104 UPDATE_RESULT_ALPHA(c >> SK_A32_SHIFT);
98 dst[x] = c; 105 dst[x] = c;
106 src += deltaSrc;
99 } 107 }
100 return COMPUTE_RESULT_ALPHA; 108 return COMPUTE_RESULT_ALPHA;
101 } 109 }
102 110
103 static SkSwizzler::ResultAlpha swizzle_index_to_n32_skipZ( 111 static SkSwizzler::ResultAlpha swizzle_index_to_n32_skipZ(
104 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 112 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
105 int bytesPerPixel, int y, const SkPMColor ctable[]) { 113 int deltaSrc, int y, const SkPMColor ctable[]) {
106 114
107 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 115 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
108 INIT_RESULT_ALPHA; 116 INIT_RESULT_ALPHA;
109 for (int x = 0; x < width; x++) { 117 for (int x = 0; x < width; x++) {
110 SkPMColor c = ctable[src[x]]; 118 SkPMColor c = ctable[*src];
111 UPDATE_RESULT_ALPHA(c >> SK_A32_SHIFT); 119 UPDATE_RESULT_ALPHA(c >> SK_A32_SHIFT);
112 if (c != 0) { 120 if (c != 0) {
113 dst[x] = c; 121 dst[x] = c;
114 } 122 }
123 src += deltaSrc;
115 } 124 }
116 return COMPUTE_RESULT_ALPHA; 125 return COMPUTE_RESULT_ALPHA;
117 } 126 }
118 127
119 #undef A32_MASK_IN_PLACE 128 #undef A32_MASK_IN_PLACE
120 129
121 // kGray 130 // kGray
122 131
123 static SkSwizzler::ResultAlpha swizzle_gray_to_n32( 132 static SkSwizzler::ResultAlpha swizzle_gray_to_n32(
124 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 133 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
125 int bytesPerPixel, int y, const SkPMColor ctable[]) { 134 int deltaSrc, int y, const SkPMColor ctable[]) {
126 135
127 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 136 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
128 for (int x = 0; x < width; x++) { 137 for (int x = 0; x < width; x++) {
129 dst[x] = SkPackARGB32NoCheck(0xFF, src[x], src[x], src[x]); 138 dst[x] = SkPackARGB32NoCheck(0xFF, *src, *src, *src);
139 src += deltaSrc;
130 } 140 }
131 return SkSwizzler::kOpaque_ResultAlpha; 141 return SkSwizzler::kOpaque_ResultAlpha;
132 } 142 }
133 143
134 static SkSwizzler::ResultAlpha swizzle_gray_to_gray( 144 static SkSwizzler::ResultAlpha swizzle_gray_to_gray(
135 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 145 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
136 int bytesPerPixel, int y, const SkPMColor ctable[]) { 146 int deltaSrc, int y, const SkPMColor ctable[]) {
137 memcpy(dstRow, src, width); 147
148 uint8_t* SK_RESTRICT dst = (uint8_t*) dstRow;
149 if (1 == deltaSrc) {
150 memcpy(dstRow, src, width);
151 } else {
152 for (int x = 0; x < width; x++) {
153 dst[x] = src[0];
154 src += deltaSrc;
155 }
156 }
138 return SkSwizzler::kOpaque_ResultAlpha; 157 return SkSwizzler::kOpaque_ResultAlpha;
139 } 158 }
140 159
141 // kBGRX 160 // kBGRX
142 161
143 static SkSwizzler::ResultAlpha swizzle_bgrx_to_n32( 162 static SkSwizzler::ResultAlpha swizzle_bgrx_to_n32(
144 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 163 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
145 int bytesPerPixel, int y, const SkPMColor ctable[]) { 164 int deltaSrc, int y, const SkPMColor ctable[]) {
146 165
147 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 166 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
148 for (int x = 0; x < width; x++) { 167 for (int x = 0; x < width; x++) {
149 dst[x] = SkPackARGB32NoCheck(0xFF, src[2], src[1], src[0]); 168 dst[x] = SkPackARGB32NoCheck(0xFF, src[2], src[1], src[0]);
150 src += bytesPerPixel; 169 src += deltaSrc;
151 } 170 }
152 return SkSwizzler::kOpaque_ResultAlpha; 171 return SkSwizzler::kOpaque_ResultAlpha;
153 } 172 }
154 173
155 // kBGRA 174 // kBGRA
156 175
157 static SkSwizzler::ResultAlpha swizzle_bgra_to_n32_unpremul( 176 static SkSwizzler::ResultAlpha swizzle_bgra_to_n32_unpremul(
158 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 177 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
159 int bytesPerPixel, int y, const SkPMColor ctable[]) { 178 int deltaSrc, int y, const SkPMColor ctable[]) {
160 179
161 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 180 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
162 INIT_RESULT_ALPHA; 181 INIT_RESULT_ALPHA;
163 for (int x = 0; x < width; x++) { 182 for (int x = 0; x < width; x++) {
164 uint8_t alpha = src[3]; 183 uint8_t alpha = src[3];
165 UPDATE_RESULT_ALPHA(alpha); 184 UPDATE_RESULT_ALPHA(alpha);
166 dst[x] = SkPackARGB32NoCheck(alpha, src[2], src[1], src[0]); 185 dst[x] = SkPackARGB32NoCheck(alpha, src[2], src[1], src[0]);
167 src += bytesPerPixel; 186 src += deltaSrc;
168 } 187 }
169 return COMPUTE_RESULT_ALPHA; 188 return COMPUTE_RESULT_ALPHA;
170 } 189 }
171 190
172 static SkSwizzler::ResultAlpha swizzle_bgra_to_n32_premul( 191 static SkSwizzler::ResultAlpha swizzle_bgra_to_n32_premul(
173 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 192 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
174 int bytesPerPixel, int y, const SkPMColor ctable[]) { 193 int deltaSrc, int y, const SkPMColor ctable[]) {
175 194
176 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 195 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
177 INIT_RESULT_ALPHA; 196 INIT_RESULT_ALPHA;
178 for (int x = 0; x < width; x++) { 197 for (int x = 0; x < width; x++) {
179 uint8_t alpha = src[3]; 198 uint8_t alpha = src[3];
180 UPDATE_RESULT_ALPHA(alpha); 199 UPDATE_RESULT_ALPHA(alpha);
181 dst[x] = SkPreMultiplyARGB(alpha, src[2], src[1], src[0]); 200 dst[x] = SkPreMultiplyARGB(alpha, src[2], src[1], src[0]);
182 src += bytesPerPixel; 201 src += deltaSrc;
183 } 202 }
184 return COMPUTE_RESULT_ALPHA; 203 return COMPUTE_RESULT_ALPHA;
185 } 204 }
186 205
187 // n32 206 // n32
188 static SkSwizzler::ResultAlpha swizzle_rgbx_to_n32( 207 static SkSwizzler::ResultAlpha swizzle_rgbx_to_n32(
189 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 208 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
190 int bytesPerPixel, int y, const SkPMColor ctable[]) { 209 int deltaSrc, int y, const SkPMColor ctable[]) {
191 210
192 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 211 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
193 for (int x = 0; x < width; x++) { 212 for (int x = 0; x < width; x++) {
194 dst[x] = SkPackARGB32(0xFF, src[0], src[1], src[2]); 213 dst[x] = SkPackARGB32(0xFF, src[0], src[1], src[2]);
195 src += bytesPerPixel; 214 src += deltaSrc;
196 } 215 }
197 return SkSwizzler::kOpaque_ResultAlpha; 216 return SkSwizzler::kOpaque_ResultAlpha;
198 } 217 }
199 218
200 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_premul( 219 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_premul(
201 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 220 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
202 int bytesPerPixel, int y, const SkPMColor ctable[]) { 221 int deltaSrc, int y, const SkPMColor ctable[]) {
203 222
204 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 223 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
205 INIT_RESULT_ALPHA; 224 INIT_RESULT_ALPHA;
206 for (int x = 0; x < width; x++) { 225 for (int x = 0; x < width; x++) {
207 unsigned alpha = src[3]; 226 unsigned alpha = src[3];
208 UPDATE_RESULT_ALPHA(alpha); 227 UPDATE_RESULT_ALPHA(alpha);
209 dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]); 228 dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]);
210 src += bytesPerPixel; 229 src += deltaSrc;
211 } 230 }
212 return COMPUTE_RESULT_ALPHA; 231 return COMPUTE_RESULT_ALPHA;
213 } 232 }
214 233
215 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_unpremul( 234 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_unpremul(
216 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 235 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
217 int bytesPerPixel, int y, const SkPMColor ctable[]) { 236 int deltaSrc, int y, const SkPMColor ctable[]) {
218 237
219 uint32_t* SK_RESTRICT dst = reinterpret_cast<uint32_t*>(dstRow); 238 uint32_t* SK_RESTRICT dst = reinterpret_cast<uint32_t*>(dstRow);
220 INIT_RESULT_ALPHA; 239 INIT_RESULT_ALPHA;
221 for (int x = 0; x < width; x++) { 240 for (int x = 0; x < width; x++) {
222 unsigned alpha = src[3]; 241 unsigned alpha = src[3];
223 UPDATE_RESULT_ALPHA(alpha); 242 UPDATE_RESULT_ALPHA(alpha);
224 dst[x] = SkPackARGB32NoCheck(alpha, src[0], src[1], src[2]); 243 dst[x] = SkPackARGB32NoCheck(alpha, src[0], src[1], src[2]);
225 src += bytesPerPixel; 244 src += deltaSrc;
226 } 245 }
227 return COMPUTE_RESULT_ALPHA; 246 return COMPUTE_RESULT_ALPHA;
228 } 247 }
229 248
230 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_premul_skipZ( 249 static SkSwizzler::ResultAlpha swizzle_rgba_to_n32_premul_skipZ(
231 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width, 250 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int width,
232 int bytesPerPixel, int y, const SkPMColor ctable[]) { 251 int deltaSrc, int y, const SkPMColor ctable[]) {
233 252
234 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; 253 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow;
235 INIT_RESULT_ALPHA; 254 INIT_RESULT_ALPHA;
236 for (int x = 0; x < width; x++) { 255 for (int x = 0; x < width; x++) {
237 unsigned alpha = src[3]; 256 unsigned alpha = src[3];
238 UPDATE_RESULT_ALPHA(alpha); 257 UPDATE_RESULT_ALPHA(alpha);
239 if (0 != alpha) { 258 if (0 != alpha) {
240 dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]); 259 dst[x] = SkPreMultiplyARGB(alpha, src[0], src[1], src[2]);
241 } 260 }
242 src += bytesPerPixel; 261 src += deltaSrc;
243 } 262 }
244 return COMPUTE_RESULT_ALPHA; 263 return COMPUTE_RESULT_ALPHA;
245 } 264 }
246 265
247 /** 266 /**
248 FIXME: This was my idea to cheat in order to continue taking advantage of sk ipping zeroes. 267 FIXME: This was my idea to cheat in order to continue taking advantage of sk ipping zeroes.
249 This would be fine for drawing normally, but not for drawing with transfer m odes. Being 268 This would be fine for drawing normally, but not for drawing with transfer m odes. Being
250 honest means we can draw correctly with transfer modes, with the cost of not being able 269 honest means we can draw correctly with transfer modes, with the cost of not being able
251 to take advantage of Android's free unwritten pages. Something to keep in mi nd when we 270 to take advantage of Android's free unwritten pages. Something to keep in mi nd when we
252 decide whether to switch to unpremul default. 271 decide whether to switch to unpremul default.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, 433 SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable,
415 int deltaSrc, const SkImageInfo& info, void* dst, 434 int deltaSrc, const SkImageInfo& info, void* dst,
416 size_t rowBytes) 435 size_t rowBytes)
417 : fRowProc(proc) 436 : fRowProc(proc)
418 , fColorTable(ctable) 437 , fColorTable(ctable)
419 , fDeltaSrc(deltaSrc) 438 , fDeltaSrc(deltaSrc)
420 , fDstInfo(info) 439 , fDstInfo(info)
421 , fDstRow(dst) 440 , fDstRow(dst)
422 , fDstRowBytes(rowBytes) 441 , fDstRowBytes(rowBytes)
423 , fCurrY(0) 442 , fCurrY(0)
443 , fSampleX(1)
444 , fX0(0)
424 { 445 {
425 SkDEBUGCODE(fNextMode = kUninitialized_NextMode); 446 SkDEBUGCODE(fNextMode = kUninitialized_NextMode);
426 } 447 }
427 448
449 void SkSwizzler::setSampleX(int sampleX){
450 if (1 == sampleX) {
451 fX0 = 0;
452 fSampleX = 1;
453 } else {
454 fSampleX = sampleX;
455 // offset first x pixel for more even sampling
456 fX0 = fSampleX >> 1;
457 }
458 // check that fX0 is less than original width
459 SkASSERT(fX0 >= 0 && fX0 < fDstInfo.width() * fSampleX);
460 }
461
428 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src) { 462 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src) {
429 SkASSERT(0 <= fCurrY && fCurrY < fDstInfo.height()); 463 SkASSERT(0 <= fCurrY && fCurrY < fDstInfo.height());
430 SkASSERT(fDstRow != NULL); 464 SkASSERT(fDstRow != NULL);
431 SkASSERT(kDesignateRow_NextMode != fNextMode); 465 SkASSERT(kDesignateRow_NextMode != fNextMode);
432 SkDEBUGCODE(fNextMode = kConsecutive_NextMode); 466 SkDEBUGCODE(fNextMode = kConsecutive_NextMode);
433 467
434 // Decode a row 468 // Decode a row
435 const ResultAlpha result = fRowProc(fDstRow, src, fDstInfo.width(), 469 const ResultAlpha result = fRowProc(fDstRow, src + fX0 * fDeltaSrc, fDstInf o.width(),
436 fDeltaSrc, fCurrY, fColorTable); 470 fSampleX * fDeltaSrc, fCurrY, fColorTable);
437 471
438 // Move to the next row and return the result 472 // Move to the next row and return the result
439 fCurrY++; 473 fCurrY++;
440 fDstRow = SkTAddOffset<void>(fDstRow, fDstRowBytes); 474 fDstRow = SkTAddOffset<void>(fDstRow, fDstRowBytes);
441 return result; 475 return result;
442 } 476 }
443 477
444 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src, 478 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src,
445 int y) { 479 int y) {
446 SkASSERT(0 <= y && y < fDstInfo.height()); 480 SkASSERT(0 <= y && y < fDstInfo.height());
447 SkASSERT(kConsecutive_NextMode != fNextMode); 481 SkASSERT(kConsecutive_NextMode != fNextMode);
448 SkDEBUGCODE(fNextMode = kDesignateRow_NextMode); 482 SkDEBUGCODE(fNextMode = kDesignateRow_NextMode);
449 483
450 // Choose the row 484 // Choose the row
451 void* row = SkTAddOffset<void>(fDstRow, y*fDstRowBytes); 485 void* row = SkTAddOffset<void>(fDstRow, y*fDstRowBytes);
452 486
453 // Decode the row 487 // Decode the row
454 return fRowProc(row, src, fDstInfo.width(), fDeltaSrc, fCurrY, 488 return fRowProc(row, src + fX0 * fDeltaSrc, fDstInfo.width(), fSampleX * fDe ltaSrc, fCurrY,
455 fColorTable); 489 fColorTable);
456 } 490 }
457 491
458 void SkSwizzler::Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstR owBytes, 492 void SkSwizzler::Fill(void* dstStartRow, const SkImageInfo& dstInfo, size_t dstR owBytes,
459 uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable) { 493 uint32_t numRows, uint32_t colorOrIndex, const SkPMColor* colorTable) {
460 SkASSERT(dstStartRow != NULL); 494 SkASSERT(dstStartRow != NULL);
461 SkASSERT(numRows <= (uint32_t) dstInfo.height()); 495 SkASSERT(numRows <= (uint32_t) dstInfo.height());
462 496
463 // Calculate bytes to fill. We use getSafeSize since the last row may not b e padded. 497 // Calculate bytes to fill. We use getSafeSize since the last row may not b e padded.
464 const size_t bytesToFill = dstInfo.makeWH(dstInfo.width(), numRows).getSafeS ize(dstRowBytes); 498 const size_t bytesToFill = dstInfo.makeWH(dstInfo.width(), numRows).getSafeS ize(dstRowBytes);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 // bits of SK_ColorBLACK are identical to the grayscale representati on 539 // bits of SK_ColorBLACK are identical to the grayscale representati on
506 // for black. 540 // for black.
507 memset(dstStartRow, (uint8_t) colorOrIndex, bytesToFill); 541 memset(dstStartRow, (uint8_t) colorOrIndex, bytesToFill);
508 break; 542 break;
509 default: 543 default:
510 SkCodecPrintf("Error: Unsupported dst color type for fill(). Doing nothing.\n"); 544 SkCodecPrintf("Error: Unsupported dst color type for fill(). Doing nothing.\n");
511 SkASSERT(false); 545 SkASSERT(false);
512 break; 546 break;
513 } 547 }
514 } 548 }
OLDNEW
« src/codec/SkScaledCodec.cpp ('K') | « src/codec/SkSwizzler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698