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

Unified Diff: cc/paint/paint_recorder.h

Issue 2768143002: Back PaintRecord with PaintOpBuffer instead of SkPicture (Closed)
Patch Set: more const casting Created 3 years, 8 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
« no previous file with comments | « cc/paint/paint_record.cc ('k') | cc/paint/paint_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/paint_recorder.h
diff --git a/cc/paint/paint_recorder.h b/cc/paint/paint_recorder.h
index 2bbea83b981f11a89de29d6ba547a580b1ca0a41..7f582b851913a0ddd185158f31a054bef585f121 100644
--- a/cc/paint/paint_recorder.h
+++ b/cc/paint/paint_recorder.h
@@ -9,47 +9,36 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/optional.h"
-#include "cc/paint/paint_canvas.h"
#include "cc/paint/paint_record.h"
-#include "cc/paint/skia_paint_canvas.h"
-#include "third_party/skia/include/core/SkPictureRecorder.h"
+#include "cc/paint/record_paint_canvas.h"
namespace cc {
+class PaintOpBuffer;
+
class CC_PAINT_EXPORT PaintRecorder {
public:
PaintRecorder();
~PaintRecorder();
- ALWAYS_INLINE PaintCanvas* beginRecording(const SkRect& bounds) {
- uint32_t record_flags = 0;
- canvas_.emplace(recorder_.beginRecording(bounds, nullptr, record_flags));
- return getRecordingCanvas();
- }
+ PaintCanvas* beginRecording(const SkRect& bounds);
- ALWAYS_INLINE PaintCanvas* beginRecording(SkScalar width, SkScalar height) {
- uint32_t record_flags = 0;
- canvas_.emplace(
- recorder_.beginRecording(width, height, nullptr, record_flags));
- return getRecordingCanvas();
+ // TODO(enne): should make everything go through the non-rect version.
+ // See comments in RecordPaintCanvas ctor for why.
+ PaintCanvas* beginRecording(SkScalar width, SkScalar height) {
+ return beginRecording(SkRect::MakeWH(width, height));
}
// Only valid between between and finish recording.
- ALWAYS_INLINE PaintCanvas* getRecordingCanvas() {
+ ALWAYS_INLINE RecordPaintCanvas* getRecordingCanvas() {
return canvas_.has_value() ? &canvas_.value() : nullptr;
}
- ALWAYS_INLINE sk_sp<PaintRecord> finishRecordingAsPicture() {
- sk_sp<SkPicture> picture = recorder_.finishRecordingAsPicture();
- // Some users (e.g. printing) use the existence of the recording canvas
- // to know if recording is finished, so reset it here.
- canvas_.reset();
- return sk_ref_sp(static_cast<PaintRecord*>(picture.get()));
- }
+ sk_sp<PaintRecord> finishRecordingAsPicture();
private:
- SkPictureRecorder recorder_;
- base::Optional<SkiaPaintCanvas> canvas_;
+ sk_sp<PaintOpBuffer> buffer_;
+ base::Optional<RecordPaintCanvas> canvas_;
DISALLOW_COPY_AND_ASSIGN(PaintRecorder);
};
« no previous file with comments | « cc/paint/paint_record.cc ('k') | cc/paint/paint_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698