OLD | NEW |
| (Empty) |
1 /* | |
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 */ | |
7 | |
8 #include "SkBBoxHierarchy.h" | |
9 #include "SkDrawable.h" | |
10 #include "SkRecord.h" | |
11 #include "SkRecorder.h" | |
12 | |
13 class SkRecordedDrawable : public SkDrawable { | |
14 public: | |
15 SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* d
rawableList, | |
16 const SkRect& bounds, bool doSaveLayerInfo) | |
17 : fRecord(SkRef(record)) | |
18 , fBBH(SkSafeRef(bbh)) | |
19 , fDrawableList(drawableList) // we take ownership | |
20 , fBounds(bounds) | |
21 , fDoSaveLayerInfo(doSaveLayerInfo) | |
22 {} | |
23 | |
24 void flatten(SkWriteBuffer& buffer) const override; | |
25 | |
26 static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer); | |
27 | |
28 Factory getFactory() const override { return CreateProc; } | |
29 | |
30 protected: | |
31 SkRect onGetBounds() override { return fBounds; } | |
32 | |
33 void onDraw(SkCanvas* canvas) override; | |
34 | |
35 SkPicture* onNewPictureSnapshot() override; | |
36 | |
37 private: | |
38 SkAutoTUnref<SkRecord> fRecord; | |
39 SkAutoTUnref<SkBBoxHierarchy> fBBH; | |
40 SkAutoTDelete<SkDrawableList> fDrawableList; | |
41 const SkRect fBounds; | |
42 const bool fDoSaveLayerInfo; | |
43 }; | |
OLD | NEW |