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

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

Issue 1287423002: Scanline decoding for bmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Scaling for all types of bmps 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
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 SkASSERT(0 == 8 % bitsPerPixel); 124 SkASSERT(0 == 8 % bitsPerPixel);
125 const uint32_t pixelsPerByte = 8 / bitsPerPixel; 125 const uint32_t pixelsPerByte = 8 / bitsPerPixel;
126 return compute_row_bytes_ppb(width, pixelsPerByte); 126 return compute_row_bytes_ppb(width, pixelsPerByte);
127 } else { 127 } else {
128 SkASSERT(0 == bitsPerPixel % 8); 128 SkASSERT(0 == bitsPerPixel % 8);
129 const uint32_t bytesPerPixel = bitsPerPixel / 8; 129 const uint32_t bytesPerPixel = bitsPerPixel / 8;
130 return compute_row_bytes_bpp(width, bytesPerPixel); 130 return compute_row_bytes_bpp(width, bytesPerPixel);
131 } 131 }
132 } 132 }
133 133
134 static bool is_coord_necessary(int srcCoord, int start, int sampleSize, int scal edDim) {
135 // Check for edge cases on the first few rows or the last few rows
136 if (srcCoord < start || srcCoord / sampleSize >= scaledDim) {
137 return false;
138 }
139
140 // Every sampleY rows are necessary
141 return ((srcCoord - start) % sampleSize) == 0;
142 }
143
134 /* 144 /*
135 * Get a byte from a buffer 145 * Get a byte from a buffer
136 * This method is unsafe, the caller is responsible for performing a check 146 * This method is unsafe, the caller is responsible for performing a check
137 */ 147 */
138 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) { 148 static inline uint8_t get_byte(uint8_t* buffer, uint32_t i) {
139 return buffer[i]; 149 return buffer[i];
140 } 150 }
141 151
142 /* 152 /*
143 * Get a short from a buffer 153 * Get a short from a buffer
(...skipping 23 matching lines...) Expand all
167 #endif 177 #endif
168 } 178 }
169 179
170 #ifdef SK_PRINT_CODEC_MESSAGES 180 #ifdef SK_PRINT_CODEC_MESSAGES
171 #define SkCodecPrintf SkDebugf 181 #define SkCodecPrintf SkDebugf
172 #else 182 #else
173 #define SkCodecPrintf(...) 183 #define SkCodecPrintf(...)
174 #endif 184 #endif
175 185
176 #endif // SkCodecPriv_DEFINED 186 #endif // SkCodecPriv_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698