Flutter Engine
The Flutter Engine
Picture_AbortCallback_abort.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(Picture_AbortCallback_abort, 256, 256, false, 0) {
6public:
7 bool abort() override { return fCalls++ > 0; }
8private:
9 int fCalls = 0;
10};
11
12void draw(SkCanvas* canvas) {
13 SkPictureRecorder recorder;
14 SkCanvas* pictureCanvas = recorder.beginRecording({0, 0, 256, 256});
16 pictureCanvas->drawRect(SkRect::MakeWH(200, 200), paint);
17 paint.setColor(SK_ColorWHITE);
18 pictureCanvas->drawRect(SkRect::MakeLTRB(20, 20, 180, 180), paint);
21 picture->playback(canvas, &callback);
22}
23} // END FIDDLE
REG_FIDDLE(Picture_AbortCallback_abort, 256, 256, false, 0)
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
bool abort() override
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
virtual void playback(SkCanvas *canvas, AbortCallback *callback=nullptr) const =0
const Paint & paint
Definition: color_source.cc:38
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646