Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / compositor / paint_recorder.h
blobef63fbd9382f8d59ff9a236a94d6d24b7a8fa4fc
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_PAINT_RECORDER_H_
6 #define UI_COMPOSITOR_PAINT_RECORDER_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "skia/ext/refptr.h"
11 #include "third_party/skia/include/core/SkPictureRecorder.h"
12 #include "ui/compositor/compositor_export.h"
14 namespace cc {
15 class DisplayItemList;
18 namespace gfx {
19 class Canvas;
22 class SkCanvas;
24 namespace ui {
25 class PaintContext;
27 // A class to hide the complexity behind setting up a recording into a
28 // DisplayItem. This is meant to be short-lived within the scope of recording
29 // taking place, the DisplayItem should be removed from the PaintRecorder once
30 // recording is complete and can be cached.
31 class COMPOSITOR_EXPORT PaintRecorder {
32 public:
33 explicit PaintRecorder(const PaintContext& context);
34 ~PaintRecorder();
36 // Gets a gfx::Canvas for painting into.
37 gfx::Canvas* canvas() { return canvas_; }
39 private:
40 gfx::Canvas* canvas_;
41 cc::DisplayItemList* list_;
42 SkPictureRecorder recorder_;
43 scoped_ptr<gfx::Canvas> owned_canvas_;
45 DISALLOW_COPY_AND_ASSIGN(PaintRecorder);
48 } // namespace ui
50 #endif // UI_COMPOSITOR_PAINT_RECORDER_H_