Fix various warnings with clang build, and adjust cmake clang warnings flags
[blender-staging.git] / source / blender / compositor / operations / COM_TranslateOperation.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_TranslateOperation_h_
24 #define _COM_TranslateOperation_h_
25
26 #include "COM_NodeOperation.h"
27
28 class TranslateOperation : public NodeOperation {
29 private:
30         SocketReader *m_inputOperation;
31         SocketReader *m_inputXOperation;
32         SocketReader *m_inputYOperation;
33         float m_deltaX;
34         float m_deltaY;
35         bool m_isDeltaSet;
36         float m_factorX;
37         float m_factorY;
38 public:
39         TranslateOperation();
40         bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
41         void executePixel(float output[4], float x, float y, PixelSampler sampler);
42
43         void initExecution();
44         void deinitExecution();
45
46         float getDeltaX() { return this->m_deltaX * this->m_factorX; }
47         float getDeltaY() { return this->m_deltaY * this->m_factorY; }
48         
49         inline void ensureDelta() {
50                 if (!this->m_isDeltaSet) {
51                         float tempDelta[4];
52                         this->m_inputXOperation->read(tempDelta, 0, 0, COM_PS_NEAREST);
53                         this->m_deltaX = tempDelta[0];
54                         this->m_inputYOperation->read(tempDelta, 0, 0, COM_PS_NEAREST);
55                         this->m_deltaY = tempDelta[0];
56                         this->m_isDeltaSet = true;
57                 }
58         }
59
60         void setFactorXY(float factorX, float factorY);
61 };
62
63 #endif