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 // TODO(dnicoara) As an optimization, |bitmap_size_| should be scaled based on
12 // |physical_size_| and font size.
CacaConnection()13 CacaConnection::CacaConnection()
14 : canvas_(NULL),
15 display_(NULL),
16 physical_size_(160, 48),
17 bitmap_size_(800, 600) {}
18
~CacaConnection()19 CacaConnection::~CacaConnection() {
20 if (display_) {
21 caca_free_display(display_);
22 caca_free_canvas(canvas_);
23 }
24 }
25
Initialize()26 void CacaConnection::Initialize() {
27 if (display_)
28 return;
29
30 canvas_ = caca_create_canvas(physical_size_.width(), physical_size_.height());
31 display_ = caca_create_display(canvas_);
32
33 physical_size_.SetSize(caca_get_canvas_width(canvas_),
34 caca_get_canvas_height(canvas_));
35
36 caca_set_cursor(display_, 1);
37 caca_set_display_title(display_, "Ozone Content Shell");
38 }
39
40 } // namespace ui
41