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

Unified Diff: ui/compositor/canvas_painter.h

Issue 1161933007: ui: Introduce CanvasPainter, remove PaintContext(gfx::Canvas*). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: canvaspainter: . Created 5 years, 6 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 | « ui/compositor/BUILD.gn ('k') | ui/compositor/canvas_painter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/canvas_painter.h
diff --git a/ui/compositor/canvas_painter.h b/ui/compositor/canvas_painter.h
new file mode 100644
index 0000000000000000000000000000000000000000..d2ad64d89394b9dca99e9f746b4dcc95b34edd26
--- /dev/null
+++ b/ui/compositor/canvas_painter.h
@@ -0,0 +1,48 @@
+// 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_CANVAS_PAINTER_H_
+#define UI_COMPOSITOR_CANVAS_PAINTER_H_
+
+#include "base/memory/ref_counted.h"
+#include "ui/compositor/compositor_export.h"
+#include "ui/compositor/paint_context.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace cc {
+class DisplayItemList;
+}
+
+namespace gfx {
+class Canvas;
+}
+
+namespace ui {
+
+// This class provides a simple helper for painting directly to a bitmap
+// backed canvas (for painting use-cases other than compositing). After
+// constructing an instance of a CanvasPainter, the context() can be used
+// to do painting using the normal composited paint paths. When
+// the painter is destroyed, any painting done with the context() will be
+// rastered into the canvas.
+class COMPOSITOR_EXPORT CanvasPainter {
+ public:
+ CanvasPainter(gfx::Canvas* canvas, float raster_scale_factor);
+ ~CanvasPainter();
+
+ const PaintContext& context() const { return context_; }
+
+ private:
+ gfx::Canvas* canvas_;
+ float raster_scale_factor_;
sky 2015/06/04 22:51:29 const
danakj 2015/06/04 22:56:19 Done.
+ gfx::Rect rect_;
sky 2015/06/04 22:51:29 const
danakj 2015/06/04 22:56:19 Done.
+ scoped_refptr<cc::DisplayItemList> list_;
+ PaintContext context_;
+
+ DISALLOW_COPY_AND_ASSIGN(CanvasPainter);
+};
+
+} // namespace ui
+
+#endif // UI_COMPOSITOR_CANVAS_PAINTER_H_
« no previous file with comments | « ui/compositor/BUILD.gn ('k') | ui/compositor/canvas_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698