52#if defined(SK_TEST_CANVAS_STATE_CROSS_LIBRARY)
55 "Support library to use for CanvasState test. Must be provided when"
56 " SK_TEST_CANVAS_STATE_CROSS_LIBRARY to specify the dynamically loaded library"
57 " that receives the captured canvas state. Functions from the library will be"
58 " called to test SkCanvasState. The library is built from the canvas_state_lib"
67 if (FLAGS_library.count() == 1) {
82 void* procAddress(
const char* funcName) {
104 SkDebugf(
"---- counter %d\n", counter);
106 name.printf(
"no_capture_%d.png", counter);
108 name.printf(
"capture_%d.png", counter);
120 if (memcmp(pm[0].
addr(0, 0), pm[1].
addr(0, 0), pm[0].computeByteSize()) != 0) {
126 const int WIDTH = 400;
128 const int SPACER = 10;
138 const int layerAlpha[] = { 255, 255, 0 };
141 float r,
float b, int32_t
s);
143#if defined(SK_TEST_CANVAS_STATE_CROSS_LIBRARY)
144 OpenLibResult openLibResult(
reporter);
145 *(
void**) (&drawFn) = openLibResult.procAddress(
"complex_layers_draw_from_canvas_state");
157 for (
int j = 0; j < 2; ++j) {
160 SkCanvas* canvas = surf->getCanvas();
164 for (
size_t k = 0; k <
std::size(layerAlpha); ++k) {
166 if (layerAlpha[k] != 0xFF) {
167 paint.init()->setAlpha(layerAlpha[k]);
196 images[j] = surf->makeImageSnapshot();
206 const int WIDTH = 400;
208 const int SPACER = 10;
211 layerRect.
inset(2*SPACER, 2*SPACER);
220 SkIRect regionInterior = regionBounds;
221 regionInterior.
inset(SPACER*3, SPACER*3);
224 clipRegion.
setRect(regionBounds);
234 int32_t r, int32_t
b, int32_t clipOp,
235 int32_t regionRects, int32_t* rectCoords);
237#if defined(SK_TEST_CANVAS_STATE_CROSS_LIBRARY)
238 OpenLibResult openLibResult(
reporter);
239 *(
void**) (&drawFn) = openLibResult.procAddress(
"complex_clips_draw_from_canvas_state");
250 for (
int i = 0;
i < 2; ++
i) {
252 SkCanvas* canvas = surf->getCanvas();
260 for (
size_t j = 0; j <
std::size(clipOps); ++j) {
279 rectCoords.
size() / 4, rectCoords.
begin());
295 images[
i] = surf->makeImageSnapshot();
305 bitmap.allocN32Pixels(10, 10);
318 const int WIDTH = 100;
320 const int LAYER_WIDTH = 50;
321 const int LAYER_HEIGHT = 50;
bool complex_layers_draw_from_canvas_state(SkCanvasState *state, float left, float top, float right, float bottom, int32_t spacer)
void complex_layers_draw(SkCanvas *canvas, float left, float top, float right, float bottom, int32_t spacer)
bool complex_clips_draw_from_canvas_state(SkCanvasState *state, int32_t left, int32_t top, int32_t right, int32_t bottom, int32_t clipOp, int32_t regionRects, int32_t *rectCoords)
void complex_clips_draw(SkCanvas *canvas, int32_t left, int32_t top, int32_t right, int32_t bottom, int32_t clipOp, const SkRegion &localRegion)
static void write_image(const SkImage *img, const char path[])
DEF_TEST(CanvasState_test_complex_layers, reporter)
static void compare(skiatest::Reporter *reporter, SkImage *img0, SkImage *img1)
#define DEFINE_string(name, defaultValue, helpString)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
constexpr SkColor SK_ColorRED
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
void * SkGetProcedureAddress(void *library, const char *functionName)
void * SkLoadDynamicLibrary(const char *libraryName)
bool SkFreeDynamicLibrary(void *library)
#define REPORTER_ASSERT(r, cond,...)
static SkCanvasState * CaptureCanvasState(SkCanvas *canvas)
static void ReleaseCanvasState(SkCanvasState *state)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void translate(SkScalar dx, SkScalar dy)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
virtual bool isClipRect() const
SkIRect getDeviceClipBounds() const
void clipRRect(const SkRRect &rrect, SkClipOp op, bool doAntiAlias)
bool write(const void *buffer, size_t size) override
bool peekPixels(SkPixmap *pixmap) const
void setOval(const SkRect &oval)
const SkIRect & rect() const
void translate(int dx, int dy)
@ kIntersect_Op
target intersected with operand
@ kDifference_Op
target minus operand
bool op(const SkIRect &rect, Op op)
bool setRect(const SkIRect &rect)
std::array< MockImage, 3 > images
SK_API bool Encode(SkWStream *dst, const SkPixmap &src, const Options &options)
Optional< SkRect > bounds
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
sk_sp< SkBlender > blender SkRect rect
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
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
const myers::Point & get(const myers::Segment &)
void inset(int32_t dx, int32_t dy)
constexpr int32_t height() const
constexpr int32_t width() const
void offset(int32_t dx, int32_t dy)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)
std::shared_ptr< const fml::Mapping > data