blob: 6a6ba765571305a1f9efddd9d80c70cf1b5eb5ee [file] [log] [blame]
Luke Song1d540dd2017-07-13 15:10:35 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef HEALTHD_DRAW_H
18#define HEALTHD_DRAW_H
19
20#include <linux/input.h>
21#include <minui/minui.h>
22
23#include "animation.h"
24
25using namespace android;
26
27class HealthdDraw {
28 public:
29 // Configures font using given animation.
30 HealthdDraw(animation* anim);
31 virtual ~HealthdDraw();
32
33 // Redraws screen.
34 void redraw_screen(const animation* batt_anim, GRSurface* surf_unknown);
35
36 // Blanks screen if true, unblanks if false.
37 virtual void blank_screen(bool blank);
38
39 protected:
40 virtual void clear_screen();
41
42 // returns the last y-offset of where the surface ends.
43 virtual int draw_surface_centered(GRSurface* surface);
44 // Negative x or y coordinates center text.
45 virtual int draw_text(const GRFont* font, int x, int y, const char* str);
46
47 // Negative x or y coordinates position the text away from the opposite edge
48 // that positive ones do.
49 virtual void determine_xy(const animation::text_field& field,
50 const int length, int* x, int* y);
51
52 // Draws battery animation, if it exists.
53 virtual void draw_battery(const animation* anim);
54 // Draws clock text, if animation contains text_field data.
55 virtual void draw_clock(const animation* anim);
56 // Draws battery percentage text if animation contains text_field data.
57 virtual void draw_percent(const animation* anim);
58 // Draws charger->surf_unknown or basic text.
59 virtual void draw_unknown(GRSurface* surf_unknown);
60
61 // Pixel sizes of characters for default font.
62 int char_width_;
63 int char_height_;
64
65 // Width and height of screen in pixels.
66 int screen_width_;
67 int screen_height_;
68
69 // Device screen is split vertically.
70 const bool kSplitScreen;
71 // Pixels to offset graphics towards center split.
72 const int kSplitOffset;
73};
74
75#endif // HEALTHD_DRAW_H