Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrDataUtils.h
Go to the documentation of this file.
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
13
14#include <array>
15#include <cstddef>
16
17class GrCPixmap;
18class GrImageInfo;
19class GrPixmap;
20struct SkISize;
21class 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.
27 size_t bytesPerPixel, SkISize baseDimensions,
28 skia_private::TArray<size_t>* individualMipOffsets, int mipLevelCount);
29
30bool GrConvertPixels(const GrPixmap& dst, const GrCPixmap& src, bool flipY = false);
31
32/** Clears the dst image to a constant color. */
33bool GrClearImage(const GrImageInfo& dstInfo, void* dst, size_t dstRB, std::array<float, 4> color);
34
35#if defined(GR_TEST_UTILS)
36/**
37 * BC1 compress an image that contains only either opaque black or transparent black and one
38 * other color.
39 * opaque pixmaps -> kBC1_RGB8_UNORM
40 * transparent pixmaps -> kBC1_RGBA8_UNORM
41 */
42void GrTwoColorBC1Compress(const SkPixmap& pixmap, SkColor otherColor, char* dstPixels);
43#endif
44
45#endif
size_t GrComputeTightCombinedBufferSize(size_t bytesPerPixel, SkISize baseDimensions, skia_private::TArray< size_t > *individualMipOffsets, int mipLevelCount)
bool GrConvertPixels(const GrPixmap &dst, const GrCPixmap &src, bool flipY=false)
bool GrClearImage(const GrImageInfo &dstInfo, void *dst, size_t dstRB, std::array< float, 4 > color)
SkColor4f color
uint32_t SkColor
Definition SkColor.h:37