Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: ui/ozone/platform/caca/caca_window_manager.cc

Issue 794603003: [Ozone] Fix build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
9 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkSurface.h" 9 #include "third_party/skia/include/core/SkSurface.h"
11 #include "ui/gfx/skia_util.h" 10 #include "ui/gfx/skia_util.h"
12 #include "ui/gfx/vsync_provider.h" 11 #include "ui/gfx/vsync_provider.h"
13 #include "ui/ozone/platform/caca/caca_window.h" 12 #include "ui/ozone/platform/caca/caca_window.h"
14 #include "ui/ozone/platform/caca/scoped_caca_types.h" 13 #include "ui/ozone/platform/caca/scoped_caca_types.h"
15 #include "ui/ozone/public/surface_ozone_canvas.h" 14 #include "ui/ozone/public/surface_ozone_canvas.h"
16 15
17 namespace ui { 16 namespace ui {
18 17
19 namespace { 18 namespace {
20 19
21 class CacaSurface : public ui::SurfaceOzoneCanvas { 20 class CacaSurface : public ui::SurfaceOzoneCanvas {
22 public: 21 public:
23 CacaSurface(CacaWindow* window); 22 CacaSurface(CacaWindow* window);
24 ~CacaSurface() override; 23 ~CacaSurface() override;
25 24
26 bool Initialize(); 25 bool Initialize();
27 26
28 // ui::SurfaceOzoneCanvas overrides: 27 // ui::SurfaceOzoneCanvas overrides:
29 skia::RefPtr<SkCanvas> GetCanvas() override; 28 skia::RefPtr<SkSurface> GetSurface() override;
30 void ResizeCanvas(const gfx::Size& viewport_size) override; 29 void ResizeCanvas(const gfx::Size& viewport_size) override;
31 void PresentCanvas(const gfx::Rect& damage) override; 30 void PresentCanvas(const gfx::Rect& damage) override;
32 scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; 31 scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override;
33 32
34 private: 33 private:
35 CacaWindow* window_; // Not owned. 34 CacaWindow* window_; // Not owned.
36 35
37 ScopedCacaDither dither_; 36 ScopedCacaDither dither_;
38 37
39 skia::RefPtr<SkSurface> surface_; 38 skia::RefPtr<SkSurface> surface_;
40 39
41 DISALLOW_COPY_AND_ASSIGN(CacaSurface); 40 DISALLOW_COPY_AND_ASSIGN(CacaSurface);
42 }; 41 };
43 42
44 CacaSurface::CacaSurface(CacaWindow* window) : window_(window) { 43 CacaSurface::CacaSurface(CacaWindow* window) : window_(window) {
45 } 44 }
46 45
47 CacaSurface::~CacaSurface() { 46 CacaSurface::~CacaSurface() {
48 } 47 }
49 48
50 bool CacaSurface::Initialize() { 49 bool CacaSurface::Initialize() {
51 ResizeCanvas(window_->bitmap_size()); 50 ResizeCanvas(window_->bitmap_size());
52 return true; 51 return true;
53 } 52 }
54 53
55 skia::RefPtr<SkCanvas> CacaSurface::GetCanvas() { 54 skia::RefPtr<SkSurface> CacaSurface::GetSurface() {
56 return skia::SharePtr<SkCanvas>(surface_->getCanvas()); 55 return surface_;
57 } 56 }
58 57
59 void CacaSurface::ResizeCanvas(const gfx::Size& viewport_size) { 58 void CacaSurface::ResizeCanvas(const gfx::Size& viewport_size) {
60 TRACE_EVENT0("ozone", "CacaSurface::ResizeCanvas"); 59 TRACE_EVENT0("ozone", "CacaSurface::ResizeCanvas");
61 60
62 VLOG(2) << "creating libcaca surface with from window " << (void*)window_; 61 VLOG(2) << "creating libcaca surface with from window " << (void*)window_;
63 62
64 SkImageInfo info = SkImageInfo::Make(window_->bitmap_size().width(), 63 SkImageInfo info = SkImageInfo::Make(window_->bitmap_size().width(),
65 window_->bitmap_size().height(), 64 window_->bitmap_size().height(),
66 kN32_SkColorType, 65 kN32_SkColorType,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 CacaWindow* window = windows_.Lookup(widget); 131 CacaWindow* window = windows_.Lookup(widget);
133 DCHECK(window); 132 DCHECK(window);
134 133
135 scoped_ptr<CacaSurface> canvas(new CacaSurface(window)); 134 scoped_ptr<CacaSurface> canvas(new CacaSurface(window));
136 bool initialized = canvas->Initialize(); 135 bool initialized = canvas->Initialize();
137 DCHECK(initialized); 136 DCHECK(initialized);
138 return canvas.Pass(); 137 return canvas.Pass();
139 } 138 }
140 139
141 } // namespace ui 140 } // namespace ui
OLDNEW
« no previous file with comments | « content/browser/compositor/software_output_device_ozone.cc ('k') | ui/ozone/platform/dri/dri_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698