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

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

Issue 1305123002: Scanline decoding for gifs (Closed) Base URL: https://skia.googlesource.com/skia.git@real-bmp-scan
Patch Set: Compile fix 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 /*
34 * Returns the first coordinate that we will keep during a scaled decode. 45 * Returns the first coordinate that we will keep during a scaled decode.
35 * The output can be interpreted as an x-coordinate or a y-coordinate. 46 * The output can be interpreted as an x-coordinate or a y-coordinate.
36 * 47 *
37 * This does not need to be called and is not called when sampleFactor == 1. 48 * This does not need to be called and is not called when sampleFactor == 1.
38 */ 49 */
39 static int get_start_coord(int sampleFactor) { return sampleFactor / 2; }; 50 static int get_start_coord(int sampleFactor) { return sampleFactor / 2; };
40 51
41 /* 52 /*
42 * Given a coordinate in the original image, this returns the corresponding 53 * Given a coordinate in the original image, this returns the corresponding
43 * coordinate in the scaled image. This function is meaningless if 54 * coordinate in the scaled image. This function is meaningless if
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 /* 141 /*
131 * 142 *
132 * Copy the codec color table back to the client when kIndex8 color type is requ ested 143 * Copy the codec color table back to the client when kIndex8 color type is requ ested
133 */ 144 */
134 static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* co lorTable, 145 static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* co lorTable,
135 SkPMColor* inputColorPtr, int* inputColorCount) { 146 SkPMColor* inputColorPtr, int* inputColorCount) {
136 if (kIndex_8_SkColorType == dstInfo.colorType()) { 147 if (kIndex_8_SkColorType == dstInfo.colorType()) {
137 SkASSERT(nullptr != inputColorPtr); 148 SkASSERT(nullptr != inputColorPtr);
138 SkASSERT(nullptr != inputColorCount); 149 SkASSERT(nullptr != inputColorCount);
139 SkASSERT(nullptr != colorTable); 150 SkASSERT(nullptr != colorTable);
140 memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * 4); 151 memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * sizeo f(SkPMColor));
141 } 152 }
142 } 153 }
143 154
144 /* 155 /*
145 * Compute row bytes for an image using pixels per byte 156 * Compute row bytes for an image using pixels per byte
146 */ 157 */
147 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) { 158 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) {
148 return (width + pixelsPerByte - 1) / pixelsPerByte; 159 return (width + pixelsPerByte - 1) / pixelsPerByte;
149 } 160 }
150 161
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 #endif 234 #endif
224 } 235 }
225 236
226 #ifdef SK_PRINT_CODEC_MESSAGES 237 #ifdef SK_PRINT_CODEC_MESSAGES
227 #define SkCodecPrintf SkDebugf 238 #define SkCodecPrintf SkDebugf
228 #else 239 #else
229 #define SkCodecPrintf(...) 240 #define SkCodecPrintf(...)
230 #endif 241 #endif
231 242
232 #endif // SkCodecPriv_DEFINED 243 #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