| 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" |
| 11 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
| 12 #include "third_party/skia/include/core/SkRefCnt.h" | 12 #include "third_party/skia/include/core/SkRefCnt.h" |
| 13 #include "third_party/skia/include/core/SkSurface.h" | 13 #include "third_party/skia/include/core/SkSurface.h" |
| 14 #include "ui/gfx/skia_util.h" | 14 #include "ui/gfx/skia_util.h" |
| 15 #include "ui/gfx/vsync_provider.h" | 15 #include "ui/gfx/vsync_provider.h" |
| 16 #include "ui/ozone/platform/caca/caca_window.h" | 16 #include "ui/ozone/platform/caca/caca_window.h" |
| 17 #include "ui/ozone/platform/caca/scoped_caca_types.h" | 17 #include "ui/ozone/platform/caca/scoped_caca_types.h" |
| 18 #include "ui/ozone/public/surface_ozone_canvas.h" | 18 #include "ui/ozone/public/surface_ozone_canvas.h" |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 class CacaSurface : public ui::SurfaceOzoneCanvas { | 24 class CacaSurface : public ui::SurfaceOzoneCanvas { |
| 25 public: | 25 public: |
| 26 CacaSurface(CacaWindow* window); | 26 explicit CacaSurface(CacaWindow* window); |
| 27 ~CacaSurface() override; | 27 ~CacaSurface() override; |
| 28 | 28 |
| 29 bool Initialize(); | 29 bool Initialize(); |
| 30 | 30 |
| 31 // ui::SurfaceOzoneCanvas overrides: | 31 // ui::SurfaceOzoneCanvas overrides: |
| 32 sk_sp<SkSurface> GetSurface() override; | 32 sk_sp<SkSurface> GetSurface() override; |
| 33 void ResizeCanvas(const gfx::Size& viewport_size) override; | 33 void ResizeCanvas(const gfx::Size& viewport_size) override; |
| 34 void PresentCanvas(const gfx::Rect& damage) override; | 34 void PresentCanvas(const gfx::Rect& damage) override; |
| 35 std::unique_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; | 35 std::unique_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; |
| 36 | 36 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 void CacaWindowManager::RemoveWindow(int window_id, CacaWindow* window) { | 114 void CacaWindowManager::RemoveWindow(int window_id, CacaWindow* window) { |
| 115 DCHECK_EQ(window, windows_.Lookup(window_id)); | 115 DCHECK_EQ(window, windows_.Lookup(window_id)); |
| 116 windows_.Remove(window_id); | 116 windows_.Remove(window_id); |
| 117 } | 117 } |
| 118 | 118 |
| 119 CacaWindowManager::~CacaWindowManager() { | 119 CacaWindowManager::~CacaWindowManager() { |
| 120 DCHECK(thread_checker_.CalledOnValidThread()); | 120 DCHECK(thread_checker_.CalledOnValidThread()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool CacaWindowManager::LoadEGLGLES2Bindings( | |
| 124 AddGLLibraryCallback add_gl_library, | |
| 125 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | |
| 126 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 127 return false; | |
| 128 } | |
| 129 | |
| 130 std::unique_ptr<ui::SurfaceOzoneCanvas> | 123 std::unique_ptr<ui::SurfaceOzoneCanvas> |
| 131 CacaWindowManager::CreateCanvasForWidget(gfx::AcceleratedWidget widget) { | 124 CacaWindowManager::CreateCanvasForWidget(gfx::AcceleratedWidget widget) { |
| 132 DCHECK(thread_checker_.CalledOnValidThread()); | 125 DCHECK(thread_checker_.CalledOnValidThread()); |
| 133 CacaWindow* window = windows_.Lookup(widget); | 126 CacaWindow* window = windows_.Lookup(widget); |
| 134 DCHECK(window); | 127 DCHECK(window); |
| 135 | 128 |
| 136 std::unique_ptr<CacaSurface> canvas(new CacaSurface(window)); | 129 std::unique_ptr<CacaSurface> canvas(new CacaSurface(window)); |
| 137 bool initialized = canvas->Initialize(); | 130 bool initialized = canvas->Initialize(); |
| 138 DCHECK(initialized); | 131 DCHECK(initialized); |
| 139 return std::move(canvas); | 132 return std::move(canvas); |
| 140 } | 133 } |
| 141 | 134 |
| 142 } // namespace ui | 135 } // namespace ui |
| OLD | NEW |