Blender V2.61 - r43446

tile.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2011, Blender Foundation.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef __TILE_H__
00020 #define __TILE_H__
00021 
00022 #include <limits.h>
00023 
00024 #include "buffers.h"
00025 #include "util_list.h"
00026 
00027 CCL_NAMESPACE_BEGIN
00028 
00029 /* Tile */
00030 
00031 class Tile {
00032 public:
00033     int x, y, w, h;
00034 
00035     Tile(int x_, int y_, int w_, int h_)
00036     : x(x_), y(y_), w(w_), h(h_) {}
00037 };
00038 
00039 /* Tile Manager */
00040 
00041 class TileManager {
00042 public:
00043     BufferParams params;
00044 
00045     struct State {
00046         BufferParams buffer;
00047         int sample;
00048         int resolution;
00049         list<Tile> tiles;
00050     } state;
00051 
00052     TileManager(bool progressive, int samples, int tile_size, int min_size);
00053     ~TileManager();
00054 
00055     void reset(BufferParams& params, int samples);
00056     void set_samples(int samples);
00057     bool next();
00058     bool done();
00059 
00060 protected:
00061     void set_tiles();
00062 
00063     bool progressive;
00064     int samples;
00065     int tile_size;
00066     int min_size;
00067 
00068     int start_resolution;
00069 };
00070 
00071 CCL_NAMESPACE_END
00072 
00073 #endif /* __TILE_H__ */
00074