| OLD | NEW |
| (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 #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 #include "ui/ozone/platform/caca/scoped_caca_types.h" | |
| 13 | |
| 14 namespace ui { | |
| 15 | |
| 16 // Basic initialization of Libcaca. This needs to be shared between SFO and EFO | |
| 17 // since both need the |display_| to draw and process events respectively. | |
| 18 // Note, |canvas_| needs to be here since it is needed for creating a | |
| 19 // |display_|. | |
| 20 class CacaConnection { | |
| 21 public: | |
| 22 CacaConnection(); | |
| 23 ~CacaConnection(); | |
| 24 | |
| 25 bool Initialize(); | |
| 26 | |
| 27 // This is the Caca canvas size. | |
| 28 gfx::Size physical_size() const { return physical_size_; } | |
| 29 gfx::Size bitmap_size() const { return bitmap_size_; } | |
| 30 caca_display_t* display() const { return display_.get(); } | |
| 31 | |
| 32 private: | |
| 33 // Sync sizes with libcaca. | |
| 34 void UpdateDisplaySize(); | |
| 35 | |
| 36 ScopedCacaCanvas canvas_; | |
| 37 ScopedCacaDisplay display_; | |
| 38 | |
| 39 // Size of the console in characters. This can be changed by setting | |
| 40 // CACA_GEOMETRY environment variable. | |
| 41 gfx::Size physical_size_; | |
| 42 | |
| 43 // Size of the backing buffer we draw into. Size in pixels. | |
| 44 gfx::Size bitmap_size_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(CacaConnection); | |
| 47 }; | |
| 48 | |
| 49 } // namespace ui | |
| 50 | |
| 51 #endif // UI_OZONE_PLATFORM_CACA_CACA_CONNECTION_H_ | |
| OLD | NEW |