36 const float K = 0.01f;
37 return fabsf(
x.fR -
y.fR) <
K
38 && fabsf(
x.fG -
y.fG) <
K
39 && fabsf(
x.fB -
y.fB) <
K
40 && fabsf(
x.fA -
y.fA) <
K;
44 return SkStringPrintf(
"%.2g %.2g %.2g %.2g", c.fR, c.fG, c.fB, c.fA);
78 memcpy(&pixel, bm.
getAddr(0,0),
sizeof(pixel));
83 for (
int i = 0;
i < 4; ++
i) {
84 expected[
i] =
SkTPin(expected[
i], 0.0f, 1.0f);
104 {
"Expected:", expected},
109 for (
auto l :
lines) {
122 p.setColor4f(c, p3.get());
123 return p.getColor4f();
129 paint.setColor4f({1,0,0,1}, p3.get());
131 canvas->drawRect({10,10,70,70},
paint);
134 {1,0,0,1}, p3.get());
137 canvas->translate(0,80);
145 paint.setColor4f({1,0,0,1}, p3.get());
148 canvas->drawImage(bm.
asImage(), 10,10);
151 {1,0,0,1}, p3.get());
154 canvas->translate(0,80);
168 canvas->drawRect({10,10,70,70},
paint);
172 {1,0,0,1}, p3.get());
174 canvas->translate(180, 0);
178 {0,1,0,1}, p3.get());
182 canvas->translate(0,80);
197 canvas->drawRect({10,10,70,70},
paint);
201 {1,0,0,1}, p3.get());
203 canvas->translate(180, 0);
207 {0,1,0,1}, p3.get());
211 canvas->translate(0,80);
223 canvas->drawRect({10,10,70,70},
paint);
227 {1,0,0,1}, p3.get());
229 canvas->translate(180, 0);
233 {0,1,0,1}, p3.get());
237 canvas->translate(0,80);
252 canvas->drawRect({10,10,70,70},
paint);
256 {1,0,0,1}, p3.get());
258 canvas->translate(180, 0);
262 {0,1,0,1}, p3.get());
266 canvas->translate(0,80);
271 SkColor4f colors[] = { {0,0,1,1}, {0,1,0,1}, {1,0,0,1} };
280 canvas->drawRect({10,10,70,70},
paint);
284 {0,0,1,1}, p3.get());
286 canvas->translate(180, 0);
290 {1,0,0,1}, p3.get());
294 canvas->translate(0,80);
299 for (
int i = 0;
i < 256;
i++) {
317 {1,0,0,1}, p3.get());
319 canvas->translate(0, 80);
322 canvas->translate(10,10);
323 canvas->drawRect({0,0,16,16}, as_shader);
327 {1,0,0,1}, p3.get());
329 canvas->translate(0,80);
331 canvas->drawImageRect(bm.
asImage(), {10,10,70,70},
sampling, &as_bitmap);
334 {1,0,0,1}, p3.get());
336 canvas->translate(0,80);
339 canvas->translate(10,10);
340 canvas->scale(3.75,3.75);
341 canvas->drawRect({0,0,16,16}, as_shader);
345 {1,0,0,1}, p3.get());
359 paint.setAntiAlias(
true);
360 paint.setColor4f({ 1,0,0,1 }, p3.get());
362 canvas->drawCircle(40, 40, 30,
paint);
365 { 1,0,0,1 }, p3.get());
368 canvas->translate(0, 80);
373 paint.setAntiAlias(
true);
374 paint.setColor4f({ 1,0,0,1 }, p3.get());
376 canvas->drawOval({ 20,10,60,70 },
paint);
379 { 1,0,0,1 }, p3.get());
382 canvas->translate(0, 80);
387 paint.setAntiAlias(
true);
388 paint.setColor4f({ 1,0,0,1 }, p3.get());
390 float intervals[] = { 70, 10 };
392 paint.setStrokeWidth(10);
394 canvas->drawCircle(40, 40, 30,
paint);
397 { 1,0,0,1 }, p3.get());
400 canvas->translate(0, 80);
405 paint.setAntiAlias(
true);
406 paint.setColor4f({ 1,0,0,1 }, p3.get());
409 canvas->translate(40, 40);
411 canvas->drawOval({ -20,-30,20,30 },
paint);
415 { 1,0,0,1 }, p3.get());
418 canvas->translate(0, 80);
static const int points[]
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_F16_SkColorType
pixel with half floats for red, green, blue, alpha;
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
static bool SkColorTypeIsNormalized(SkColorType ct)
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
sk_sp< SkImage > asImage() const
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
void * getAddr(int x, int y) const
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
void translate(SkScalar dx, SkScalar dy)
SkMatrix getTotalMatrix() const
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
SkImageInfo imageInfo() const
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY)
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
@ kInterpolateColorsInPremul_Flag
@ kStroke_Style
set to stroke geometry
void setColor4f(const SkColor4f &color, SkColorSpace *colorSpace=nullptr)
void setShader(sk_sp< SkShader > shader)
const char * c_str() const
void MarkGMGood(SkCanvas *canvas, SkScalar x, SkScalar y)
void MarkGMBad(SkCanvas *canvas, SkScalar x, SkScalar y)
static constexpr skcms_Matrix3x3 kDisplayP3
static constexpr skcms_TransferFunction kSRGB
PODArray< SkColor > colors
SkSamplingOptions sampling
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
font
Font Metadata and Metrics.
static bool nearly_equal(SkColor4f x, SkColor4f y)
DEF_SIMPLE_GM(p3, canvas, 450, 1300)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
static SkString fmt(SkColor4f c)
static void compare_pixel(const char *label, SkCanvas *canvas, int x, int y, SkColor4f color, SkColorSpace *cs)
sk_sp< SkColorSpace > refColorSpace() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
SkColorType colorType() const
static SkImageInfo MakeA8(int width, int height)