| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 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 SkTextureCompressor_Blitter_DEFINED | 8 #ifndef SkTextureCompressor_Blitter_DEFINED |
| 9 #define SkTextureCompressor_Blitter_DEFINED | 9 #define SkTextureCompressor_Blitter_DEFINED |
| 10 | 10 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Updates the block whose columns are stored in block. curAlphai is expecte
d | 226 // Updates the block whose columns are stored in block. curAlphai is expecte
d |
| 227 // to store the alpha values that will be placed within each of the columns
in | 227 // to store the alpha values that will be placed within each of the columns
in |
| 228 // the range [col, col+colsLeft). | 228 // the range [col, col+colsLeft). |
| 229 typedef uint32_t Column[BlockDim/4]; | 229 typedef uint32_t Column[BlockDim/4]; |
| 230 typedef uint32_t Block[BlockDim][BlockDim/4]; | 230 typedef uint32_t Block[BlockDim][BlockDim/4]; |
| 231 inline void updateBlockColumns(Block block, const int col, | 231 inline void updateBlockColumns(Block block, const int col, |
| 232 const int colsLeft, const Column curAlphai) { | 232 const int colsLeft, const Column curAlphai) { |
| 233 SkASSERT(NULL != block); | 233 SkASSERT(NULL != block); |
| 234 SkASSERT(col + colsLeft <= 4); | 234 SkASSERT(col + colsLeft <= BlockDim); |
| 235 | 235 |
| 236 for (int i = col; i < (col + colsLeft); ++i) { | 236 for (int i = col; i < (col + colsLeft); ++i) { |
| 237 memcpy(block[i], curAlphai, sizeof(Column)); | 237 memcpy(block[i], curAlphai, sizeof(Column)); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 // The following function writes the buffered runs to compressed blocks. | 241 // The following function writes the buffered runs to compressed blocks. |
| 242 // If fNextRun < BlockDim, then we fill the runs that we haven't buffered wi
th | 242 // If fNextRun < BlockDim, then we fill the runs that we haven't buffered wi
th |
| 243 // the constant zero buffer. | 243 // the constant zero buffer. |
| 244 void flushRuns() { | 244 void flushRuns() { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 CompressionProc(outPtr, reinterpret_cast<uint8_t*>(block)); | 396 CompressionProc(outPtr, reinterpret_cast<uint8_t*>(block)); |
| 397 } | 397 } |
| 398 | 398 |
| 399 fNextRun = 0; | 399 fNextRun = 0; |
| 400 } | 400 } |
| 401 }; | 401 }; |
| 402 | 402 |
| 403 } // namespace SkTextureCompressor | 403 } // namespace SkTextureCompressor |
| 404 | 404 |
| 405 #endif // SkTextureCompressor_Blitter_DEFINED | 405 #endif // SkTextureCompressor_Blitter_DEFINED |
| OLD | NEW |