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 #include "ui/ozone/platform/dri/dri_surface_factory.h" | 5 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 state_ = INITIALIZED; | 85 state_ = INITIALIZED; |
86 return state_; | 86 return state_; |
87 } | 87 } |
88 | 88 |
89 void DriSurfaceFactory::ShutdownHardware() { | 89 void DriSurfaceFactory::ShutdownHardware() { |
90 CHECK(state_ == INITIALIZED); | 90 CHECK(state_ == INITIALIZED); |
91 state_ = UNINITIALIZED; | 91 state_ = UNINITIALIZED; |
92 } | 92 } |
93 | 93 |
94 gfx::AcceleratedWidget DriSurfaceFactory::GetAcceleratedWidget() { | |
95 CHECK(state_ != FAILED); | |
96 | |
97 // We're not using 0 since other code assumes that a 0 AcceleratedWidget is an | |
98 // invalid widget. | |
99 return ++allocated_widgets_; | |
100 } | |
101 | |
102 scoped_ptr<ui::SurfaceOzoneCanvas> DriSurfaceFactory::CreateCanvasForWidget( | 94 scoped_ptr<ui::SurfaceOzoneCanvas> DriSurfaceFactory::CreateCanvasForWidget( |
103 gfx::AcceleratedWidget w) { | 95 gfx::AcceleratedWidget w) { |
104 CHECK(state_ == INITIALIZED); | 96 CHECK(state_ == INITIALIZED); |
105 // Initial cursor set. | 97 // Initial cursor set. |
106 ResetCursor(w); | 98 ResetCursor(w); |
107 | 99 |
108 return scoped_ptr<ui::SurfaceOzoneCanvas>( | 100 return scoped_ptr<ui::SurfaceOzoneCanvas>( |
109 new DriSurface(drm_, screen_manager_->GetDisplayController(w))); | 101 new DriSurface(drm_, screen_manager_->GetDisplayController(w))); |
110 } | 102 } |
111 | 103 |
112 bool DriSurfaceFactory::LoadEGLGLES2Bindings( | 104 bool DriSurfaceFactory::LoadEGLGLES2Bindings( |
113 AddGLLibraryCallback add_gl_library, | 105 AddGLLibraryCallback add_gl_library, |
114 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | 106 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
115 return false; | 107 return false; |
116 } | 108 } |
117 | 109 |
| 110 gfx::AcceleratedWidget DriSurfaceFactory::GetAcceleratedWidget() { |
| 111 CHECK(state_ != FAILED); |
| 112 |
| 113 // We're not using 0 since other code assumes that a 0 AcceleratedWidget is an |
| 114 // invalid widget. |
| 115 return ++allocated_widgets_; |
| 116 } |
| 117 |
118 gfx::Size DriSurfaceFactory::GetWidgetSize(gfx::AcceleratedWidget w) { | 118 gfx::Size DriSurfaceFactory::GetWidgetSize(gfx::AcceleratedWidget w) { |
119 base::WeakPtr<HardwareDisplayController> controller = | 119 base::WeakPtr<HardwareDisplayController> controller = |
120 screen_manager_->GetDisplayController(w); | 120 screen_manager_->GetDisplayController(w); |
121 if (controller) | 121 if (controller) |
122 return gfx::Size(controller->get_mode().hdisplay, | 122 return gfx::Size(controller->get_mode().hdisplay, |
123 controller->get_mode().vdisplay); | 123 controller->get_mode().vdisplay); |
124 | 124 |
125 return gfx::Size(0, 0); | 125 return gfx::Size(0, 0); |
126 } | 126 } |
127 | 127 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 cursor_frontbuffer_ ^= 1; | 169 cursor_frontbuffer_ ^= 1; |
170 } | 170 } |
171 } else { | 171 } else { |
172 // No cursor set. | 172 // No cursor set. |
173 if (controller) | 173 if (controller) |
174 controller->UnsetCursor(); | 174 controller->UnsetCursor(); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 } // namespace ui | 178 } // namespace ui |
OLD | NEW |