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

Side by Side Diff: src/utils/SkTextureCompressor.h

Issue 432503002: Add initial pipeline for decompressors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Test robustness 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.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 #ifndef SkTextureCompressor_DEFINED 8 #ifndef SkTextureCompressor_DEFINED
9 #define SkTextureCompressor_DEFINED 9 #define SkTextureCompressor_DEFINED
10 10
(...skipping 26 matching lines...) Expand all
37 // calling unref() on the returned data. 37 // calling unref() on the returned data.
38 SkData* CompressBitmapToFormat(const SkBitmap& bitmap, Format format); 38 SkData* CompressBitmapToFormat(const SkBitmap& bitmap, Format format);
39 39
40 // Compresses the given src data into dst. The src data is assumed to be 40 // Compresses the given src data into dst. The src data is assumed to be
41 // large enough to hold width*height pixels. The dst data is expected to 41 // large enough to hold width*height pixels. The dst data is expected to
42 // be large enough to hold the compressed data according to the format. 42 // be large enough to hold the compressed data according to the format.
43 bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType sr cColorType, 43 bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType sr cColorType,
44 int width, int height, int rowBytes, Format form at, 44 int width, int height, int rowBytes, Format form at,
45 bool opt = true /* Use optimization if available */); 45 bool opt = true /* Use optimization if available */);
46 46
47 // Decompresses the given src data from the format specified into the
48 // destination buffer. The width and height of the data passed corresponds
49 // to the width and height of the uncompressed image. The destination buffer (dst)
50 // is assumed to be large enough to hold the entire decompressed image. The
51 // decompressed image colors are determined based on the passed format:
52 //
53 // LATC -> Alpha 8
54 // R11_EAC -> Alpha 8
55 // ASTC -> RGBA
56 //
57 // Note, CompressBufferToFormat compresses A8 data into ASTC. However,
58 // general ASTC data encodes RGBA data, so that is what the decompressor
59 // operates on.
60 //
61 // Returns true if successfully decompresses the src data.
62 bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t * src,
63 int width, int height, Format format);
64
47 // This typedef defines what the nominal aspects of a compression function 65 // This typedef defines what the nominal aspects of a compression function
48 // are. The typedef is not meant to be used by clients of the API, but rathe r 66 // are. The typedef is not meant to be used by clients of the API, but rathe r
49 // allows SIMD optimized compression functions to be implemented. 67 // allows SIMD optimized compression functions to be implemented.
50 typedef bool (*CompressionProc)(uint8_t* dst, const uint8_t* src, 68 typedef bool (*CompressionProc)(uint8_t* dst, const uint8_t* src,
51 int width, int height, int rowBytes); 69 int width, int height, int rowBytes);
52 70
53 // Returns the blitter for the given compression format. Note, the blitter 71 // Returns the blitter for the given compression format. Note, the blitter
54 // is intended to be used with the proper input. I.e. if you try to blit 72 // is intended to be used with the proper input. I.e. if you try to blit
55 // RGB source data into an R11 EAC texture, you're gonna have a bad time. 73 // RGB source data into an R11 EAC texture, you're gonna have a bad time.
56 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuf fer, 74 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuf fer,
57 Format format); 75 Format format);
58 76
59 // Returns the desired dimensions of the block size for the given format. Th ese dimensions 77 // Returns the desired dimensions of the block size for the given format. Th ese dimensions
60 // don't necessarily correspond to the hardware-specified dimensions, since there may 78 // don't necessarily correspond to the specification's dimensions, since the re may
61 // be specialized algorithms that operate on multiple blocks at once. These dimensions 79 // be specialized algorithms that operate on multiple blocks at once. If the
62 // reflect that optimization and return the appropriate operable dimensions. 80 // flag 'matchSpec' is true, then the actual dimensions from the specificati on are
63 void GetBlockDimensions(Format format, int* dimX, int* dimY); 81 // returned. If the flag is false, then these dimensions reflect the appropr iate operable
82 // dimensions of the compression functions.
83 void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec = false);
64 } 84 }
65 85
66 #endif 86 #endif
OLDNEW
« no previous file with comments | « no previous file | src/utils/SkTextureCompressor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698