blob: a3fca567318bf0e931a0de5f92a604a6eeb0a384 [file] [log] [blame]
msarett95416f42016-04-27 13:51:20 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
Hal Canary03a7f5f2017-02-10 09:06:38 -05007#ifndef SkRecordedDrawable_DEFINED
8#define SkRecordedDrawable_DEFINED
msarett95416f42016-04-27 13:51:20 -07009
10#include "SkBBoxHierarchy.h"
11#include "SkDrawable.h"
12#include "SkRecord.h"
13#include "SkRecorder.h"
14
15class SkRecordedDrawable : public SkDrawable {
16public:
bungeman6bd52842016-10-27 09:30:08 -070017 SkRecordedDrawable(sk_sp<SkRecord> record, sk_sp<SkBBoxHierarchy> bbh,
18 std::unique_ptr<SkDrawableList> drawableList, const SkRect& bounds)
19 : fRecord(std::move(record))
20 , fBBH(std::move(bbh))
21 , fDrawableList(std::move(drawableList))
msarett95416f42016-04-27 13:51:20 -070022 , fBounds(bounds)
msarett95416f42016-04-27 13:51:20 -070023 {}
24
25 void flatten(SkWriteBuffer& buffer) const override;
26
msarett95416f42016-04-27 13:51:20 -070027protected:
28 SkRect onGetBounds() override { return fBounds; }
29
30 void onDraw(SkCanvas* canvas) override;
31
32 SkPicture* onNewPictureSnapshot() override;
33
34private:
Mike Klein4fee3232018-10-18 17:27:16 -040035 SK_FLATTENABLE_HOOKS(SkRecordedDrawable)
36
bungeman6bd52842016-10-27 09:30:08 -070037 sk_sp<SkRecord> fRecord;
38 sk_sp<SkBBoxHierarchy> fBBH;
39 std::unique_ptr<SkDrawableList> fDrawableList;
msarett95416f42016-04-27 13:51:20 -070040 const SkRect fBounds;
msarett95416f42016-04-27 13:51:20 -070041};
Hal Canary03a7f5f2017-02-10 09:06:38 -050042#endif // SkRecordedDrawable_DEFINED