Merging r50049 through r50076 from trunk into soc-2011-tomato
[blender.git] / source / blender / compositor / operations / COM_ViewerBaseOperation.h
1 /*
2  * Copyright 2011, Blender Foundation.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Contributor: 
19  *              Jeroen Bakker 
20  *              Monique Dewanchand
21  */
22
23 #ifndef _COM_ViewerBaseOperation_h
24 #define _COM_ViewerBaseOperation_h
25 #include "COM_NodeOperation.h"
26 #include "DNA_image_types.h"
27 #include "BLI_rect.h"
28
29 class ViewerBaseOperation : public NodeOperation {
30 protected:
31         float *m_outputBuffer;
32         float *m_depthBuffer;
33         unsigned char *m_outputBufferDisplay;
34         Image *m_image;
35         ImageUser *m_imageUser;
36         void *m_lock;
37         bool m_active;
38         float m_centerX;
39         float m_centerY;
40         OrderOfChunks m_chunkOrder;
41         bool m_doColorManagement;
42         bool m_doColorPredivide;
43         bool m_doDepthBuffer;
44         ImBuf *m_ibuf;
45
46 public:
47         bool isOutputOperation(bool rendering) const { return isActiveViewerOutput(); }
48         void initExecution();
49         void deinitExecution();
50         void setImage(Image *image) { this->m_image = image; }
51         void setImageUser(ImageUser *imageUser) { this->m_imageUser = imageUser; }
52         const bool isActiveViewerOutput() const { return this->m_active; }
53         void setActive(bool active) { this->m_active = active; }
54         void setCenterX(float centerX) { this->m_centerX = centerX;}
55         void setCenterY(float centerY) { this->m_centerY = centerY;}
56         void setChunkOrder(OrderOfChunks tileOrder) { this->m_chunkOrder = tileOrder; }
57         float getCenterX() { return this->m_centerX; }
58         float getCenterY() { return this->m_centerY; }
59         OrderOfChunks getChunkOrder() { return this->m_chunkOrder; }
60         const CompositorPriority getRenderPriority() const;
61         void setColorManagement(bool doColorManagement) { this->m_doColorManagement = doColorManagement; }
62         void setColorPredivide(bool doColorPredivide) { this->m_doColorPredivide = doColorPredivide; }
63         bool isViewerOperation() { return true; }
64                 
65 protected:
66         ViewerBaseOperation();
67         void updateImage(rcti *rect);
68
69 private:
70         void initImage();
71 };
72 #endif