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

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

Issue 1013743003: Adding premul and 565 swizzles for bmp: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Trybot fixes Created 5 years, 9 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 | « no previous file | src/codec/SkCodec_libbmp.h » ('j') | src/codec/SkCodec_libbmp.cpp » ('J')
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return compute_row_bytes_ppb(width, pixelsPerByte); 58 return compute_row_bytes_ppb(width, pixelsPerByte);
59 } else { 59 } else {
60 SkASSERT(0 == bitsPerPixel % 8); 60 SkASSERT(0 == bitsPerPixel % 8);
61 const uint32_t bytesPerPixel = bitsPerPixel / 8; 61 const uint32_t bytesPerPixel = bitsPerPixel / 8;
62 return compute_row_bytes_bpp(width, bytesPerPixel); 62 return compute_row_bytes_bpp(width, bytesPerPixel);
63 } 63 }
64 } 64 }
65 65
66 /* 66 /*
67 * 67 *
68 * Checks if alpha types are premul and unpremul
69 *
70 */
71 static inline bool premul_and_unpremul(SkAlphaType dst, SkAlphaType src) {
72 return kPremul_SkAlphaType == dst && kUnpremul_SkAlphaType == src;
73 }
74
75 /*
76 *
77 * Get a byte from a buffer 68 * Get a byte from a buffer
78 * This method is unsafe, the caller is responsible for performing a check 69 * This method is unsafe, the caller is responsible for performing a check
79 * 70 *
80 */ 71 */
81 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) { 72 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) {
82 return buffer[i]; 73 return buffer[i];
83 } 74 }
84 75
85 /* 76 /*
86 * 77 *
(...skipping 21 matching lines...) Expand all
108 uint32_t result; 99 uint32_t result;
109 memcpy(&result, &(buffer[i]), 4); 100 memcpy(&result, &(buffer[i]), 4);
110 #ifdef SK_CPU_BENDIAN 101 #ifdef SK_CPU_BENDIAN
111 return SkEndianSwap32(result); 102 return SkEndianSwap32(result);
112 #else 103 #else
113 return result; 104 return result;
114 #endif 105 #endif
115 } 106 }
116 107
117 #endif // SkCodecPriv_DEFINED 108 #endif // SkCodecPriv_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkCodec_libbmp.h » ('j') | src/codec/SkCodec_libbmp.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698