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

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

Issue 2482683002: Use perfect forwarding in createT of SkSmallAllocator. (Closed)
Patch Set: Edits Created 4 years, 1 month 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 | « src/core/SkSmallAllocator.h ('k') | src/utils/SkTextureCompressor_LATC.cpp » ('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 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 // In the case of ASTC, if everything index is zero, then the interpolated v alue 2066 // In the case of ASTC, if everything index is zero, then the interpolated v alue
2067 // will decode to zero provided we have the right header. We use the encodin g 2067 // will decode to zero provided we have the right header. We use the encodin g
2068 // from recognizing all zero blocks from above. 2068 // from recognizing all zero blocks from above.
2069 const int nBlocks = (width * height / 144); 2069 const int nBlocks = (width * height / 144);
2070 uint8_t *dst = reinterpret_cast<uint8_t *>(outputBuffer); 2070 uint8_t *dst = reinterpret_cast<uint8_t *>(outputBuffer);
2071 for (int i = 0; i < nBlocks; ++i) { 2071 for (int i = 0; i < nBlocks; ++i) {
2072 send_packing(&dst, SkTEndian_SwapLE64(0x0000000001FE000173ULL), 0); 2072 send_packing(&dst, SkTEndian_SwapLE64(0x0000000001FE000173ULL), 0);
2073 } 2073 }
2074 2074
2075 return allocator->createT< 2075 return allocator->createT<
2076 SkTCompressedAlphaBlitter<12, 16, CompressorASTC>, int, int, void* > 2076 SkTCompressedAlphaBlitter<12, 16, CompressorASTC>>(width, height, output Buffer);
2077 (width, height, outputBuffer);
2078 } 2077 }
2079 2078
2080 void DecompressASTC(uint8_t* dst, int dstRowBytes, const uint8_t* src, 2079 void DecompressASTC(uint8_t* dst, int dstRowBytes, const uint8_t* src,
2081 int width, int height, int blockDimX, int blockDimY) { 2080 int width, int height, int blockDimX, int blockDimY) {
2082 // ASTC is encoded in what they call "raster order", so that the first 2081 // ASTC is encoded in what they call "raster order", so that the first
2083 // block is the bottom-left block in the image, and the first pixel 2082 // block is the bottom-left block in the image, and the first pixel
2084 // is the bottom-left pixel of the image 2083 // is the bottom-left pixel of the image
2085 dst += height * dstRowBytes; 2084 dst += height * dstRowBytes;
2086 2085
2087 ASTCDecompressionData data(blockDimX, blockDimY); 2086 ASTCDecompressionData data(blockDimX, blockDimY);
2088 for (int y = 0; y < height; y += blockDimY) { 2087 for (int y = 0; y < height; y += blockDimY) {
2089 dst -= blockDimY * dstRowBytes; 2088 dst -= blockDimY * dstRowBytes;
2090 SkColor *colorPtr = reinterpret_cast<SkColor*>(dst); 2089 SkColor *colorPtr = reinterpret_cast<SkColor*>(dst);
2091 for (int x = 0; x < width; x += blockDimX) { 2090 for (int x = 0; x < width; x += blockDimX) {
2092 read_astc_block(&data, src); 2091 read_astc_block(&data, src);
2093 decompress_astc_block(reinterpret_cast<uint8_t*>(colorPtr + x), dstR owBytes, data); 2092 decompress_astc_block(reinterpret_cast<uint8_t*>(colorPtr + x), dstR owBytes, data);
2094 2093
2095 // ASTC encoded blocks are 16 bytes (128 bits) large. 2094 // ASTC encoded blocks are 16 bytes (128 bits) large.
2096 src += 16; 2095 src += 16;
2097 } 2096 }
2098 } 2097 }
2099 } 2098 }
2100 2099
2101 } // SkTextureCompressor 2100 } // SkTextureCompressor
OLDNEW
« no previous file with comments | « src/core/SkSmallAllocator.h ('k') | src/utils/SkTextureCompressor_LATC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698