• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef UI_OZONE_PLATFORM_CACA_CACA_CONNECTION_H_
6 #define UI_OZONE_PLATFORM_CACA_CACA_CONNECTION_H_
7 
8 #include <caca.h>
9 
10 #include "base/macros.h"
11 #include "ui/gfx/geometry/size.h"
12 
13 namespace ui {
14 
15 // Basic initialization of Libcaca. This needs to be shared between SFO and EFO
16 // since both need the |display_| to draw and process events respectively.
17 // Note, |canvas_| needs to be here since it is needed for creating a
18 // |display_|.
19 class CacaConnection {
20  public:
21   CacaConnection();
22   ~CacaConnection();
23 
24   void Initialize();
25 
26   // This is the Caca canvas size.
physical_size()27   gfx::Size physical_size() const { return physical_size_; }
bitmap_size()28   gfx::Size bitmap_size() const { return bitmap_size_; }
display()29   caca_display_t* display() const { return display_; }
30 
31  private:
32   caca_canvas_t* canvas_;
33   caca_display_t* display_;
34 
35   // Size of the console in characters. This can be changed by setting
36   // CACA_GEOMETRY environment variable.
37   gfx::Size physical_size_;
38 
39   // Size of the backing buffer we draw into. Size in pixels.
40   gfx::Size bitmap_size_;
41 
42   DISALLOW_COPY_AND_ASSIGN(CacaConnection);
43 };
44 
45 }  // namespace ui
46 
47 #endif  // UI_OZONE_PLATFORM_CACA_CACA_CONNECTION_H_
48