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

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

Issue 446103002: Pass compressed blitters to our mask drawing algorithm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix compiler error 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 | « src/gpu/GrSWMaskHelper.cpp ('k') | 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
11 #include "SkBitmapProcShader.h"
11 #include "SkImageInfo.h" 12 #include "SkImageInfo.h"
12 13
13 class SkBitmap; 14 class SkBitmap;
14 class SkBlitter; 15 class SkBlitter;
15 class SkData; 16 class SkData;
16 17
17 namespace SkTextureCompressor { 18 namespace SkTextureCompressor {
18 // Various texture compression formats that we support. 19 // Various texture compression formats that we support.
19 enum Format { 20 enum Format {
20 // Alpha only formats. 21 // Alpha only formats.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Returns true if successfully decompresses the src data. 67 // Returns true if successfully decompresses the src data.
67 bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t * src, 68 bool DecompressBufferFromFormat(uint8_t* dst, int dstRowBytes, const uint8_t * src,
68 int width, int height, Format format); 69 int width, int height, Format format);
69 70
70 // This typedef defines what the nominal aspects of a compression function 71 // This typedef defines what the nominal aspects of a compression function
71 // are. The typedef is not meant to be used by clients of the API, but rathe r 72 // are. The typedef is not meant to be used by clients of the API, but rathe r
72 // allows SIMD optimized compression functions to be implemented. 73 // allows SIMD optimized compression functions to be implemented.
73 typedef bool (*CompressionProc)(uint8_t* dst, const uint8_t* src, 74 typedef bool (*CompressionProc)(uint8_t* dst, const uint8_t* src,
74 int width, int height, int rowBytes); 75 int width, int height, int rowBytes);
75 76
77 // Returns true if there exists a blitter for the specified format.
78 inline bool ExistsBlitterForFormat(Format format) {
79 switch (format) {
80 case kLATC_Format:
81 case kR11_EAC_Format:
82 case kASTC_12x12_Format:
83 return true;
84
85 default:
86 return false;
87 }
88 }
89
76 // Returns the blitter for the given compression format. Note, the blitter 90 // Returns the blitter for the given compression format. Note, the blitter
77 // is intended to be used with the proper input. I.e. if you try to blit 91 // is intended to be used with the proper input. I.e. if you try to blit
78 // RGB source data into an R11 EAC texture, you're gonna have a bad time. 92 // RGB source data into an R11 EAC texture, you're gonna have a bad time.
79 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuf fer, 93 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuf fer,
80 Format format); 94 SkTBlitterAllocator *allocator, Format for mat);
81 95
82 // Returns the desired dimensions of the block size for the given format. Th ese dimensions 96 // Returns the desired dimensions of the block size for the given format. Th ese dimensions
83 // don't necessarily correspond to the specification's dimensions, since the re may 97 // don't necessarily correspond to the specification's dimensions, since the re may
84 // be specialized algorithms that operate on multiple blocks at once. If the 98 // be specialized algorithms that operate on multiple blocks at once. If the
85 // flag 'matchSpec' is true, then the actual dimensions from the specificati on are 99 // flag 'matchSpec' is true, then the actual dimensions from the specificati on are
86 // returned. If the flag is false, then these dimensions reflect the appropr iate operable 100 // returned. If the flag is false, then these dimensions reflect the appropr iate operable
87 // dimensions of the compression functions. 101 // dimensions of the compression functions.
88 void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec = false); 102 void GetBlockDimensions(Format format, int* dimX, int* dimY, bool matchSpec = false);
89 } 103 }
90 104
91 #endif 105 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/utils/SkTextureCompressor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698