OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_ |
6 #define UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_ | 6 #define UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | |
10 #include "ui/gfx/geometry/rect.h" | 9 #include "ui/gfx/geometry/rect.h" |
11 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
12 #include "ui/gfx/skia_util.h" | 11 #include "ui/gfx/skia_util.h" |
13 #include "ui/ozone/public/surface_ozone_canvas.h" | 12 #include "ui/ozone/public/surface_ozone_canvas.h" |
14 | 13 |
15 class SkCanvas; | 14 class SkCanvas; |
16 class SkSurface; | 15 class SkSurface; |
17 | 16 |
18 namespace ui { | 17 namespace ui { |
19 | 18 |
20 class DriBuffer; | 19 class DriBuffer; |
| 20 class DriWindowDelegate; |
21 class DriWrapper; | 21 class DriWrapper; |
22 class HardwareDisplayController; | 22 class HardwareDisplayController; |
23 | 23 |
24 class DriSurface : public SurfaceOzoneCanvas { | 24 class DriSurface : public SurfaceOzoneCanvas { |
25 public: | 25 public: |
26 DriSurface(DriWrapper* dri, | 26 DriSurface(DriWindowDelegate* window_delegate, DriWrapper* dri); |
27 const base::WeakPtr<HardwareDisplayController>& controller); | |
28 virtual ~DriSurface(); | 27 virtual ~DriSurface(); |
29 | 28 |
30 // SurfaceOzoneCanvas: | 29 // SurfaceOzoneCanvas: |
31 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE; | 30 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE; |
32 virtual void ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE; | 31 virtual void ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE; |
33 virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE; | 32 virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE; |
34 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; | 33 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; |
35 | 34 |
36 private: | 35 private: |
37 void UpdateNativeSurface(const gfx::Rect& damage); | 36 void UpdateNativeSurface(const gfx::Rect& damage); |
38 | 37 |
| 38 DriWindowDelegate* window_delegate_; |
| 39 |
39 // Stores the connection to the graphics card. Pointer not owned by this | 40 // Stores the connection to the graphics card. Pointer not owned by this |
40 // class. | 41 // class. |
41 DriWrapper* dri_; | 42 DriWrapper* dri_; |
42 | 43 |
43 // The actual buffers used for painting. | 44 // The actual buffers used for painting. |
44 scoped_refptr<DriBuffer> buffers_[2]; | 45 scoped_refptr<DriBuffer> buffers_[2]; |
45 | 46 |
46 // Keeps track of which bitmap is |buffers_| is the frontbuffer. | 47 // Keeps track of which bitmap is |buffers_| is the frontbuffer. |
47 int front_buffer_; | 48 int front_buffer_; |
48 | 49 |
49 skia::RefPtr<SkSurface> surface_; | 50 skia::RefPtr<SkSurface> surface_; |
50 gfx::Rect last_damage_; | 51 gfx::Rect last_damage_; |
51 base::WeakPtr<HardwareDisplayController> controller_; | |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(DriSurface); | 53 DISALLOW_COPY_AND_ASSIGN(DriSurface); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace ui | 56 } // namespace ui |
57 | 57 |
58 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_ | 58 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_ |
OLD | NEW |