Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
unexpected_setAlphaType.cpp File Reference
#include "include/core/SkColorType.h"
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (unexpected_setAlphaType, 256, 256, true, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( unexpected_setAlphaType  ,
256  ,
256  ,
true  ,
 
)

Definition at line 5 of file unexpected_setAlphaType.cpp.

5 {
6static const char* alphatype_name(SkAlphaType at) {
7 switch (at) {
8 case kUnknown_SkAlphaType: return "Unknown";
9 case kOpaque_SkAlphaType: return "Opaque";
10 case kPremul_SkAlphaType: return "Premul";
11 case kUnpremul_SkAlphaType: return "Unpremul";
12 }
13 SkASSERT(false);
14 return "unexpected alphatype";
15}
16static const char* colortype_name(SkColorType ct) {
17 switch (ct) {
18 case kUnknown_SkColorType: return "Unknown";
19 case kAlpha_8_SkColorType: return "Alpha_8";
20 case kA16_unorm_SkColorType: return "Alpha_16";
21 case kA16_float_SkColorType: return "A16_float";
22 case kRGB_565_SkColorType: return "RGB_565";
23 case kARGB_4444_SkColorType: return "ARGB_4444";
24 case kRGBA_8888_SkColorType: return "RGBA_8888";
25 case kSRGBA_8888_SkColorType: return "SRGBA_8888";
26 case kRGB_888x_SkColorType: return "RGB_888x";
27 case kBGRA_8888_SkColorType: return "BGRA_8888";
28 case kRGBA_1010102_SkColorType: return "RGBA_1010102";
29 case kRGB_101010x_SkColorType: return "RGB_101010x";
30 case kBGRA_1010102_SkColorType: return "BGRA_1010102";
31 case kBGR_101010x_SkColorType: return "BGR_101010x";
32 case kBGR_101010x_XR_SkColorType: return "BGR_101010x_xr";
33 case kBGRA_10101010_XR_SkColorType: return "BGRA_10101010_xr";
34 case kRGBA_10x6_SkColorType: return "RGBA_10x6";
35 case kGray_8_SkColorType: return "Gray_8";
36 case kRGBA_F16Norm_SkColorType: return "RGBA_F16Norm";
37 case kRGBA_F16_SkColorType: return "RGBA_F16";
38 case kRGBA_F32_SkColorType: return "RGBA_F32";
39 case kR8G8_unorm_SkColorType: return "R8G8_unorm";
40 case kR16G16_unorm_SkColorType: return "R16G16_unorm";
41 case kR16G16_float_SkColorType: return "R16G16_float";
42 case kR16G16B16A16_unorm_SkColorType: return "R16G16B16A16_unorm";
43 case kR8_unorm_SkColorType: return "R8_unorm";
44 }
45 SkASSERT(false);
46 return "unexpected colortype";
47}
48void draw(SkCanvas* canvas) {
49 static const SkAlphaType kAlphaTypes[] =
51 static const SkColorType kColorTypes[] =
57 SkDebugf("%16s Canonical Unknown Opaque Premul "
58 "Unpremul\n", " ");
59 for (SkColorType colorType : kColorTypes) {
60 for (SkAlphaType canonicalAlphaType : kAlphaTypes) {
62 SkDebugf("%15s %10s ", colortype_name(colorType), alphatype_name(canonicalAlphaType));
63 for (SkAlphaType alphaType : kAlphaTypes) {
64 bitmap.setInfo(SkImageInfo::Make(4, 4, colorType, canonicalAlphaType));
65 bool result = bitmap.setAlphaType(alphaType);
66 SkDebugf("%s %s ", result ? "true " : "false",
67 alphatype_name(bitmap.alphaType()));
68 }
69 SkDebugf("\n");
70 }
71 }
72}
73} // END FIDDLE
kUnpremul_SkAlphaType
SkAlphaType
Definition SkAlphaType.h:26
@ kUnknown_SkAlphaType
uninitialized
Definition SkAlphaType.h:27
@ kOpaque_SkAlphaType
pixel is opaque
Definition SkAlphaType.h:28
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
#define SkASSERT(cond)
Definition SkAssert.h:116
SkColorType
Definition SkColorType.h:19
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
Definition SkColorType.h:50
@ kRGBA_10x6_SkColorType
pixel with 10 used bits (most significant) followed by 6 unused
Definition SkColorType.h:33
@ kR8_unorm_SkColorType
Definition SkColorType.h:54
@ kBGR_101010x_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word
Definition SkColorType.h:30
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
Definition SkColorType.h:23
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
Definition SkColorType.h:43
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition SkColorType.h:26
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
Definition SkColorType.h:48
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
Definition SkColorType.h:38
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
Definition SkColorType.h:21
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:29
@ kSRGBA_8888_SkColorType
Definition SkColorType.h:53
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition SkColorType.h:35
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition SkColorType.h:22
@ kBGRA_10101010_XR_SkColorType
pixel with 10 bits each for blue, green, red, alpha; in 64-bit word, extended range
Definition SkColorType.h:32
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition SkColorType.h:24
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition SkColorType.h:25
@ kBGRA_1010102_SkColorType
10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
Definition SkColorType.h:28
@ kA16_float_SkColorType
pixel with a half float for alpha
Definition SkColorType.h:45
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
Definition SkColorType.h:40
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
Definition SkColorType.h:27
@ kBGR_101010x_XR_SkColorType
pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
Definition SkColorType.h:31
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
Definition SkColorType.h:49
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
Definition SkColorType.h:36
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
@ kR16G16_float_SkColorType
pixel with a half float for red and green
Definition SkColorType.h:46
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
SK_API bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, SkAlphaType *canonical=nullptr)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
GAsyncResult * result
const char * colortype_name(SkColorType ct)
Definition ToolUtils.cpp:65
const char * alphatype_name(SkAlphaType at)
Definition ToolUtils.cpp:55
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)