blob: b79e84c18dd303d909d075be7d4bcc349c4e1ed7 [file] [log] [blame]
Robert Phillips459b2952019-05-23 09:38:27 -04001/*
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 Phillips8043f322019-05-31 08:11:36 -040014// TODO: consolidate all the backend-specific flavors of this method to this
15size_t GrETC1CompressedDataSize(int w, int h);
Robert Phillips459b2952019-05-23 09:38:27 -040016
Robert Phillips28a5a432019-06-07 12:46:21 -040017// TODO: should this be grown into a replacement for GrPixelConfig?
18enum 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.
26size_t GrComputeTightCombinedBufferSize(GrCompression, size_t bytesPerPixel,
27 int baseWidth, int baseHeight,
28 SkTArray<size_t>* individualMipOffsets,
29 int mipLevelCount);
30
31void GrFillInData(GrCompression, GrPixelConfig,
32 int baseWidth, int baseHeight,
33 const SkTArray<size_t>& individualMipOffsets,
34 char* dest, const SkColor4f& color);
Robert Phillips459b2952019-05-23 09:38:27 -040035
36#endif