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

Side by Side Diff: src/utils/SkTextureCompressor_R11EAC.cpp

Issue 446103002: Pass compressed blitters to our mask drawing algorithm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 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 10
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 #elif COMPRESS_R11_EAC_FASTEST 602 #elif COMPRESS_R11_EAC_FASTEST
603 603
604 return compress_a8_to_r11eac_fast(dst, src, width, height, rowBytes); 604 return compress_a8_to_r11eac_fast(dst, src, width, height, rowBytes);
605 605
606 #else 606 #else
607 #error "Must choose R11 EAC algorithm" 607 #error "Must choose R11 EAC algorithm"
608 #endif 608 #endif
609 } 609 }
610 610
611 SkBlitter* CreateR11EACBlitter(int width, int height, void* outputBuffer) { 611 SkBlitter* CreateR11EACBlitter(int width, int height, void* outputBuffer) {
612 if ((width % 4) != 0 || (height % 4) != 0) {
613 return NULL;
614 }
615
616 // Memset the output buffer to an encoding that decodes to zero...
robertphillips 2014/08/06 20:54:49 ASTC -> R11 ?
krajcevski 2014/08/06 22:42:00 Done.
617 // In the case of ASTC, if everything index is zero, then the interpolated v alue
618 // will decode to zero provided we have the right header. We use the encodin g
619 // from recognizing all zero blocks from above.
620 const int nBlocks = (width * height / 16);
621 uint64_t *dst = reinterpret_cast<uint64_t *>(outputBuffer);
622 for (int i = 0; i < nBlocks; ++i) {
623 *dst = 0x0020000000002000ULL;
624 ++dst;
625 }
626
612 return new 627 return new
613 SkTCompressedAlphaBlitter<4, 8, compress_block_vertical> 628 SkTCompressedAlphaBlitter<4, 8, compress_block_vertical>
614 (width, height, outputBuffer); 629 (width, height, outputBuffer);
615 } 630 }
616 631
617 void DecompressR11EAC(uint8_t* dst, int dstRowBytes, const uint8_t* src, int wid th, int height) { 632 void DecompressR11EAC(uint8_t* dst, int dstRowBytes, const uint8_t* src, int wid th, int height) {
618 for (int j = 0; j < height; j += 4) { 633 for (int j = 0; j < height; j += 4) {
619 for (int i = 0; i < width; i += 4) { 634 for (int i = 0; i < width; i += 4) {
620 decompress_r11_eac_block(dst + i, dstRowBytes, src); 635 decompress_r11_eac_block(dst + i, dstRowBytes, src);
621 src += 8; 636 src += 8;
622 } 637 }
623 dst += 4 * dstRowBytes; 638 dst += 4 * dstRowBytes;
624 } 639 }
625 } 640 }
626 641
627 } // namespace SkTextureCompressor 642 } // namespace SkTextureCompressor
OLDNEW
« src/utils/SkTextureCompressor_LATC.cpp ('K') | « src/utils/SkTextureCompressor_LATC.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698