33static const int W = 1920,
H = 1080;
39 bool abort()
override {
return fCalls++ > 0; }
59 assert_type<SkRecords::DrawPaint>(r, record, 0);
60 assert_type<SkRecords::Save> (r, record, 1);
61 assert_type<SkRecords::Scale> (r, record, 2);
62 assert_type<SkRecords::Restore> (r, record, 3);
84 REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecord));
85 REPORTER_ASSERT(r, 0 == count_instances_of_type<SkRecords::ClipRect>(rerecord));
96 SkRecordDraw(record, &canvas,
nullptr,
nullptr, 0,
nullptr,
nullptr);
98 int save_count = count_instances_of_type<SkRecords::Save>(rerecord);
99 int restore_count = count_instances_of_type<SkRecords::Save>(rerecord);
108 scale.setScale(2, 3);
118 SkRecordDraw(scaleRecord, &translateCanvas,
nullptr,
nullptr, 0,
nullptr,
nullptr);
120 assert_type<SkRecords::SetM44>(r, translateRecord, 0);
121 assert_type<SkRecords::Save> (r, translateRecord, 1);
122 assert_type<SkRecords::SetM44>(r, translateRecord, 2);
123 assert_type<SkRecords::Restore> (r, translateRecord, 3);
127 const SkRecords::SetM44* setMatrix;
128 setMatrix = assert_type<SkRecords::SetM44>(r, translateRecord, 0);
131 setMatrix = assert_type<SkRecords::SetM44>(r, translateRecord, 2);
147DEF_TEST(RecordDraw_BasicBounds, r) {
152 recorder.scale(2, 2);
159 for (
int i = 0;
i < record.
count();
i++) {
170DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) {
237DEF_TEST(RecordDraw_SaveLayerBoundsAffectsClipBounds, r) {
245 recorder.saveLayer(&layerBounds, &
p);
258 class SkCanvasMock :
public SkCanvas {
261 this->resetTestValues();
264 void resetTestValues() {
265 fDrawImageCalled = fDrawImageRectCalled =
false;
268 bool fDrawImageCalled;
269 bool fDrawImageRectCalled;
276 SkCanvasMock canvas(10, 10);
static bool sloppy_rect_eq(SkRect a, SkRect b)
DEF_TEST(RecordDraw_LazySaves, r)
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
void SkRecordFillBounds(const SkRect &cullRect, const SkRecord &record, SkRect bounds[], SkBBoxHierarchy::Metadata meta[])
void SkRecordDraw(const SkRecord &record, SkCanvas *canvas, SkPicture const *const drawablePicts[], SkDrawable *const drawables[], int drawableCount, const SkBBoxHierarchy *bbh, SkPicture::AbortCallback *callback)
#define REPORTER_ASSERT(r, cond,...)
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)
void setMatrix(const SkM44 &matrix)
void scale(SkScalar sx, SkScalar sy)
static sk_sp< SkImageFilter > DropShadow(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor color, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
SkMatrix & postConcat(const SkMatrix &other)
SkMatrix & setTranslate(SkScalar dx, SkScalar dy)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Optional< SkRect > bounds
sk_sp< const SkImage > image
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static SkRect inset(const SkRect &r)
static SkImageInfo MakeN32Premul(int width, int height)
void inset(float dx, float dy)
bool contains(SkScalar x, SkScalar y) const
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)