d2::combine::get_image_dynamic(): Use lrintf() instead of floor() and ceil().
[Ale.git] / optimizations.h
blobaa8b0cbf4b80ae8399dac9ccd853aee21f835022
1 // Copyright 2002, 2003, 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine 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 3 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine 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.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __optimizations_h__
22 #define __optimizations_h__
25 * Class for implementing certain optimizations
28 class optimizations {
29 public:
32 * Get the initial Irani-Peleg approximation.
34 static d2::image *get_ip_working_image(const d2::image *im) {
35 d2::image *result = im->clone("IPC Approximation");
37 #if OPTIMIZATIONS == 1
39 * Reduce the extents of the source. (We might not be able to
40 * delete it, since deletion might be performed by
41 * begin_3d_work().)
43 d2::image *im_noconst = (d2::image *) im;
44 im_noconst->extend(0, 1 - im->height(), 0, 1 - im->width());
45 #endif
47 return result;
51 * When starting work on the 3D scene, get rid of memory allocated
52 * for 2D rendering chains.
54 static void begin_3d_work() {
55 #if OPTIMIZATIONS == 1
56 d2::render::free_all_memory();
57 #endif
62 #endif