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

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

Issue 1061713007: Adding png scanline decoding to kIndex8 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ctableCount requirements Created 5 years, 8 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
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
11 #include "SkColorTable.h"
11 #include "SkImageInfo.h" 12 #include "SkImageInfo.h"
12 #include "SkSwizzler.h" 13 #include "SkSwizzler.h"
13 #include "SkTypes.h" 14 #include "SkTypes.h"
15 #include "SkUtils.h"
14 16
15 /* 17 /*
16 * 18 *
17 * Helper routine for alpha result codes 19 * Helper routine for alpha result codes
18 * 20 *
19 */ 21 */
20 #define INIT_RESULT_ALPHA \ 22 #define INIT_RESULT_ALPHA \
21 uint8_t zeroAlpha = 0; \ 23 uint8_t zeroAlpha = 0; \
22 uint8_t maxAlpha = 0xFF; 24 uint8_t maxAlpha = 0xFF;
23 25
24 #define UPDATE_RESULT_ALPHA(alpha) \ 26 #define UPDATE_RESULT_ALPHA(alpha) \
25 zeroAlpha |= (alpha); \ 27 zeroAlpha |= (alpha); \
26 maxAlpha &= (alpha); 28 maxAlpha &= (alpha);
27 29
28 #define COMPUTE_RESULT_ALPHA \ 30 #define COMPUTE_RESULT_ALPHA \
29 SkSwizzler::GetResult(zeroAlpha, maxAlpha); 31 SkSwizzler::GetResult(zeroAlpha, maxAlpha);
30 32
31 /* 33 /*
32 * 34 *
35 * Copy the codec color table back to the client when kIndex8 color type is requ ested
36 *
37 */
38 static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* co lorTable,
39 SkPMColor* inputColorPtr, int* inputColorCount) {
40 if (kIndex_8_SkColorType == dstInfo.colorType()) {
41 SkASSERT(NULL != inputColorPtr);
42 SkASSERT(NULL != inputColorCount);
43 SkASSERT(NULL != colorTable);
44 sk_memcpy32(inputColorPtr, colorTable->readColors(), *inputColorCount);
45 }
46 }
47
48 /*
49 *
33 * Compute row bytes for an image using pixels per byte 50 * Compute row bytes for an image using pixels per byte
34 * 51 *
35 */ 52 */
36 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) { 53 static inline size_t compute_row_bytes_ppb(int width, uint32_t pixelsPerByte) {
37 return (width + pixelsPerByte - 1) / pixelsPerByte; 54 return (width + pixelsPerByte - 1) / pixelsPerByte;
38 } 55 }
39 56
40 /* 57 /*
41 * 58 *
42 * Compute row bytes for an image using bytes per pixel 59 * Compute row bytes for an image using bytes per pixel
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 #endif 122 #endif
106 } 123 }
107 124
108 #ifdef SK_PRINT_CODEC_MESSAGES 125 #ifdef SK_PRINT_CODEC_MESSAGES
109 #define SkCodecPrintf SkDebugf 126 #define SkCodecPrintf SkDebugf
110 #else 127 #else
111 #define SkCodecPrintf(...) 128 #define SkCodecPrintf(...)
112 #endif 129 #endif
113 130
114 #endif // SkCodecPriv_DEFINED 131 #endif // SkCodecPriv_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698