blob: f813bf3675eedc52136f6c1c9f803faac4238fc7 [file] [log] [blame]
Matt Mowere04eee72016-12-31 00:38:57 -06001/*
2 Copyright 2017 TeamWin
3 This file is part of TWRP/TeamWin Recovery Project.
4
5 TWRP is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 TWRP is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with TWRP. If not, see <http://www.gnu.org/licenses/>.
17*/
18
Dees_Troy51a0e822012-09-05 15:24:24 -040019// fill.cpp - GUIFill object
20
21#include <stdarg.h>
22#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
25#include <fcntl.h>
26#include <sys/reboot.h>
27#include <sys/stat.h>
28#include <sys/time.h>
29#include <sys/mman.h>
30#include <sys/types.h>
31#include <sys/ioctl.h>
32#include <time.h>
33#include <unistd.h>
34#include <stdlib.h>
35
36#include <string>
37
38extern "C" {
Dees_Troy2673cec2013-04-02 20:22:16 +000039#include "../twcommon.h"
Dees_Troy51a0e822012-09-05 15:24:24 -040040}
bigbiffd81833a2021-01-17 11:06:57 -050041#include "minuitwrp/minui.h"
Dees_Troy51a0e822012-09-05 15:24:24 -040042
43#include "rapidxml.hpp"
44#include "objects.hpp"
45
Vojtech Bocekede51c52014-02-07 23:58:09 +010046GUIFill::GUIFill(xml_node<>* node) : GUIObject(node)
Dees_Troy51a0e822012-09-05 15:24:24 -040047{
Ethan Yonker21ff02a2015-02-18 14:35:00 -060048 bool has_color = false;
49 mColor = LoadAttrColor(node, "color", &has_color);
50 if (!has_color) {
Dees_Troy2673cec2013-04-02 20:22:16 +000051 LOGERR("No color specified for fill\n");
Vojtech Bocekfafb0c52013-07-25 22:53:02 +020052 return;
Dees_Troya13d74f2013-03-24 08:54:55 -050053 }
Dees_Troy51a0e822012-09-05 15:24:24 -040054
Vojtech Bocekfafb0c52013-07-25 22:53:02 +020055 // Load the placement
Ethan Yonker21ff02a2015-02-18 14:35:00 -060056 LoadPlacement(FindNode(node, "placement"), &mRenderX, &mRenderY, &mRenderW, &mRenderH);
Dees_Troy51a0e822012-09-05 15:24:24 -040057
Vojtech Bocekfafb0c52013-07-25 22:53:02 +020058 return;
Dees_Troy51a0e822012-09-05 15:24:24 -040059}
60
61int GUIFill::Render(void)
62{
Matt Mowera8a89d12016-12-30 18:10:37 -060063 if (!isConditionTrue())
Vojtech Bocekede51c52014-02-07 23:58:09 +010064 return 0;
65
Vojtech Bocekfafb0c52013-07-25 22:53:02 +020066 gr_color(mColor.red, mColor.green, mColor.blue, mColor.alpha);
67 gr_fill(mRenderX, mRenderY, mRenderW, mRenderH);
68 return 0;
Dees_Troy51a0e822012-09-05 15:24:24 -040069}
70