Robert Phillips | 459b295 | 2019-05-23 09:38:27 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 Google Inc. |
| 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 GrDataUtils_DEFINED |
| 9 | #define GrDataUtils_DEFINED |
| 10 | |
| 11 | #include "include/core/SkColor.h" |
| 12 | #include "include/private/GrTypesPriv.h" |
| 13 | |
Robert Phillips | 8043f32 | 2019-05-31 08:11:36 -0400 | [diff] [blame] | 14 | // TODO: consolidate all the backend-specific flavors of this method to this |
| 15 | size_t GrETC1CompressedDataSize(int w, int h); |
Robert Phillips | 459b295 | 2019-05-23 09:38:27 -0400 | [diff] [blame] | 16 | |
Robert Phillips | 28a5a43 | 2019-06-07 12:46:21 -0400 | [diff] [blame^] | 17 | // TODO: should this be grown into a replacement for GrPixelConfig? |
| 18 | enum class GrCompression { |
| 19 | kNone, |
| 20 | kETC1, |
| 21 | }; |
| 22 | |
| 23 | // Compute the size of the buffer required to hold all the mipLevels of the specified type |
| 24 | // of data when all rowBytes are tight. |
| 25 | // Note there may still be padding between the mipLevels to meet alignment requirements. |
| 26 | size_t GrComputeTightCombinedBufferSize(GrCompression, size_t bytesPerPixel, |
| 27 | int baseWidth, int baseHeight, |
| 28 | SkTArray<size_t>* individualMipOffsets, |
| 29 | int mipLevelCount); |
| 30 | |
| 31 | void GrFillInData(GrCompression, GrPixelConfig, |
| 32 | int baseWidth, int baseHeight, |
| 33 | const SkTArray<size_t>& individualMipOffsets, |
| 34 | char* dest, const SkColor4f& color); |
Robert Phillips | 459b295 | 2019-05-23 09:38:27 -0400 | [diff] [blame] | 35 | |
| 36 | #endif |