29#include <initializer_list>
57 const int width = 0x40000001;
58 const int height = 0x00000096;
72 const size_t explicitRowBytes =
info.minRowBytes() + 24;
124 for (
int rowBytesPadding = 1; rowBytesPadding <= 17; rowBytesPadding++) {
190 uint8_t pixelData[4];
236 ERRORF(r,
"SkBitmap::copy failed %d", (
int)ct);
289 for (
unsigned i = 0;
i < 0x100; ++
i) {
360 bool (*pred)(
float expected,
float actual),
SkColorType ct) {
365 for (
int y = 0;
y < 16; ++
y) {
366 for (
int x = 0;
x < 16; ++
x) {
367 float expected = alpha / 255.0f;
369 if (!pred(expected, actual)) {
378static bool unit_compare(
float expected,
float actual,
float tol = 1.0f/(1<<12)) {
379 SkASSERT(expected >= 0 && expected <= 1);
380 SkASSERT( actual >= 0 && actual <= 1);
381 if (expected == 0 || expected == 1) {
382 return actual == expected;
403 for (
int y = 0;
y < 16; ++
y) {
404 for (
int x = 0;
x < 16; ++
x) {
409 auto nearly = [](
float expected,
float actual) ->
bool {
412 auto nearly4bit = [](
float expected,
float actual) ->
bool {
416 auto nearly2bit = [](
float expected,
float actual) ->
bool {
420 auto opaque = [](
float expected,
float actual) ->
bool {
421 return actual == 1.0f;
424 auto nearly_half = [](
float expected,
float actual) ->
bool {
454 for (
const auto& rec : recs) {
473 const size_t big_rb = 1 << 16;
477 size_t rowbytes, expected_size;
480 { 0, 2, big_rb, big_rb },
483 for (
const auto& r : rec) {
486 size_t size =
info.computeByteSize(r.rowbytes);
static void test_peekpixels(skiatest::Reporter *reporter)
static bool unit_compare(float expected, float actual, float tol=1.0f/(1<< 12))
static void check_alphas(skiatest::Reporter *reporter, const SkBitmap &bm, bool(*pred)(float expected, float actual), SkColorType ct)
static void test_bigwidth(skiatest::Reporter *reporter)
static float unit_discretize(float value, float scale)
static void test_erasecolor_premul(skiatest::Reporter *reporter, SkColorType ct, SkColor input, SkColor expected)
DEF_TEST(Bitmap, reporter)
static void test_bigalloc(skiatest::Reporter *reporter)
static void test_allocpixels(skiatest::Reporter *reporter)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
sk_bzero(glyphs, sizeof(glyphs))
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
@ kR8G8_unorm_SkColorType
pixel with a uint8_t for red and green
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kRGB_101010x_SkColorType
pixel with 10 bits each for red, green, blue; in 32-bit word
@ kLastEnum_SkColorType
last valid value
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
@ kA16_float_SkColorType
pixel with a half float for alpha
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
@ kRGBA_1010102_SkColorType
10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
@ kRGBA_F16Norm_SkColorType
pixel with half floats in [0,1] for red, green, blue, alpha;
@ kR16G16_float_SkColorType
pixel with a half float for red and green
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
#define SkColorGetA(color)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SK_API bool SkColorTypeIsAlwaysOpaque(SkColorType ct)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static constexpr bool SkToBool(const T &x)
#define REPORTER_ASSERT(r, cond,...)
#define INFOF(REPORTER,...)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
SkColor getColor(int x, int y) const
size_t computeByteSize() const
const SkPixmap & pixmap() const
SkColor4f getColor4f(int x, int y) const
void setColorSpace(sk_sp< SkColorSpace > colorSpace)
const SkImageInfo & info() const
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
float getAlphaf(int x, int y) const
void allocN32Pixels(int width, int height, bool isOpaque=false)
bool peekPixels(SkPixmap *pixmap) const
bool setInfo(const SkImageInfo &imageInfo, size_t rowBytes=0)
static bool ComputeIsOpaque(const SkBitmap &bm)
uint32_t * getAddr32(int x, int y) const
void setPixelRef(sk_sp< SkPixelRef > pixelRef, int dx, int dy)
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
void eraseColor(SkColor4f) const
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeSRGBLinear()
SkColor getColor(int x, int y) const
bool erase(SkColor color, const SkIRect &subset) const
const SkImageInfo & info() const
const void * addr() const
SK_API sk_sp< SkPixelRef > MakeAllocate(const SkImageInfo &, size_t rowBytes)
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
SIN Vec< N, float > floor(const Vec< N, float > &x)
static SkImageInfo MakeN32Premul(int width, int height)
size_t minRowBytes() const
int bytesPerPixel() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkImageInfo makeColorType(SkColorType newColorType) const
static SkImageInfo MakeA8(int width, int height)