Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / compositor / canvas_painter.h
blob6d8d39023535f1a8f030cd94eeaaa19236f1e9f0
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_COMPOSITOR_CANVAS_PAINTER_H_
6 #define UI_COMPOSITOR_CANVAS_PAINTER_H_
8 #include "base/memory/ref_counted.h"
9 #include "ui/compositor/compositor_export.h"
10 #include "ui/compositor/paint_context.h"
11 #include "ui/gfx/geometry/rect.h"
13 namespace cc {
14 class DisplayItemList;
17 namespace gfx {
18 class Canvas;
21 namespace ui {
23 // This class provides a simple helper for painting directly to a bitmap
24 // backed canvas (for painting use-cases other than compositing). After
25 // constructing an instance of a CanvasPainter, the context() can be used
26 // to do painting using the normal composited paint paths. When
27 // the painter is destroyed, any painting done with the context() will be
28 // rastered into the canvas.
29 class COMPOSITOR_EXPORT CanvasPainter {
30 public:
31 CanvasPainter(gfx::Canvas* canvas, float raster_scale_factor);
32 ~CanvasPainter();
34 const PaintContext& context() const { return context_; }
36 private:
37 gfx::Canvas* const canvas_;
38 const float raster_scale_factor_;
39 const gfx::Rect rect_;
40 scoped_refptr<cc::DisplayItemList> list_;
41 PaintContext context_;
43 DISALLOW_COPY_AND_ASSIGN(CanvasPainter);
46 } // namespace ui
48 #endif // UI_COMPOSITOR_CANVAS_PAINTER_H_