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_LATC.h" | 8 #include "SkTextureCompressor_LATC.h" |
9 #include "SkTextureCompressor_Blitter.h" | 9 #include "SkTextureCompressor_Blitter.h" |
10 #include "SkTextureCompressor_Utils.h" | 10 #include "SkTextureCompressor_Utils.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 #if COMPRESS_LATC_FAST | 491 #if COMPRESS_LATC_FAST |
492 // Memset the output buffer to an encoding that decodes to zero. We must do
this | 492 // Memset the output buffer to an encoding that decodes to zero. We must do
this |
493 // in order to avoid having uninitialized values in the buffer if the blitte
r | 493 // in order to avoid having uninitialized values in the buffer if the blitte
r |
494 // decides not to write certain scanlines (and skip entire rows of blocks). | 494 // decides not to write certain scanlines (and skip entire rows of blocks). |
495 // In the case of LATC, if everything is zero, then LUM0 and LUM1 are also z
ero, | 495 // In the case of LATC, if everything is zero, then LUM0 and LUM1 are also z
ero, |
496 // and they will only be non-zero (0xFF) if the index is 7. So bzero will do
just fine. | 496 // and they will only be non-zero (0xFF) if the index is 7. So bzero will do
just fine. |
497 // (8 bytes per block) * (w * h / 16 blocks) = w * h / 2 | 497 // (8 bytes per block) * (w * h / 16 blocks) = w * h / 2 |
498 sk_bzero(outputBuffer, width * height / 2); | 498 sk_bzero(outputBuffer, width * height / 2); |
499 | 499 |
500 return allocator->createT< | 500 return allocator->createT< |
501 SkTCompressedAlphaBlitter<4, 8, CompressorLATC>, int, int, void* > | 501 SkTCompressedAlphaBlitter<4, 8, CompressorLATC>>(width, height, outputBu
ffer); |
502 (width, height, outputBuffer); | |
503 #elif COMPRESS_LATC_SLOW | 502 #elif COMPRESS_LATC_SLOW |
504 // TODO (krajcevski) | 503 // TODO (krajcevski) |
505 return nullptr; | 504 return nullptr; |
506 #endif | 505 #endif |
507 } | 506 } |
508 | 507 |
509 void DecompressLATC(uint8_t* dst, int dstRowBytes, const uint8_t* src, int width
, int height) { | 508 void DecompressLATC(uint8_t* dst, int dstRowBytes, const uint8_t* src, int width
, int height) { |
510 for (int j = 0; j < height; j += 4) { | 509 for (int j = 0; j < height; j += 4) { |
511 for (int i = 0; i < width; i += 4) { | 510 for (int i = 0; i < width; i += 4) { |
512 decompress_latc_block(dst + i, dstRowBytes, src); | 511 decompress_latc_block(dst + i, dstRowBytes, src); |
513 src += 8; | 512 src += 8; |
514 } | 513 } |
515 dst += 4 * dstRowBytes; | 514 dst += 4 * dstRowBytes; |
516 } | 515 } |
517 } | 516 } |
518 | 517 |
519 } // SkTextureCompressor | 518 } // SkTextureCompressor |
OLD | NEW |