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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 return ptr + EncodedBlockSize*this->getBlockOffset(x, y); | 433 return ptr + EncodedBlockSize*this->getBlockOffset(x, y); |
434 } | 434 } |
435 | 435 |
436 // Updates the block whose columns are stored in block. curAlphai is expecte
d | 436 // Updates the block whose columns are stored in block. curAlphai is expecte
d |
437 // to store the alpha values that will be placed within each of the columns
in | 437 // to store the alpha values that will be placed within each of the columns
in |
438 // the range [col, col+colsLeft). | 438 // the range [col, col+colsLeft). |
439 typedef uint32_t Column[BlockDim/4]; | 439 typedef uint32_t Column[BlockDim/4]; |
440 typedef uint32_t Block[BlockDim][BlockDim/4]; | 440 typedef uint32_t Block[BlockDim][BlockDim/4]; |
441 inline void updateBlockColumns(Block block, const int col, | 441 inline void updateBlockColumns(Block block, const int col, |
442 const int colsLeft, const Column curAlphai) { | 442 const int colsLeft, const Column curAlphai) { |
443 SkASSERT(NULL != block); | 443 SkASSERT(block); |
444 SkASSERT(col + colsLeft <= BlockDim); | 444 SkASSERT(col + colsLeft <= BlockDim); |
445 | 445 |
446 for (int i = col; i < (col + colsLeft); ++i) { | 446 for (int i = col; i < (col + colsLeft); ++i) { |
447 memcpy(block[i], curAlphai, sizeof(Column)); | 447 memcpy(block[i], curAlphai, sizeof(Column)); |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 // The following function writes the buffered runs to compressed blocks. | 451 // The following function writes the buffered runs to compressed blocks. |
452 // If fNextRun < BlockDim, then we fill the runs that we haven't buffered wi
th | 452 // If fNextRun < BlockDim, then we fill the runs that we haven't buffered wi
th |
453 // the constant zero buffer. | 453 // the constant zero buffer. |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 mask, BlockDim, mask); | 723 mask, BlockDim, mask); |
724 } | 724 } |
725 } | 725 } |
726 #endif // PEDANTIC_BLIT_RECT | 726 #endif // PEDANTIC_BLIT_RECT |
727 | 727 |
728 }; | 728 }; |
729 | 729 |
730 } // namespace SkTextureCompressor | 730 } // namespace SkTextureCompressor |
731 | 731 |
732 #endif // SkTextureCompressor_Blitter_DEFINED | 732 #endif // SkTextureCompressor_Blitter_DEFINED |
OLD | NEW |