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 #include "SkTextureCompressor.h" | 8 #include "SkTextureCompressor.h" |
9 #include "SkTextureCompressor_Blitter.h" | 9 #include "SkTextureCompressor_Blitter.h" |
10 #include "SkTextureCompressor_Utils.h" | 10 #include "SkTextureCompressor_Utils.h" |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 // decides not to write certain scanlines (and skip entire rows of blocks). | 646 // decides not to write certain scanlines (and skip entire rows of blocks). |
647 // In the case of R11, we use the encoding from recognizing all zero pixels
from above. | 647 // In the case of R11, we use the encoding from recognizing all zero pixels
from above. |
648 const int nBlocks = (width * height / 16); // 4x4 pixel blocks. | 648 const int nBlocks = (width * height / 16); // 4x4 pixel blocks. |
649 uint64_t *dst = reinterpret_cast<uint64_t *>(outputBuffer); | 649 uint64_t *dst = reinterpret_cast<uint64_t *>(outputBuffer); |
650 for (int i = 0; i < nBlocks; ++i) { | 650 for (int i = 0; i < nBlocks; ++i) { |
651 *dst = 0x0020000000002000ULL; | 651 *dst = 0x0020000000002000ULL; |
652 ++dst; | 652 ++dst; |
653 } | 653 } |
654 | 654 |
655 return allocator->createT< | 655 return allocator->createT< |
656 SkTCompressedAlphaBlitter<4, 8, CompressorR11EAC>, int, int, void*> | 656 SkTCompressedAlphaBlitter<4, 8, CompressorR11EAC>>(width, height, output
Buffer); |
657 (width, height, outputBuffer); | |
658 } | 657 } |
659 | 658 |
660 void DecompressR11EAC(uint8_t* dst, int dstRowBytes, const uint8_t* src, int wid
th, int height) { | 659 void DecompressR11EAC(uint8_t* dst, int dstRowBytes, const uint8_t* src, int wid
th, int height) { |
661 for (int j = 0; j < height; j += 4) { | 660 for (int j = 0; j < height; j += 4) { |
662 for (int i = 0; i < width; i += 4) { | 661 for (int i = 0; i < width; i += 4) { |
663 decompress_r11_eac_block(dst + i, dstRowBytes, src); | 662 decompress_r11_eac_block(dst + i, dstRowBytes, src); |
664 src += 8; | 663 src += 8; |
665 } | 664 } |
666 dst += 4 * dstRowBytes; | 665 dst += 4 * dstRowBytes; |
667 } | 666 } |
668 } | 667 } |
669 | 668 |
670 } // namespace SkTextureCompressor | 669 } // namespace SkTextureCompressor |
OLD | NEW |