Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: cc/paint/paint_record.h

Issue 2739533003: Revert of Make cc/paint have concrete types (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/paint/paint_flags.h ('k') | cc/paint/paint_record.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_PAINT_PAINT_RECORD_H_ 5 #ifndef CC_PAINT_PAINT_RECORD_H_
6 #define CC_PAINT_PAINT_RECORD_H_ 6 #define CC_PAINT_PAINT_RECORD_H_
7 7
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "cc/paint/paint_export.h"
11 #include "third_party/skia/include/core/SkPicture.h" 8 #include "third_party/skia/include/core/SkPicture.h"
12 #include "third_party/skia/include/utils/SkPictureUtils.h" 9 #include "third_party/skia/include/utils/SkPictureUtils.h"
13 10
14 namespace cc { 11 namespace cc {
15 12
16 class PaintCanvas; 13 using PaintRecord = SkPicture;
17 14
18 // This class is only used by casting from an SkPicture in PaintRecorder. 15 inline const SkPicture* ToSkPicture(const PaintRecord* record) {
19 // This will be replaced with its own functionality in a future patch. 16 return record;
20 class CC_PAINT_EXPORT PaintRecord : private SkPicture {
21 public:
22 void playback(PaintCanvas* canvas);
23
24 using SkPicture::playback;
25 using SkPicture::approximateBytesUsed;
26 using SkPicture::approximateOpCount;
27 using SkPicture::cullRect;
28 using SkRefCnt::ref;
29 using SkRefCnt::unref;
30
31 private:
32 friend class PaintRecorder;
33 friend const SkPicture* ToSkPicture(const PaintRecord* record);
34 friend SkPicture* ToSkPicture(PaintRecord* record);
35 friend sk_sp<SkPicture> ToSkPicture(sk_sp<PaintRecord> record);
36 friend sk_sp<const SkPicture> ToSkPicture(sk_sp<const PaintRecord> record);
37
38 DISALLOW_COPY_AND_ASSIGN(PaintRecord);
39 };
40
41 ALWAYS_INLINE const SkPicture* ToSkPicture(const PaintRecord* record) {
42 return static_cast<const SkPicture*>(record);
43 } 17 }
44 18
45 ALWAYS_INLINE SkPicture* ToSkPicture(PaintRecord* record) { 19 inline SkPicture* ToSkPicture(PaintRecord* record) {
46 return static_cast<SkPicture*>(record); 20 return record;
47 } 21 }
48 22
49 ALWAYS_INLINE sk_sp<SkPicture> ToSkPicture(sk_sp<PaintRecord> record) { 23 inline sk_sp<SkPicture> ToSkPicture(sk_sp<PaintRecord> record) {
50 return sk_ref_sp(ToSkPicture(record.get())); 24 return record;
51 } 25 }
52 26
53 ALWAYS_INLINE sk_sp<const SkPicture> ToSkPicture( 27 inline sk_sp<const SkPicture> ToSkPicture(sk_sp<const PaintRecord> record) {
54 sk_sp<const PaintRecord> record) { 28 return record;
55 return sk_ref_sp(ToSkPicture(record.get()));
56 } 29 }
57 30
58 } // namespace cc 31 } // namespace cc
59 32
60 #endif // CC_PAINT_PAINT_RECORD_H_ 33 #endif // CC_PAINT_PAINT_RECORD_H_
OLDNEW
« no previous file with comments | « cc/paint/paint_flags.h ('k') | cc/paint/paint_record.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698