OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkDrawable.h" | 9 #include "SkDrawable.h" |
10 #include "SkRecord.h" | 10 #include "SkRecord.h" |
11 #include "SkRecorder.h" | 11 #include "SkRecorder.h" |
12 | 12 |
13 class SkRecordedDrawable : public SkDrawable { | 13 class SkRecordedDrawable : public SkDrawable { |
14 public: | 14 public: |
15 SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* d
rawableList, | 15 SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* d
rawableList, |
16 const SkRect& bounds, bool doSaveLayerInfo) | 16 const SkRect& bounds) |
17 : fRecord(SkRef(record)) | 17 : fRecord(SkRef(record)) |
18 , fBBH(SkSafeRef(bbh)) | 18 , fBBH(SkSafeRef(bbh)) |
19 , fDrawableList(drawableList) // we take ownership | 19 , fDrawableList(drawableList) // we take ownership |
20 , fBounds(bounds) | 20 , fBounds(bounds) |
21 , fDoSaveLayerInfo(doSaveLayerInfo) | |
22 {} | 21 {} |
23 | 22 |
24 void flatten(SkWriteBuffer& buffer) const override; | 23 void flatten(SkWriteBuffer& buffer) const override; |
25 | 24 |
26 static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer); | 25 static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer); |
27 | 26 |
28 Factory getFactory() const override { return CreateProc; } | 27 Factory getFactory() const override { return CreateProc; } |
29 | 28 |
30 protected: | 29 protected: |
31 SkRect onGetBounds() override { return fBounds; } | 30 SkRect onGetBounds() override { return fBounds; } |
32 | 31 |
33 void onDraw(SkCanvas* canvas) override; | 32 void onDraw(SkCanvas* canvas) override; |
34 | 33 |
35 SkPicture* onNewPictureSnapshot() override; | 34 SkPicture* onNewPictureSnapshot() override; |
36 | 35 |
37 private: | 36 private: |
38 SkAutoTUnref<SkRecord> fRecord; | 37 SkAutoTUnref<SkRecord> fRecord; |
39 SkAutoTUnref<SkBBoxHierarchy> fBBH; | 38 SkAutoTUnref<SkBBoxHierarchy> fBBH; |
40 SkAutoTDelete<SkDrawableList> fDrawableList; | 39 SkAutoTDelete<SkDrawableList> fDrawableList; |
41 const SkRect fBounds; | 40 const SkRect fBounds; |
42 const bool fDoSaveLayerInfo; | |
43 }; | 41 }; |
OLD | NEW |