Go to the source code of this file.
◆ PackUnpremulProc
typedef uint32_t(* PackUnpremulProc) (SkColor) |
◆ DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS()
Definition at line 118 of file PremulAlphaRoundTripTest.cpp.
121 {
123
127}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static void test_premul_alpha_roundtrip(skiatest::Reporter *reporter, SkSurface *surf)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
static SkImageInfo MakeN32Premul(int width, int height)
◆ DEF_TEST() [1/3]
DEF_TEST |
( |
PremulAlphaRoundTrip |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 111 of file PremulAlphaRoundTripTest.cpp.
111 {
113
115
117}
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
◆ DEF_TEST() [2/3]
DEF_TEST |
( |
PremulAlphaRoundTripGrConvertPixels |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 129 of file PremulAlphaRoundTripTest.cpp.
129 {
130
131
132
137
139 uint32_t* srcPixels = (uint32_t*)
src.addr();
140 for (
int y = 0;
y < 256; ++
y) {
141 for (
int x = 0;
x < 256; ++
x) {
143 }
144 }
145
148
151
154
157
158 auto get_pixel = [](
const GrPixmap& pm,
int x,
int y) {
159 const uint32_t*
addr = (
const uint32_t*)pm.
addr();
161 };
162 auto dump_pixel_history = [&](
int x,
int y) {
163 SkDebugf(
"Pixel history for (%d, %d):\n",
x,
y);
165 SkDebugf(
" -> : %08x\n", get_pixel(surf,
x,
y));
166 SkDebugf(
" <- : %08x\n", get_pixel(read1,
x,
y));
167 SkDebugf(
" -> : %08x\n", get_pixel(surf2,
x,
y));
168 SkDebugf(
" <- : %08x\n", get_pixel(read2,
x,
y));
169 };
170
171 bool success = true;
172 for (
int y = 0;
y < 256 && success; ++
y) {
173 const uint32_t* pixels1 = (
const uint32_t*) read1.
addr();
174 const uint32_t* pixels2 = (
const uint32_t*) read2.
addr();
175 for (
int x = 0;
x < 256 && success; ++
x) {
176 uint32_t c1 = pixels1[
y * 256 +
x],
177 c2 = pixels2[
y * 256 +
x];
178
179 if (c1 != c2) {
180 dump_pixel_history(
x,
y);
181 }
183 }
184 }
185}
bool GrConvertPixels(const GrPixmap &dst, const GrCPixmap &src, bool flipY)
static uint32_t pack_unpremul_rgba(SkColor c)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define REPORTER_ASSERT(r, cond,...)
static GrPixmap Allocate(const GrImageInfo &info)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
◆ DEF_TEST() [3/3]
DEF_TEST |
( |
PremulAlphaRoundTripSkConvertPixels |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 187 of file PremulAlphaRoundTripTest.cpp.
187 {
188
193
195 uint32_t* srcPixels =
src.getAddr32(0, 0);
196 for (
int y = 0;
y < 256; ++
y) {
197 for (
int x = 0;
x < 256; ++
x) {
199 }
200 }
201
204 src.info(),
src.getAddr(0, 0),
src.rowBytes()));
205 };
206
209
212
215
218
219 auto dump_pixel_history = [&](
int x,
int y) {
220 SkDebugf(
"Pixel history for (%d, %d):\n",
x,
y);
226 };
227
228 bool success = true;
229 for (
int y = 0;
y < 256 && success; ++
y) {
230 const uint32_t* pixels1 = read1.
getAddr32(0, 0);
231 const uint32_t* pixels2 = read2.
getAddr32(0, 0);
232 for (
int x = 0;
x < 256 && success; ++
x) {
233 uint32_t c1 = pixels1[
y * 256 +
x],
234 c2 = pixels2[
y * 256 +
x];
235
236 if (c1 != c2) {
237 dump_pixel_history(
x,
y);
238 }
240 }
241 }
242}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
bool SkConvertPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, const SkImageInfo &srcInfo, const void *srcPixels, size_t srcRB)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
uint32_t * getAddr32(int x, int y) const
static Editor::Movement convert(skui::Key key)
◆ fill_surface()
Definition at line 62 of file PremulAlphaRoundTripTest.cpp.
62 {
63
66
67 for (
int a = 0;
a < 256; ++
a) {
69 for (int r = 0; r < 256; ++r) {
71 }
72 }
73
76}
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
SkISize dimensions() const
void allocN32Pixels(int width, int height, bool isOpaque=false)
void writePixels(const SkPixmap &src, int dstX, int dstY)
◆ pack_unpremul_bgra()
static uint32_t pack_unpremul_bgra |
( |
SkColor |
c | ) |
|
|
static |
Definition at line 42 of file PremulAlphaRoundTripTest.cpp.
42 {
43 uint32_t packed;
44 uint8_t* byte = reinterpret_cast<uint8_t*>(&packed);
49 return packed;
50}
#define SkColorGetR(color)
#define SkColorGetG(color)
#define SkColorGetA(color)
#define SkColorGetB(color)
◆ pack_unpremul_rgba()
static uint32_t pack_unpremul_rgba |
( |
SkColor |
c | ) |
|
|
static |
Definition at line 32 of file PremulAlphaRoundTripTest.cpp.
32 {
33 uint32_t packed;
34 uint8_t* byte = reinterpret_cast<uint8_t*>(&packed);
39 return packed;
40}
◆ test_premul_alpha_roundtrip()
Definition at line 78 of file PremulAlphaRoundTripTest.cpp.
78 {
81
88
91
95
96 bool success = true;
97 for (
int y = 0;
y < 256 && success; ++
y) {
98 const uint32_t* pixels1 = readBmp1.
getAddr32(0,
y);
99 const uint32_t* pixels2 = readBmp2.
getAddr32(0,
y);
100 for (
int x = 0;
x < 256 && success; ++
x) {
101
102 if (pixels1[
x] != pixels2[
x]) {
103 SkDebugf(
"%x != %x, x = %d, y = %d\n", pixels1[
x], pixels2[
x],
x,
y);
104 }
106 }
107 }
108 }
109}
static void fill_surface(SkSurface *surf, SkColorType colorType, PackUnpremulProc proc)
const struct @436 gUnpremul[]
PackUnpremulProc fPackProc
void eraseColor(SkColor4f) const
bool readPixels(const SkPixmap &dst, int srcX, int srcY)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
◆ fColorType
◆ fPackProc
const struct { ... } gUnpremul[] |
Initial value:= {
}
static uint32_t pack_unpremul_bgra(SkColor c)
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word