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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 DriSurface(DriWrapper* dri, const gfx::Size& size); | 25 DriSurface(DriWrapper* dri, const gfx::Size& size); |
26 virtual ~DriSurface(); | 26 virtual ~DriSurface(); |
27 | 27 |
28 // Get a Skia canvas for a backbuffer. | 28 // Get a Skia canvas for a backbuffer. |
29 SkCanvas* GetDrawableForWidget(); | 29 SkCanvas* GetDrawableForWidget(); |
30 | 30 |
31 // ScanoutSurface: | 31 // ScanoutSurface: |
32 virtual bool Initialize() OVERRIDE; | 32 virtual bool Initialize() OVERRIDE; |
33 virtual uint32_t GetFramebufferId() const OVERRIDE; | 33 virtual uint32_t GetFramebufferId() const OVERRIDE; |
34 virtual uint32_t GetHandle() const OVERRIDE; | 34 virtual uint32_t GetHandle() const OVERRIDE; |
| 35 virtual void PreSwapBuffers() OVERRIDE; |
35 virtual void SwapBuffers() OVERRIDE; | 36 virtual void SwapBuffers() OVERRIDE; |
36 virtual gfx::Size Size() const OVERRIDE; | 37 virtual gfx::Size Size() const OVERRIDE; |
37 | 38 |
38 private: | 39 private: |
39 DriBuffer* frontbuffer() const { return bitmaps_[front_buffer_].get(); } | 40 DriBuffer* frontbuffer() const { return bitmaps_[front_buffer_].get(); } |
40 DriBuffer* backbuffer() const { return bitmaps_[front_buffer_ ^ 1].get(); } | 41 DriBuffer* backbuffer() const { return bitmaps_[front_buffer_ ^ 1].get(); } |
41 | 42 |
42 // Used to create the backing buffers. | 43 // Used to create the backing buffers. |
43 virtual DriBuffer* CreateBuffer(); | 44 virtual DriBuffer* CreateBuffer(); |
44 | 45 |
45 // Stores the connection to the graphics card. Pointer not owned by this | 46 // Stores the connection to the graphics card. Pointer not owned by this |
46 // class. | 47 // class. |
47 DriWrapper* dri_; | 48 DriWrapper* dri_; |
48 | 49 |
49 // The actual buffers used for painting. | 50 // The actual buffers used for painting. |
50 scoped_ptr<DriBuffer> bitmaps_[2]; | 51 scoped_ptr<DriBuffer> bitmaps_[2]; |
51 | 52 |
52 // Keeps track of which bitmap is |buffers_| is the frontbuffer. | 53 // Keeps track of which bitmap is |buffers_| is the frontbuffer. |
53 int front_buffer_; | 54 int front_buffer_; |
54 | 55 |
55 // Surface size. | 56 // Surface size. |
56 gfx::Size size_; | 57 gfx::Size size_; |
57 | 58 |
58 DISALLOW_COPY_AND_ASSIGN(DriSurface); | 59 DISALLOW_COPY_AND_ASSIGN(DriSurface); |
59 }; | 60 }; |
60 | 61 |
61 } // namespace ui | 62 } // namespace ui |
62 | 63 |
63 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_ | 64 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_H_ |
OLD | NEW |