| 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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkSurface.h" | 10 #include "third_party/skia/include/core/SkSurface.h" |
| 11 #include "ui/gfx/skia_util.h" | 11 #include "ui/gfx/skia_util.h" |
| 12 #include "ui/gfx/vsync_provider.h" | 12 #include "ui/gfx/vsync_provider.h" |
| 13 #include "ui/ozone/platform/caca/caca_window.h" | 13 #include "ui/ozone/platform/caca/caca_window.h" |
| 14 #include "ui/ozone/platform/caca/scoped_caca_types.h" | 14 #include "ui/ozone/platform/caca/scoped_caca_types.h" |
| 15 #include "ui/ozone/public/surface_ozone_canvas.h" | 15 #include "ui/ozone/public/surface_ozone_canvas.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class CacaSurface : public ui::SurfaceOzoneCanvas { | 21 class CacaSurface : public ui::SurfaceOzoneCanvas { |
| 22 public: | 22 public: |
| 23 CacaSurface(CacaWindow* window); | 23 CacaSurface(CacaWindow* window); |
| 24 virtual ~CacaSurface(); | 24 virtual ~CacaSurface(); |
| 25 | 25 |
| 26 bool Initialize(); | 26 bool Initialize(); |
| 27 | 27 |
| 28 // ui::SurfaceOzoneCanvas overrides: | 28 // ui::SurfaceOzoneCanvas overrides: |
| 29 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE; | 29 virtual skia::RefPtr<SkCanvas> GetCanvas() override; |
| 30 virtual void ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE; | 30 virtual void ResizeCanvas(const gfx::Size& viewport_size) override; |
| 31 virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE; | 31 virtual void PresentCanvas(const gfx::Rect& damage) override; |
| 32 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; | 32 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 CacaWindow* window_; // Not owned. | 35 CacaWindow* window_; // Not owned. |
| 36 | 36 |
| 37 ScopedCacaDither dither_; | 37 ScopedCacaDither dither_; |
| 38 | 38 |
| 39 skia::RefPtr<SkSurface> surface_; | 39 skia::RefPtr<SkSurface> surface_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(CacaSurface); | 41 DISALLOW_COPY_AND_ASSIGN(CacaSurface); |
| 42 }; | 42 }; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 CacaWindow* window = windows_.Lookup(widget); | 132 CacaWindow* window = windows_.Lookup(widget); |
| 133 DCHECK(window); | 133 DCHECK(window); |
| 134 | 134 |
| 135 scoped_ptr<CacaSurface> canvas(new CacaSurface(window)); | 135 scoped_ptr<CacaSurface> canvas(new CacaSurface(window)); |
| 136 bool initialized = canvas->Initialize(); | 136 bool initialized = canvas->Initialize(); |
| 137 DCHECK(initialized); | 137 DCHECK(initialized); |
| 138 return canvas.PassAs<ui::SurfaceOzoneCanvas>(); | 138 return canvas.PassAs<ui::SurfaceOzoneCanvas>(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace ui | 141 } // namespace ui |
| OLD | NEW |