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

Unified Diff: cc/paint/paint_record.h

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: Rebase Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: cc/paint/paint_record.h
diff --git a/cc/paint/paint_record.h b/cc/paint/paint_record.h
index a376394cc84e9e79eefe16a0b04a37abd2c216c7..39820ffd30bc92e1f1986b409394463fdaef5351 100644
--- a/cc/paint/paint_record.h
+++ b/cc/paint/paint_record.h
@@ -5,27 +5,49 @@
#ifndef CC_PAINT_PAINT_RECORD_H_
#define CC_PAINT_PAINT_RECORD_H_
+#include "base/compiler_specific.h"
+#include "cc/paint/paint_export.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/utils/SkPictureUtils.h"
namespace cc {
-using PaintRecord = SkPicture;
-
-inline const SkPicture* ToSkPicture(const PaintRecord* record) {
- return record;
+class PaintCanvas;
+
+class CC_PAINT_EXPORT PaintRecord : private SkPicture {
+ public:
+ void playback(PaintCanvas* canvas);
+
+ using SkPicture::playback;
+ using SkPicture::approximateBytesUsed;
+ using SkPicture::approximateOpCount;
+ using SkPicture::cullRect;
+ using SkRefCnt::ref;
+ using SkRefCnt::unref;
+
+ private:
+ friend class PaintRecorder;
+ friend const SkPicture* ToSkPicture(const PaintRecord* record);
+ friend SkPicture* ToSkPicture(PaintRecord* record);
+ friend sk_sp<SkPicture> ToSkPicture(sk_sp<PaintRecord> record);
+ friend sk_sp<const SkPicture> ToSkPicture(sk_sp<const PaintRecord> record);
+};
+
+ALWAYS_INLINE const SkPicture* ToSkPicture(const PaintRecord* record) {
+ return static_cast<const SkPicture*>(record);
}
-inline SkPicture* ToSkPicture(PaintRecord* record) {
- return record;
+ALWAYS_INLINE SkPicture* ToSkPicture(PaintRecord* record) {
+ return static_cast<SkPicture*>(record);
}
-inline sk_sp<SkPicture> ToSkPicture(sk_sp<PaintRecord> record) {
- return record;
+ALWAYS_INLINE sk_sp<SkPicture> ToSkPicture(sk_sp<PaintRecord> record) {
+ return sk_sp<SkPicture>(ToSkPicture(record.get()));
danakj 2017/03/02 19:44:40 This adopts the pointer. But |record| will deref i
}
-inline sk_sp<const SkPicture> ToSkPicture(sk_sp<const PaintRecord> record) {
- return record;
+ALWAYS_INLINE sk_sp<const SkPicture> ToSkPicture(
+ sk_sp<const PaintRecord> record) {
+ return sk_sp<const SkPicture>(ToSkPicture(record.get()));
danakj 2017/03/02 19:44:40 same?
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698