]> git.vomp.tv Git - vompclient.git/blob - src/wtvmedia.cc
Type updates:
[vompclient.git] / src / wtvmedia.cc
1 /*
2     Copyright 2004-2005,2021 Chris Tallon, 2014 Marten Richter
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #include "boxx.h"
21
22 #include "wtvmedia.h"
23
24 WTVMedia::WTVMedia()
25 {
26   media = false;
27   scale = NoZoom;
28 }
29
30 WTVMedia::~WTVMedia()
31 {
32 }
33
34 void WTVMedia::setImage(Image& tImage, Scaling nscale)
35 {
36   image = tImage;
37   scale = nscale;
38   media = true;
39 }
40
41 void WTVMedia::draw()
42 {
43   //Boxx::draw();
44   if (!media) return;
45   float w=0;
46   float h=0;
47   switch (scale)
48   {
49     case ZoomHorizontal:
50       w = static_cast<float>(area.w);
51       break;
52     case ZoomVertical:
53       h = static_cast<float>(area.h);
54       break;
55     case ZoomBoth:
56       w = static_cast<float>(area.w);
57       h = static_cast<float>(area.h);
58       break;
59     case NoZoom:
60     ; // ?
61   }
62   drawImage(image,0.f,0.f,w,h,TopLeft);
63 }