]> git.vomp.tv Git - vompclient.git/blob - osdwinpixel.cc
Display channel name, duration, resume point and size on recording info screen
[vompclient.git] / osdwinpixel.cc
1 /*
2     Copyright 2004-2005 Chris Tallon
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, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20 #include "defines.h"
21
22 #ifndef GRADIENT_DRAWING
23
24 #include "osdwinpixel.h"
25 #include "mtd.h"
26 #include "videowin.h"
27 #include "surfacewin.h"
28
29
30 #include "message.h"
31 #include "command.h"
32
33
34
35 //This is stuff for rendering the OSD
36
37 OsdWinPixel::OsdWinPixel()
38 {
39
40
41   
42 }
43
44 OsdWinPixel::~OsdWinPixel()
45 {
46   if (initted) 
47   {
48                 shutdown();
49   }
50 }
51
52 int OsdWinPixel::getFD()
53 {
54   if (!initted) return 0;
55   return fdOsd;
56 }
57
58 Surface * OsdWinPixel::createNewSurface(){
59         return (Surface*)new SurfaceWin();
60 }
61
62 int OsdWinPixel::init(void* device)
63 {
64   if (initted) return 0;
65
66   if (!createDirect3D9Objects()) return 0;
67   GdiplusStartup(&gdiptoken, &gdipstartup, NULL);
68
69   VideoWin* video = (VideoWin*)Video::getInstance();
70   //Now we will create the Screen
71   screen = new SurfaceWin(Surface::SCREEN);
72   screen->create(video->getScreenWidth(), video->getScreenHeight());
73   screen->display();
74   initted = 1; // must set this here or create surface won't work
75
76   startRenderLoop();
77
78   return 1;
79 }
80
81
82 int OsdWinPixel::shutdown()
83 {
84   if (!initted) return 0;
85   initted = 0;
86   stopRenderLoop();
87   shutdownDirect3D9Objects();
88  
89   Gdiplus::GdiplusShutdown(gdiptoken);
90
91   return 1;
92 }
93
94 void OsdWinPixel::screenShot(const char* fileName)
95 {
96   screen->screenShot(fileName);
97 }
98
99 LPDIRECT3DTEXTURE9 OsdWinPixel::getNextOsdTexture()
100 {
101         return ((SurfaceWin*)screen)->getD3dtexture();
102 }
103
104 void OsdWinPixel::lostDestroyObjects()
105 {
106         ((SurfaceWin*)screen)->ReleaseSurface();
107 }
108
109 void OsdWinPixel::lostRecreateObjects()
110 {
111         Video *video = Video::getInstance();
112         screen->create(video->getScreenWidth(), video->getScreenHeight());
113         screen->display();
114 }
115
116 void OsdWinPixel::getTextureCoordinates(FLOAT*x, FLOAT*y)
117 {
118         Video* video = Video::getInstance();
119         FLOAT texx = ((float)video->getScreenWidth()) / 1024.f;
120         FLOAT texy = ((float)video->getScreenHeight()) / 1024.f;
121         *x = texx;
122         *y = texy;
123
124 }
125 #endif