| 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/base/SkTArray.h" |
| 13 |
|
| 14 |
#include <array> |
| 15 |
#include <cstddef> |
| 16 |
|
| 17 |
class GrCPixmap; |
| 18 |
class GrImageInfo; |
| 19 |
class GrPixmap; |
| 20 |
struct SkISize; |
| 21 |
class SkPixmap; |
| 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( |
| 27 |
size_t bytesPerPixel, SkISize baseDimensions, |
| 28 |
skia_private::TArray<size_t>* individualMipOffsets, int mipLevelCount); |
| 29 |
|
| 30 |
bool GrConvertPixels(const GrPixmap& dst, const GrCPixmap& src, bool flipY = false); |
| 31 |
|
| 32 |
/** Clears the dst image to a constant color. */ |
| 33 |
bool GrClearImage(const GrImageInfo& dstInfo, void* dst, size_t dstRB, std::array<float, 4> color); |
| 34 |
|
| 35 |
#endif |