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

Unified Diff: ui/compositor/paint_recorder.h

Issue 1053143002: Make View::Paint use ui::PaintRecorder to access PaintContext's canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: paintrecorder: explicit Created 5 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 side-by-side diff with in-line comments
Download patch
Index: ui/compositor/paint_recorder.h
diff --git a/ui/compositor/paint_recorder.h b/ui/compositor/paint_recorder.h
new file mode 100644
index 0000000000000000000000000000000000000000..0e8631016c73af6128b21fa1467670c19241a47c
--- /dev/null
+++ b/ui/compositor/paint_recorder.h
@@ -0,0 +1,38 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_COMPOSITOR_PAINT_RECORDER_H_
+#define UI_COMPOSITOR_PAINT_RECORDER_H_
+
+#include "base/macros.h"
+#include "ui/compositor/compositor_export.h"
+
+namespace gfx {
+class Canvas;
+}
+
+namespace ui {
+class PaintContext;
+
+// A class to hide the complexity behind setting up a recording into a
+// DisplayItem. This is meant to be short-lived within the scope of recording
+// taking place, the DisplayItem should be removed from the PaintRecorder once
+// recording is complete and can be cached.
+class COMPOSITOR_EXPORT PaintRecorder {
+ public:
+ explicit PaintRecorder(const PaintContext& context);
+ ~PaintRecorder();
+
+ // Gets a gfx::Canvas for painting into.
+ gfx::Canvas* canvas() { return canvas_; }
+
+ private:
+ gfx::Canvas* canvas_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaintRecorder);
+};
+
+} // namespace ui
+
+#endif // UI_COMPOSITOR_PAINT_RECORDER_H_

Powered by Google App Engine
This is Rietveld 408576698