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

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

Issue 247933003: ozone: caca: Fix the build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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 | Annotate | Revision Log
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_surface_factory.h" 5 #include "ui/ozone/platform/caca/caca_surface_factory.h"
6 6
7 #include "third_party/skia/include/core/SkBitmap.h" 7 #include "third_party/skia/include/core/SkBitmap.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkSurface.h" 9 #include "third_party/skia/include/core/SkSurface.h"
10 #include "ui/gfx/ozone/surface_ozone_canvas.h" 10 #include "ui/gfx/ozone/surface_ozone_canvas.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_connection.h" 13 #include "ui/ozone/platform/caca/caca_connection.h"
14 14
15 namespace ui { 15 namespace ui {
16 16
17 namespace { 17 namespace {
18 18
19 const gfx::AcceleratedWidget kDefaultWidgetHandle = 1; 19 const gfx::AcceleratedWidget kDefaultWidgetHandle = 1;
20 20
21 class CacaSurface : public gfx::SurfaceOzoneCanvas { 21 class CacaSurface : public gfx::SurfaceOzoneCanvas {
22 public: 22 public:
23 CacaSurface(CacaConnection* connection); 23 CacaSurface(CacaConnection* connection);
24 virtual ~CacaSurface(); 24 virtual ~CacaSurface();
25 25
26 bool Initialize();
27
26 // gfx::SurfaceOzoneCanvas overrides: 28 // gfx::SurfaceOzoneCanvas overrides:
27 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE; 29 virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE;
28 virtual bool ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE; 30 virtual bool ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE;
29 virtual bool PresentCanvas() OVERRIDE; 31 virtual bool PresentCanvas() OVERRIDE;
30 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; 32 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE;
31 33
32 private: 34 private:
33 CacaConnection* connection_; // Not owned. 35 CacaConnection* connection_; // Not owned.
34 36
35 caca_dither_t* dither_; 37 caca_dither_t* dither_;
36 38
37 skia::RefPtr<SkSurface> surface_; 39 skia::RefPtr<SkSurface> surface_;
38 40
39 DISALLOW_COPY_AND_ASSIGN(CacaSurface); 41 DISALLOW_COPY_AND_ASSIGN(CacaSurface);
40 }; 42 };
41 43
42 CacaSurface::CacaSurface(CacaConnection* connection) 44 CacaSurface::CacaSurface(CacaConnection* connection)
43 : connection_(connection) {} 45 : connection_(connection) {}
44 46
45 CacaSurface::~CacaSurface() { 47 CacaSurface::~CacaSurface() {
46 caca_free_dither(dither_); 48 caca_free_dither(dither_);
47 } 49 }
48 50
49 bool CacaSurface::InitializeCanvas() { 51 bool CacaSurface::Initialize() {
50 SkImageInfo info = SkImageInfo::Make(connection_->bitmap_size().width(), 52 SkImageInfo info = SkImageInfo::Make(connection_->bitmap_size().width(),
51 connection_->bitmap_size().height(), 53 connection_->bitmap_size().height(),
52 kPMColor_SkColorType, 54 kPMColor_SkColorType,
53 kPremul_SkAlphaType); 55 kPremul_SkAlphaType);
54 56
55 surface_ = skia::AdoptRef(SkSurface::NewRaster(info)); 57 surface_ = skia::AdoptRef(SkSurface::NewRaster(info));
56 if (!surface_) { 58 if (!surface_) {
57 LOG(ERROR) << "Failed to create SkCanvas"; 59 LOG(ERROR) << "Failed to create SkCanvas";
58 return false; 60 return false;
59 } 61 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { 135 SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
134 NOTREACHED(); 136 NOTREACHED();
135 return false; 137 return false;
136 } 138 }
137 139
138 scoped_ptr<gfx::SurfaceOzoneCanvas> CacaSurfaceFactory::CreateCanvasForWidget( 140 scoped_ptr<gfx::SurfaceOzoneCanvas> CacaSurfaceFactory::CreateCanvasForWidget(
139 gfx::AcceleratedWidget widget) { 141 gfx::AcceleratedWidget widget) {
140 CHECK_EQ(INITIALIZED, state_); 142 CHECK_EQ(INITIALIZED, state_);
141 CHECK_EQ(kDefaultWidgetHandle, widget); 143 CHECK_EQ(kDefaultWidgetHandle, widget);
142 144
143 return make_scoped_ptr<gfx::SurfaceOzoneCanvas>(new CacaSurface(connection_)); 145 scoped_ptr<CacaSurface> canvas(new CacaSurface(connection_));
146 CHECK(canvas->Initialize());
147 return canvas.PassAs<gfx::SurfaceOzoneCanvas>();
144 } 148 }
145 149
146 } // namespace ui 150 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/caca/caca_surface_factory.h ('k') | ui/ozone/platform/caca/ozone_platform_caca.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698