Debian Codegraph @

src/gpu/DataUtils.h

raw
1 /*
2 * Copyright 2024 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef skgpu_DataUtils_DEFINED
9 #define skgpu_DataUtils_DEFINED
10
11 #include "include/core/SkColor.h"
12 #include "include/core/SkSize.h"
13
14 #include <cstddef>
15
16 enum class SkTextureCompressionType;
17
18 namespace skgpu {
19
20 enum class Mipmapped : bool;
21
22 size_t NumCompressedBlocks(SkTextureCompressionType, SkISize baseDimensions);
23
24 // Returns a value that can be used to set rowBytes for a transfer function.
25 size_t CompressedRowBytes(SkTextureCompressionType, int w);
26
27 // Return the pixel dimensions of a compressed texture. The topmost levels
28 // of a compressed mipmapped texture (i.e., 1x1 or 2x2) still occupy a full
29 // block and thus objectively take up more pixels (e.g., 4x4 pixels for ETC1).
30 SkISize CompressedDimensions(SkTextureCompressionType, SkISize baseDimensions);
31
32 SkISize CompressedDimensionsInBlocks(SkTextureCompressionType, SkISize baseDimensions);
33
34 void FillInCompressedData(SkTextureCompressionType,
35 SkISize dimensions,
36 skgpu::Mipmapped,
37 char* dest,
38 const SkColor4f& color);
39
40 } // namespace skgpu
41
42 #endif // skgpu_DataUtils_DEFINED