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/caca/caca_window_manager.h" | 5 #include "ui/ozone/platform/caca/caca_window_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 CacaSurface(CacaWindow* window); | 25 CacaSurface(CacaWindow* window); |
26 ~CacaSurface() override; | 26 ~CacaSurface() override; |
27 | 27 |
28 bool Initialize(); | 28 bool Initialize(); |
29 | 29 |
30 // ui::SurfaceOzoneCanvas overrides: | 30 // ui::SurfaceOzoneCanvas overrides: |
31 skia::RefPtr<SkSurface> GetSurface() override; | 31 skia::RefPtr<SkSurface> GetSurface() override; |
32 void ResizeCanvas(const gfx::Size& viewport_size) override; | 32 void ResizeCanvas(const gfx::Size& viewport_size) override; |
33 void PresentCanvas(const gfx::Rect& damage) override; | 33 void PresentCanvas(const gfx::Rect& damage) override; |
34 scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; | 34 std::unique_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; |
35 | 35 |
36 private: | 36 private: |
37 CacaWindow* window_; // Not owned. | 37 CacaWindow* window_; // Not owned. |
38 | 38 |
39 ScopedCacaDither dither_; | 39 ScopedCacaDither dither_; |
40 | 40 |
41 skia::RefPtr<SkSurface> surface_; | 41 skia::RefPtr<SkSurface> surface_; |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(CacaSurface); | 43 DISALLOW_COPY_AND_ASSIGN(CacaSurface); |
44 }; | 44 }; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 caca_dither_bitmap(canvas, | 95 caca_dither_bitmap(canvas, |
96 0, | 96 0, |
97 0, | 97 0, |
98 caca_get_canvas_width(canvas), | 98 caca_get_canvas_width(canvas), |
99 caca_get_canvas_height(canvas), | 99 caca_get_canvas_height(canvas), |
100 dither_.get(), | 100 dither_.get(), |
101 static_cast<const uint8_t*>(pixels)); | 101 static_cast<const uint8_t*>(pixels)); |
102 caca_refresh_display(window_->display()); | 102 caca_refresh_display(window_->display()); |
103 } | 103 } |
104 | 104 |
105 scoped_ptr<gfx::VSyncProvider> CacaSurface::CreateVSyncProvider() { | 105 std::unique_ptr<gfx::VSyncProvider> CacaSurface::CreateVSyncProvider() { |
106 return nullptr; | 106 return nullptr; |
107 } | 107 } |
108 | 108 |
109 } // namespace | 109 } // namespace |
110 | 110 |
111 CacaWindowManager::CacaWindowManager() { | 111 CacaWindowManager::CacaWindowManager() { |
112 } | 112 } |
113 | 113 |
114 int32_t CacaWindowManager::AddWindow(CacaWindow* window) { | 114 int32_t CacaWindowManager::AddWindow(CacaWindow* window) { |
115 return windows_.Add(window); | 115 return windows_.Add(window); |
116 } | 116 } |
117 | 117 |
118 void CacaWindowManager::RemoveWindow(int window_id, CacaWindow* window) { | 118 void CacaWindowManager::RemoveWindow(int window_id, CacaWindow* window) { |
119 DCHECK_EQ(window, windows_.Lookup(window_id)); | 119 DCHECK_EQ(window, windows_.Lookup(window_id)); |
120 windows_.Remove(window_id); | 120 windows_.Remove(window_id); |
121 } | 121 } |
122 | 122 |
123 CacaWindowManager::~CacaWindowManager() { | 123 CacaWindowManager::~CacaWindowManager() { |
124 DCHECK(thread_checker_.CalledOnValidThread()); | 124 DCHECK(thread_checker_.CalledOnValidThread()); |
125 } | 125 } |
126 | 126 |
127 bool CacaWindowManager::LoadEGLGLES2Bindings( | 127 bool CacaWindowManager::LoadEGLGLES2Bindings( |
128 AddGLLibraryCallback add_gl_library, | 128 AddGLLibraryCallback add_gl_library, |
129 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | 129 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
130 DCHECK(thread_checker_.CalledOnValidThread()); | 130 DCHECK(thread_checker_.CalledOnValidThread()); |
131 return false; | 131 return false; |
132 } | 132 } |
133 | 133 |
134 scoped_ptr<ui::SurfaceOzoneCanvas> CacaWindowManager::CreateCanvasForWidget( | 134 std::unique_ptr<ui::SurfaceOzoneCanvas> |
135 gfx::AcceleratedWidget widget) { | 135 CacaWindowManager::CreateCanvasForWidget(gfx::AcceleratedWidget widget) { |
136 DCHECK(thread_checker_.CalledOnValidThread()); | 136 DCHECK(thread_checker_.CalledOnValidThread()); |
137 CacaWindow* window = windows_.Lookup(widget); | 137 CacaWindow* window = windows_.Lookup(widget); |
138 DCHECK(window); | 138 DCHECK(window); |
139 | 139 |
140 scoped_ptr<CacaSurface> canvas(new CacaSurface(window)); | 140 std::unique_ptr<CacaSurface> canvas(new CacaSurface(window)); |
141 bool initialized = canvas->Initialize(); | 141 bool initialized = canvas->Initialize(); |
142 DCHECK(initialized); | 142 DCHECK(initialized); |
143 return std::move(canvas); | 143 return std::move(canvas); |
144 } | 144 } |
145 | 145 |
146 } // namespace ui | 146 } // namespace ui |
OLD | NEW |