1 /* ResidualVM - A 3D game interpreter
2 *
3 * ResidualVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the AUTHORS
5 * file distributed with this source distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23 #include "engines/stark/visual/effects/effect.h"
24
25 #include "graphics/surface.h"
26
27 #include "engines/stark/gfx/driver.h"
28 #include "engines/stark/gfx/surfacerenderer.h"
29 #include "engines/stark/gfx/texture.h"
30 #include "engines/stark/services/services.h"
31 #include "engines/stark/services/settings.h"
32
33 namespace Stark {
34
VisualEffect(VisualType type,const Common::Point & size,Gfx::Driver * gfx)35 VisualEffect::VisualEffect(VisualType type, const Common::Point &size, Gfx::Driver *gfx) :
36 Visual(type),
37 _size(size),
38 _gfx(gfx),
39 _timeBetweenTwoUpdates(3 * 33), // ms (frames @ 30 fps)
40 _timeRemainingUntilNextUpdate(0) {
41 _surface = new Graphics::Surface();
42 _surface->create(size.x, size.y, Gfx::Driver::getRGBAPixelFormat());
43
44 _texture = _gfx->createBitmap(_surface);
45 _texture->setSamplingFilter(StarkSettings->getImageSamplingFilter());
46
47 _surfaceRenderer = _gfx->createSurfaceRenderer();
48 }
49
~VisualEffect()50 VisualEffect::~VisualEffect() {
51 if (_surface) {
52 _surface->free();
53 }
54 delete _surface;
55 delete _texture;
56 delete _surfaceRenderer;
57 }
58
59 } // End of namespace Stark
60