57static void test_deleting_empty_picture() {
68static void test_serializing_empty_picture() {
85 }
else if (unit <= 0.6) {
88 }
else if (unit <= 0.9) {
113 , fSaveBehindCount(0)
143 unsigned int fSaveCount;
144 unsigned int fSaveLayerCount;
145 unsigned int fSaveBehindCount;
146 unsigned int fRestoreCount;
152 unsigned int numSaves,
unsigned int numSaveLayers,
153 unsigned int numRestores) {
175 recorder->partialReplay(canvas);
327 for (
int j = 0; j < 100; j++) {
332 for (
int i = 0;
i < 1000; ++
i) {
344 for (
int i = 0;
i < 100; ++
i) {
365 recordingCanvas->
drawImage(
nullptr, 0, 0);
523 test_deleting_empty_picture();
524 test_serializing_empty_picture();
535 const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f };
536 auto img =
bitmap.asImage();
560 dst.allocN32Pixels(10, 10);
593 canvas->
saveLayer(
nullptr, &semiTransparent);
618 void search(
const SkRect& query, std::vector<int>* results)
const override {
640 auto bbh = sk_make_sp<CountingBBH>();
650 SkCanvas big(640, 480), small(300, 200);
696 for (
int i = 0;
i < 3;
i++) {
760 SkRect cull = { 0,0, 10,20 };
789 auto data = pic->serialize();
805 {
true, [](
SkCanvas* c) { c->save(); c->restore(); } },
806 {
true, [](
SkCanvas* c) { c->save(); c->clipRect({0,0,5,5}); c->restore(); } },
807 {
true, [](
SkCanvas* c) { c->clipRect({0,0,5,5}); } },
810 {
false, [](
SkCanvas* c) { c->save(); c->drawRect({0,0,5,5},
SkPaint{}); c->restore(); } },
812 c->drawRect({0,0, 5, 5},
SkPaint{});
813 c->drawRect({5,5,10,10},
SkPaint{});
817 for (
const auto& c : cases) {
876 for (
int n = 0; n <= 2; n++) {
883 for (
int i = 0;
i < n;
i++) {
888 std::vector<int> results;
889 bbh->
search({0,0, 100,100}, &results);
891 "results.size() == %d, want %d\n", (
int)results.size(), n);
899 for (
int i = 0;
i < n;
i++) {
920 check(leaf10, 10, 10);
static void test_cull_rect_reset(skiatest::Reporter *reporter)
static void test_unbalanced_save_restores(skiatest::Reporter *reporter)
static void set_canvas_to_save_count_4(SkCanvas *canvas)
static void draw_bitmaps(const SkBitmap &bitmap, SkCanvas *canvas)
void check_save_state(skiatest::Reporter *reporter, SkPicture *picture, unsigned int numSaves, unsigned int numSaveLayers, unsigned int numRestores)
static void make_bm(SkBitmap *bm, int w, int h, SkColor color, bool immutable)
static void test_typeface(skiatest::Reporter *reporter)
static void rand_op(SkCanvas *canvas, SkRandom &rand)
static void test_draw_bitmaps(SkCanvas *canvas)
static void test_peephole()
static void create_imbalance(SkCanvas *canvas)
static void check_balance(skiatest::Reporter *reporter, SkPicture *picture)
DEF_TEST(PictureRecorder_replay, reporter)
static void test_gen_id(skiatest::Reporter *reporter)
static void test_bad_bitmap(skiatest::Reporter *reporter)
static void test_clip_bound_opt(skiatest::Reporter *reporter)
#define check(reporter, ref, unref, make, kill)
static sk_sp< SkPicture > make_pic(const std::function< void(SkCanvas *)> &drawer)
constexpr SkColor SK_ColorCYAN
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
#define SkScalarCeilToInt(x)
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
static constexpr uint32_t SK_InvalidGenID
#define REPORTER_ASSERT(r, cond,...)
void onClipRegion(const SkRegion &deviceRgn, SkClipOp op) override
void onClipRect(const SkRect &r, SkClipOp op, ClipEdgeStyle edgeStyle) override
unsigned getClipCount() const
void onClipRRect(const SkRRect &rrect, SkClipOp op, ClipEdgeStyle edgeStyle) override
void onClipPath(const SkPath &path, SkClipOp op, ClipEdgeStyle edgeStyle) override
ClipCountingCanvas(int width, int height)
void willRestore() override
bool onDoSaveBehind(const SkRect *subset) override
unsigned int getSaveCount() const
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec &rec) override
unsigned int getSaveLayerCount() const
unsigned int getRestoreCount() const
SaveCountingCanvas(int width, int height)
unsigned int getSaveBehindCount() const
virtual void search(const SkRect &query, std::vector< int > *results) const =0
sk_sp< SkImage > asImage() const
SkPixelRef * pixelRef() const
SkColor getColor(int x, int y) const
void allocN32Pixels(int width, int height, bool isOpaque=false)
bool setInfo(const SkImageInfo &imageInfo, size_t rowBytes=0)
void eraseColor(SkColor4f) const
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawRect(const SkRect &rect, 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)
SkRect getLocalClipBounds() const
void drawPaint(const SkPaint &paint)
virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec &)
virtual void onClipRect(const SkRect &rect, SkClipOp op, ClipEdgeStyle edgeStyle)
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
void clear(SkColor color)
virtual void willRestore()
void restoreToCount(int saveCount)
SkMatrix getTotalMatrix() const
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
SkIRect getDeviceClipBounds() const
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
virtual void onClipRRect(const SkRRect &rrect, SkClipOp op, ClipEdgeStyle edgeStyle)
virtual void onClipPath(const SkPath &path, SkClipOp op, ClipEdgeStyle edgeStyle)
virtual bool onDoSaveBehind(const SkRect *)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void drawPicture(const SkPicture *picture)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
virtual void onClipRegion(const SkRegion &deviceRgn, SkClipOp op)
std::unique_ptr< SkStreamAsset > detachAsStream()
static constexpr SkFontStyle Italic()
void setFillType(SkPathFillType ft)
SkPath & addOval(const SkRect &oval, SkPathDirection dir=SkPathDirection::kCW)
static const SkBigPicture * AsSkBigPicture(const sk_sp< const SkPicture > &picture)
static sk_sp< SkPicture > Copy(SkPictureRecorder *recorder)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPictureWithCull(const SkRect &cullRect)
SkCanvas * getRecordingCanvas()
sk_sp< SkPicture > finishRecordingAsPicture()
uint32_t uniqueID() const
sk_sp< SkData > serialize(const SkSerialProcs *procs=nullptr) const
virtual SkRect cullRect() const =0
static sk_sp< SkPicture > MakeFromData(const SkData *data, const SkDeserialProcs *procs=nullptr)
virtual void playback(SkCanvas *canvas, AbortCallback *callback=nullptr) const =0
static sk_sp< SkPicture > MakePlaceholder(SkRect cull)
static sk_sp< SkPicture > MakeFromStream(SkStream *stream, const SkDeserialProcs *procs=nullptr)
virtual int approximateOpCount(bool nested=false) const =0
static SkRect MakeLargest()
sk_sp< SkBBoxHierarchy > operator()() const override
SpoonFedBBHFactory(sk_sp< SkBBoxHierarchy > bbh)
EMSCRIPTEN_KEEPALIVE void empty()
Optional< SkRect > bounds
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
sk_sp< const SkPicture > picture
sk_sp< SkBlender > blender SkRect rect
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
font
Font Metadata and Metrics.
const myers::Point & get(const myers::Segment &)
SK_API sk_sp< PrecompileShader > Picture()
SkSamplingOptions(SkFilterMode::kLinear))
void search(const SkRect &query, std::vector< int > *results) const override
void insert(const SkRect[], int) override
size_t bytesUsed() const override
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
int32_t fLeft
smaller x-axis bounds
int32_t fRight
larger x-axis bounds
static SkImageInfo MakeN32Premul(int width, int height)
SkScalar fBottom
larger y-axis bounds
constexpr float left() const
constexpr float top() const
SkScalar fLeft
smaller x-axis bounds
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
SkScalar fRight
larger x-axis bounds
constexpr float height() const
constexpr float right() const
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
constexpr float bottom() const
SkScalar fTop
smaller y-axis bounds
std::shared_ptr< const fml::Mapping > data