~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/gameengine/GamePlayer/netscape/src/ketsji/KXH_MSWindows_services.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * $Id: KXH_MSWindows_services.cpp 28254 2010-04-18 10:28:37Z campbellbarton $
3
 
 *
4
 
 * ***** BEGIN GPL LICENSE BLOCK *****
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU General Public License
8
 
 * as published by the Free Software Foundation; either version 2
9
 
 * of the License, or (at your option) any later version.
10
 
 *
11
 
 * This program 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 this program; if not, write to the Free Software Foundation,
18
 
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
 
 *
20
 
 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21
 
 * All rights reserved.
22
 
 *
23
 
 * The Original Code is: all of this file.
24
 
 *
25
 
 * Contributor(s): none yet.
26
 
 *
27
 
 * ***** END GPL LICENSE BLOCK *****
28
 
 * Implementation of the application hooks between browser and app, 
29
 
 * where app = Ketjsi.
30
 
 */
31
 
 
32
 
#ifdef _WIN32
33
 
 
34
 
#include "SCA_IInputDevice.h"
35
 
//#include "SCA_ISystem.h"
36
 
#include "GPC_MouseDevice.h"
37
 
#include "GPW_KeyboardDevice.h"
38
 
#include "GPW_System.h"
39
 
#include "GPW_Canvas.h"
40
 
#include "GPC_RenderTools.h"
41
 
#include "GPC_RawImage.h"
42
 
#include "GPC_RawLoadDotBlendArray.h"
43
 
#include "GPC_RawLogoArrays.h"
44
 
#include "SND_DeviceManager.h"
45
 
#include "RAS_OpenGLRasterizer.h"
46
 
#include "NG_LoopBackNetworkDeviceInterface.h"
47
 
 
48
 
//#include "PLG_plugin_handles.h"
49
 
#include "NZC_application_callback.h"
50
 
#include "NZC_application_hooks.h"
51
 
#include "KXH_MSWindows_services.h"
52
 
#include "PLG_MSWindows_windowing.h"
53
 
 
54
 
 
55
 
#define GENERATE_LOG
56
 
/* Logging: */
57
 
static void
58
 
log_entry(char* msg);
59
 
 
60
 
 
61
 
void
62
 
KXH_create_devices(
63
 
        ketsji_engine_data* k
64
 
        )
65
 
{
66
 
        int width = 0;
67
 
        int height = 0;
68
 
 
69
 
//      log_entry("KXH_create_devices");
70
 
 
71
 
        k->logic_system = new GPW_System();
72
 
        
73
 
        // devices
74
 
        k->keyboarddevice = new GPW_KeyboardDevice();
75
 
        k->mousedevice  = new GPC_MouseDevice();
76
 
        k->net_dev = new NG_LoopBackNetworkDeviceInterface();
77
 
        
78
 
        // setup audio
79
 
        SND_DeviceManager::Subscribe();
80
 
        SND_DeviceManager::SetDeviceType(snd_e_dummydevice);
81
 
        k->audiodevice = SND_DeviceManager::Instance();
82
 
 
83
 
        /* Apart from the sizes, we don't need to do anything
84
 
         * here. Proper initialization is not an issue here... without
85
 
         * correct canvas, we'd never have ended up here. Why is this
86
 
         * so much different from the win solution ? Because the win
87
 
         * version swaps buffers etc. in the canvas code. There is
88
 
         * less strict separation of concerns on windows...*/
89
 
        width = PLA_get_display_width(k->plugin);
90
 
        height = PLA_get_display_height(k->plugin);
91
 
        HWND winhandle = PLA_get_HWND(k->plugin);
92
 
 
93
 
        HDC ctxhandle = PLA_get_HDC(k->plugin);
94
 
 
95
 
 
96
 
 
97
 
        GPW_Canvas* temp_canv = new GPW_Canvas(winhandle,
98
 
                                               ctxhandle,
99
 
                                               width, 
100
 
                                               height);
101
 
        // does the actual init
102
 
//      log_entry("KXH_create_devices:: initialize canvas:");
103
 
        temp_canv->Init();
104
 
 
105
 
        k->canvas_device = temp_canv;
106
 
 
107
 
        // create a rasterizer
108
 
        k->rasterizer = new RAS_OpenGLRasterizer(k->canvas_device);
109
 
 
110
 
        // Well, rendertools only wraps a few gl-calls...
111
 
        k->rendertools = new GPC_RenderTools();
112
 
 
113
 
}
114
 
 
115
 
void
116
 
KXH_add_banners(
117
 
        ketsji_engine_data* k
118
 
        )
119
 
{
120
 
 
121
 
//      log_entry("KXH_add_banners");
122
 
        
123
 
        GPW_Canvas* c = (GPW_Canvas*) k->canvas_device;
124
 
        
125
 
        k->blender_logo = new GPC_RawImage();
126
 
        k->blender_url_logo = new GPC_RawImage();
127
 
        
128
 
        if(!k->blender_logo->Load("BlenderLogo", 
129
 
                                  128, 128, 
130
 
                                  GPC_RawImage::alignTopLeft, 
131
 
                                  8, 8)) {
132
 
                // Out of memory?
133
 
                k->blender_logo = 0;
134
 
        } else {
135
 
                c->AddBanner(k->blender_logo->Width(), 
136
 
                             k->blender_logo->Height(),
137
 
                             k->blender_logo->Width(), 
138
 
                             k->blender_logo->Height(),
139
 
                             k->blender_logo->Data(), 
140
 
                             GPC_Canvas::alignTopLeft);
141
 
        }
142
 
        
143
 
        if(!k->blender_url_logo->Load("Blender3DLogo", 
144
 
                                      256, 256, 
145
 
                                      GPC_RawImage::alignBottomRight, 
146
 
                                      8, 8)) {
147
 
                // Out of memory?
148
 
                k->blender_url_logo = 0;
149
 
        } else {
150
 
                c->AddBanner(k->blender_url_logo->Width(), 
151
 
                             k->blender_url_logo->Height(),
152
 
                             k->blender_url_logo->Width(), 
153
 
                             k->blender_url_logo->Height(),
154
 
                             k->blender_url_logo->Data(), 
155
 
                             GPC_Canvas::alignBottomRight);
156
 
        }
157
 
        
158
 
        c->SetBannerDisplayEnabled(true);
159
 
}
160
 
 
161
 
 
162
 
static void
163
 
log_entry(char* msg)
164
 
{
165
 
#ifdef GENERATE_LOG
166
 
        FILE* fp = fopen("/tmp/plugin_log","a");
167
 
        if (!fp) return;
168
 
        fprintf(fp, "--> KXH_MSWindows_services::(%p) %s\n", 
169
 
                PR_GetCurrentThread(),
170
 
                msg); 
171
 
        fflush(fp);
172
 
        fclose (fp);
173
 
#endif
174
 
}
175
 
 
176
 
#endif
177