ozone: fix HDPMLegacy - do the PF after overlays, also clear old overlays
[chromium-blink-merge.git] / ui / ozone / platform / dri / dri_surface.h
blob9c439e344c08afe1bd136ca1c5c4e440d61397a0
1 // Copyright 2014 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_OZONE_PLATFORM_DRI_DRI_SURFACE_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_
8 #include "base/memory/ref_counted.h"
9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/skia_util.h"
12 #include "ui/ozone/public/surface_ozone_canvas.h"
14 class SkSurface;
16 namespace ui {
18 class DriBuffer;
19 class DriWindowDelegate;
20 class DriWrapper;
21 class HardwareDisplayController;
23 class DriSurface : public SurfaceOzoneCanvas {
24 public:
25 DriSurface(DriWindowDelegate* window_delegate, DriWrapper* dri);
26 ~DriSurface() override;
28 // SurfaceOzoneCanvas:
29 skia::RefPtr<SkSurface> GetSurface() override;
30 void ResizeCanvas(const gfx::Size& viewport_size) override;
31 void PresentCanvas(const gfx::Rect& damage) override;
32 scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override;
34 private:
35 void UpdateNativeSurface(const gfx::Rect& damage);
37 DriWindowDelegate* window_delegate_;
39 // Stores the connection to the graphics card. Pointer not owned by this
40 // class.
41 DriWrapper* dri_;
43 // The actual buffers used for painting.
44 scoped_refptr<DriBuffer> buffers_[2];
46 // Keeps track of which bitmap is |buffers_| is the frontbuffer.
47 int front_buffer_;
49 skia::RefPtr<SkSurface> surface_;
50 gfx::Rect last_damage_;
52 DISALLOW_COPY_AND_ASSIGN(DriSurface);
55 } // namespace ui
57 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_