Flutter Engine
The Flutter Engine
GrImageInfo.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 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 GrImageInfo_DEFINED
9#define GrImageInfo_DEFINED
10
13#include "include/core/SkSize.h"
16
17#include <stddef.h>
18
19class SkColorSpace;
20struct SkImageInfo;
21
23public:
30
35
40 GrImageInfo makeWH(int width, int height) const;
41
42 const GrColorInfo& colorInfo() const { return fColorInfo; }
43
44 GrColorType colorType() const { return fColorInfo.colorType(); }
45
46 SkAlphaType alphaType() const { return fColorInfo.alphaType(); }
47
48 SkColorSpace* colorSpace() const { return fColorInfo.colorSpace(); }
49
51
52 SkISize dimensions() const { return fDimensions; }
53
54 int width() const { return fDimensions.width(); }
55
56 int height() const { return fDimensions.height(); }
57
58 size_t bpp() const { return GrColorTypeBytesPerPixel(this->colorType()); }
59
60 size_t minRowBytes() const { return this->bpp() * this->width(); }
61
62 bool isValid() const { return fColorInfo.isValid() && this->width() > 0 && this->height() > 0; }
63
64private:
65 GrColorInfo fColorInfo = {};
66 SkISize fDimensions;
67};
68
69#endif
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct)
Definition: GrTypesPriv.h:896
GrColorType
Definition: GrTypesPriv.h:540
SkAlphaType
Definition: SkAlphaType.h:26
bool isValid() const
Definition: GrColorInfo.h:48
SkColorSpace * colorSpace() const
Definition: GrColorInfo.cpp:48
GrColorType colorType() const
Definition: GrColorInfo.h:43
SkAlphaType alphaType() const
Definition: GrColorInfo.h:44
SkAlphaType alphaType() const
Definition: GrImageInfo.h:46
SkColorSpace * colorSpace() const
Definition: GrImageInfo.h:48
int width() const
Definition: GrImageInfo.h:54
GrImageInfo makeWH(int width, int height) const
Definition: GrImageInfo.cpp:54
GrImageInfo(GrImageInfo &&)
GrImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
Definition: GrImageInfo.cpp:46
GrImageInfo makeColorType(GrColorType ct) const
Definition: GrImageInfo.cpp:38
SkISize dimensions() const
Definition: GrImageInfo.h:52
GrImageInfo makeDimensions(SkISize dimensions) const
Definition: GrImageInfo.cpp:50
const GrColorInfo & colorInfo() const
Definition: GrImageInfo.h:42
sk_sp< SkColorSpace > refColorSpace() const
Definition: GrImageInfo.cpp:58
GrImageInfo & operator=(const GrImageInfo &)
GrColorType colorType() const
Definition: GrImageInfo.h:44
size_t bpp() const
Definition: GrImageInfo.h:58
int height() const
Definition: GrImageInfo.h:56
GrImageInfo & operator=(GrImageInfo &&)
bool isValid() const
Definition: GrImageInfo.h:62
GrImageInfo(const GrImageInfo &)
size_t minRowBytes() const
Definition: GrImageInfo.h:60
GrImageInfo makeAlphaType(SkAlphaType at) const
Definition: GrImageInfo.cpp:42
SkScalar w
SkScalar h
Definition: SkSize.h:16
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37