34 uint8_t*
byte =
reinterpret_cast<uint8_t*
>(&packed);
44 uint8_t*
byte =
reinterpret_cast<uint8_t*
>(&packed);
67 for (
int a = 0;
a < 256; ++
a) {
69 for (
int r = 0; r < 256; ++r) {
79 for (
size_t upmaIdx = 0; upmaIdx < std::size(
gUnpremul); ++upmaIdx) {
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) {
102 if (pixels1[
x] != pixels2[
x]) {
103 SkDebugf(
"%x != %x, x = %d, y = %d\n", pixels1[
x], pixels2[
x],
x,
y);
139 uint32_t* srcPixels = (uint32_t*)src.addr();
140 for (
int y = 0;
y < 256; ++
y) {
141 for (
int x = 0;
x < 256; ++
x) {
158 auto get_pixel = [](
const GrPixmap& pm,
int x,
int y) {
159 const uint32_t* addr = (
const uint32_t*)pm.
addr();
160 return addr[
y * 256 +
x];
162 auto dump_pixel_history = [&](
int x,
int y) {
163 SkDebugf(
"Pixel history for (%d, %d):\n",
x,
y);
164 SkDebugf(
"Src : %08x\n", get_pixel(src,
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));
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];
180 dump_pixel_history(
x,
y);
194 SkBitmap src; src.allocPixels(upmInfo);
195 uint32_t* srcPixels = src.getAddr32(0, 0);
196 for (
int y = 0;
y < 256; ++
y) {
197 for (
int x = 0;
x < 256; ++
x) {
204 src.info(), src.getAddr(0, 0), src.rowBytes()));
219 auto dump_pixel_history = [&](
int x,
int y) {
220 SkDebugf(
"Pixel history for (%d, %d):\n",
x,
y);
221 SkDebugf(
"Src : %08x\n", *src.getAddr32(
x,
y));
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];
237 dump_pixel_history(
x,
y);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
bool GrConvertPixels(const GrPixmap &dst, const GrCPixmap &src, bool flipY)
static void test_premul_alpha_roundtrip(skiatest::Reporter *reporter, SkSurface *surf)
uint32_t(* PackUnpremulProc)(SkColor)
static void fill_surface(SkSurface *surf, SkColorType colorType, PackUnpremulProc proc)
static uint32_t pack_unpremul_bgra(SkColor c)
const struct @442 gUnpremul[]
static uint32_t pack_unpremul_rgba(SkColor c)
PackUnpremulProc fPackProc
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkAssertResult(cond)
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
#define SkColorGetR(color)
#define SkColorGetG(color)
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
#define SkColorGetA(color)
#define SkColorGetB(color)
bool SkConvertPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, const SkImageInfo &srcInfo, const void *srcPixels, size_t srcRB)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
#define DEF_TEST(name, reporter)
#define REPORTER_ASSERT(r, cond,...)
#define DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(name, reporter, context_info, ctsEnforcement)
static GrPixmap Allocate(const GrImageInfo &info)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
SkISize dimensions() const
void allocN32Pixels(int width, int height, bool isOpaque=false)
uint32_t * getAddr32(int x, int y) const
void eraseColor(SkColor4f) const
void writePixels(const SkPixmap &src, int dstX, int dstY)
bool readPixels(const SkPixmap &dst, int srcX, int srcY)
static Editor::Movement convert(skui::Key key)
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
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)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)