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

Side by Side Diff: src/codec/SkCodecPriv.h

Issue 1320273004: Revert of Scanline decoding for gifs (Closed) Base URL: https://skia.googlesource.com/skia.git@real-bmp-scan
Patch Set: Created 5 years, 3 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 | « dm/DMSrcSink.cpp ('k') | src/codec/SkCodec_libgif.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 The Android Open Source Project 2 * Copyright 2015 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 SkCodecPriv_DEFINED 8 #ifndef SkCodecPriv_DEFINED
9 #define SkCodecPriv_DEFINED 9 #define SkCodecPriv_DEFINED
10 10
(...skipping 13 matching lines...) Expand all
24 uint8_t maxAlpha = 0xFF; 24 uint8_t maxAlpha = 0xFF;
25 25
26 #define UPDATE_RESULT_ALPHA(alpha) \ 26 #define UPDATE_RESULT_ALPHA(alpha) \
27 zeroAlpha |= (alpha); \ 27 zeroAlpha |= (alpha); \
28 maxAlpha &= (alpha); 28 maxAlpha &= (alpha);
29 29
30 #define COMPUTE_RESULT_ALPHA \ 30 #define COMPUTE_RESULT_ALPHA \
31 SkSwizzler::GetResult(zeroAlpha, maxAlpha); 31 SkSwizzler::GetResult(zeroAlpha, maxAlpha);
32 32
33 /* 33 /*
34 * returns a scaled dimension based on the original dimension and the sampleSize
35 * NOTE: we round down here for scaled dimension to match the behavior of SkImag eDecoder
36 */
37 static int get_scaled_dimension(int srcDimension, int sampleSize) {
38 if (sampleSize > srcDimension) {
39 return 1;
40 }
41 return srcDimension / sampleSize;
42 }
43
44 /*
45 * Returns the first coordinate that we will keep during a scaled decode. 34 * Returns the first coordinate that we will keep during a scaled decode.
46 * The output can be interpreted as an x-coordinate or a y-coordinate. 35 * The output can be interpreted as an x-coordinate or a y-coordinate.
47 * 36 *
48 * This does not need to be called and is not called when sampleFactor == 1. 37 * This does not need to be called and is not called when sampleFactor == 1.
49 */ 38 */
50 static int get_start_coord(int sampleFactor) { return sampleFactor / 2; }; 39 static int get_start_coord(int sampleFactor) { return sampleFactor / 2; };
51 40
52 /* 41 /*
53 * Given a coordinate in the original image, this returns the corresponding 42 * Given a coordinate in the original image, this returns the corresponding
54 * coordinate in the scaled image. This function is meaningless if 43 * coordinate in the scaled image. This function is meaningless if
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 /* 130 /*
142 * 131 *
143 * Copy the codec color table back to the client when kIndex8 color type is requ ested 132 * Copy the codec color table back to the client when kIndex8 color type is requ ested
144 */ 133 */
145 static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* co lorTable, 134 static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* co lorTable,
146 SkPMColor* inputColorPtr, int* inputColorCount) { 135 SkPMColor* inputColorPtr, int* inputColorCount) {
147 if (kIndex_8_SkColorType == dstInfo.colorType()) { 136 if (kIndex_8_SkColorType == dstInfo.colorType()) {
148 SkASSERT(nullptr != inputColorPtr); 137 SkASSERT(nullptr != inputColorPtr);
149 SkASSERT(nullptr != inputColorCount); 138 SkASSERT(nullptr != inputColorCount);
150 SkASSERT(nullptr != colorTable); 139 SkASSERT(nullptr != colorTable);
151 memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * sizeo f(SkPMColor)); 140 memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * 4);
152 } 141 }
153 } 142 }
154 143
155 /* 144 /*
156 * Compute row bytes for an image using pixels per byte 145 * Compute row bytes for an image using pixels per byte
157 */ 146 */
158 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) { 147 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) {
159 return (width + pixelsPerByte - 1) / pixelsPerByte; 148 return (width + pixelsPerByte - 1) / pixelsPerByte;
160 } 149 }
161 150
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 #endif 223 #endif
235 } 224 }
236 225
237 #ifdef SK_PRINT_CODEC_MESSAGES 226 #ifdef SK_PRINT_CODEC_MESSAGES
238 #define SkCodecPrintf SkDebugf 227 #define SkCodecPrintf SkDebugf
239 #else 228 #else
240 #define SkCodecPrintf(...) 229 #define SkCodecPrintf(...)
241 #endif 230 #endif
242 231
243 #endif // SkCodecPriv_DEFINED 232 #endif // SkCodecPriv_DEFINED
OLDNEW
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | src/codec/SkCodec_libgif.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698