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

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

Issue 387953004: ozone: caca: Convert to PlatformWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & nits Created 6 years, 5 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
« no previous file with comments | « ui/ozone/platform/caca/caca_connection.h ('k') | ui/ozone/platform/caca/caca_event_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/ozone/platform/caca/caca_connection.h"
6
7 #include "base/logging.h"
8
9 namespace ui {
10
11 namespace {
12
13 // Size of initial cnavas (in characters).
14 const int kDefaultCanvasWidth = 160;
15 const int kDefaultCanvasHeight = 48;
16
17 } // namespace
18
19 CacaConnection::CacaConnection() {
20 }
21
22 CacaConnection::~CacaConnection() {
23 }
24
25 bool CacaConnection::Initialize() {
26 if (display_)
27 return true;
28
29 canvas_.reset(caca_create_canvas(kDefaultCanvasWidth, kDefaultCanvasHeight));
30 if (!canvas_) {
31 PLOG(ERROR) << "failed to create libcaca canvas";
32 return false;
33 }
34
35 display_.reset(caca_create_display(canvas_.get()));
36 if (!display_) {
37 PLOG(ERROR) << "failed to initialize libcaca display";
38 return false;
39 }
40
41 caca_set_cursor(display_.get(), 1);
42 caca_set_display_title(display_.get(), "Ozone Content Shell");
43
44 UpdateDisplaySize();
45
46 return true;
47 }
48
49 void CacaConnection::UpdateDisplaySize() {
50 physical_size_.SetSize(caca_get_canvas_width(canvas_.get()),
51 caca_get_canvas_height(canvas_.get()));
52
53 bitmap_size_.SetSize(caca_get_display_width(display_.get()),
54 caca_get_display_height(display_.get()));
55 }
56
57 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/caca/caca_connection.h ('k') | ui/ozone/platform/caca/caca_event_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698