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

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

Issue 456873003: Add BlitRect to SkTCompressedAlphaBlitter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Small nit 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
« no previous file with comments | « no previous file | src/utils/SkTextureCompressor_Blitter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ASTC.h" 8 #include "SkTextureCompressor_ASTC.h"
9 #include "SkTextureCompressor_Blitter.h" 9 #include "SkTextureCompressor_Blitter.h"
10 10
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 dst += data.fDimY * dstRowBytes; 1993 dst += data.fDimY * dstRowBytes;
1994 for (int y = 0; y < data.fDimY; ++y) { 1994 for (int y = 0; y < data.fDimY; ++y) {
1995 dst -= dstRowBytes; 1995 dst -= dstRowBytes;
1996 SkColor* colorPtr = reinterpret_cast<SkColor*>(dst); 1996 SkColor* colorPtr = reinterpret_cast<SkColor*>(dst);
1997 for (int x = 0; x < data.fDimX; ++x) { 1997 for (int x = 0; x < data.fDimX; ++x) {
1998 colorPtr[x] = data.getTexel(endpoints, texelWeights, x, y); 1998 colorPtr[x] = data.getTexel(endpoints, texelWeights, x, y);
1999 } 1999 }
2000 } 2000 }
2001 } 2001 }
2002 2002
2003 ////////////////////////////////////////////////////////////////////////////////
2004 //
2005 // ASTC Comrpession Struct
2006 //
2007 ////////////////////////////////////////////////////////////////////////////////
2008
2003 // This is the type passed as the CompressorType argument of the compressed 2009 // This is the type passed as the CompressorType argument of the compressed
2004 // blitter for the ASTC format. The static functions required to be in this 2010 // blitter for the ASTC format. The static functions required to be in this
2005 // struct are documented in SkTextureCompressor_Blitter.h 2011 // struct are documented in SkTextureCompressor_Blitter.h
2006 struct CompressorASTC { 2012 struct CompressorASTC {
2007 static inline void CompressA8Vertical(uint8_t* dst, const uint8_t* src) { 2013 static inline void CompressA8Vertical(uint8_t* dst, const uint8_t* src) {
2008 compress_a8_astc_block<GetAlphaTranspose>(&dst, src, 12); 2014 compress_a8_astc_block<GetAlphaTranspose>(&dst, src, 12);
2009 } 2015 }
2010 2016
2011 static inline void CompressA8Horizontal(uint8_t* dst, const uint8_t* src, 2017 static inline void CompressA8Horizontal(uint8_t* dst, const uint8_t* src,
2012 int srcRowBytes) { 2018 int srcRowBytes) {
2013 compress_a8_astc_block<GetAlpha>(&dst, src, srcRowBytes); 2019 compress_a8_astc_block<GetAlpha>(&dst, src, srcRowBytes);
2014 } 2020 }
2015 2021
2016 static inline void UpdateBlock(uint8_t* dst, const uint8_t* src) { 2022 #if PEDANTIC_BLIT_RECT
2023 static inline void UpdateBlock(uint8_t* dst, const uint8_t* src, int srcRowB ytes,
2024 const uint8_t* mask) {
2025 // TODO: krajcevski
2026 // This is kind of difficult for ASTC because the weight values are calc ulated
2027 // as an average of the actual weights. The best we can do is decompress the
2028 // weights and recalculate them based on the new texel values. This shou ld
2029 // be "not too bad" since we know that anytime we hit this function, we' re
2030 // compressing 12x12 block dimension alpha-only, and we know the layout
2031 // of the block
2032 SkFAIL("Implement me!");
2017 } 2033 }
2034 #endif
2018 }; 2035 };
2019 2036
2020 //////////////////////////////////////////////////////////////////////////////// 2037 ////////////////////////////////////////////////////////////////////////////////
2021 2038
2022 namespace SkTextureCompressor { 2039 namespace SkTextureCompressor {
2023 2040
2024 bool CompressA8To12x12ASTC(uint8_t* dst, const uint8_t* src, 2041 bool CompressA8To12x12ASTC(uint8_t* dst, const uint8_t* src,
2025 int width, int height, int rowBytes) { 2042 int width, int height, int rowBytes) {
2026 if (width < 0 || ((width % 12) != 0) || height < 0 || ((height % 12) != 0)) { 2043 if (width < 0 || ((width % 12) != 0) || height < 0 || ((height % 12) != 0)) {
2027 return false; 2044 return false;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 read_astc_block(&data, src); 2092 read_astc_block(&data, src);
2076 decompress_astc_block(reinterpret_cast<uint8_t*>(colorPtr + x), dstR owBytes, data); 2093 decompress_astc_block(reinterpret_cast<uint8_t*>(colorPtr + x), dstR owBytes, data);
2077 2094
2078 // ASTC encoded blocks are 16 bytes (128 bits) large. 2095 // ASTC encoded blocks are 16 bytes (128 bits) large.
2079 src += 16; 2096 src += 16;
2080 } 2097 }
2081 } 2098 }
2082 } 2099 }
2083 2100
2084 } // SkTextureCompressor 2101 } // SkTextureCompressor
OLDNEW
« no previous file with comments | « no previous file | src/utils/SkTextureCompressor_Blitter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698