2012-06-13 12:34:56 +00:00
|
|
|
/*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2019-02-18 07:21:50 +11:00
|
|
|
*
|
|
|
|
|
* Copyright 2011, Blender Foundation.
|
2012-06-13 12:34:56 +00:00
|
|
|
*/
|
|
|
|
|
|
2018-08-08 11:49:51 +10:00
|
|
|
#pragma once
|
2020-08-07 09:50:34 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
#include "COM_NodeOperation.h"
|
|
|
|
|
|
2021-03-23 17:12:27 +01:00
|
|
|
namespace blender::compositor {
|
|
|
|
|
|
2014-04-15 16:06:12 +02:00
|
|
|
class SingleThreadedOperation : public NodeOperation {
|
2012-06-13 12:34:56 +00:00
|
|
|
private:
|
2021-10-13 23:01:15 +02:00
|
|
|
MemoryBuffer *cached_instance_;
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
protected:
|
2021-10-13 23:01:15 +02:00
|
|
|
inline bool is_cached()
|
2012-06-13 12:34:56 +00:00
|
|
|
{
|
2021-10-13 23:01:15 +02:00
|
|
|
return cached_instance_ != nullptr;
|
2012-06-13 12:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
2014-04-15 16:06:12 +02:00
|
|
|
SingleThreadedOperation();
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
/**
|
2021-01-05 15:44:09 +01:00
|
|
|
* The inner loop of this operation.
|
2012-06-13 23:31:47 +00:00
|
|
|
*/
|
2021-10-13 23:01:15 +02:00
|
|
|
void execute_pixel(float output[4], int x, int y, void *data) override;
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
/**
|
2012-06-13 23:31:47 +00:00
|
|
|
* Initialize the execution
|
|
|
|
|
*/
|
2021-10-13 23:01:15 +02:00
|
|
|
void init_execution() override;
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
/**
|
2012-06-13 23:31:47 +00:00
|
|
|
* Deinitialize the execution
|
|
|
|
|
*/
|
2021-10-13 23:01:15 +02:00
|
|
|
void deinit_execution() override;
|
2012-06-13 12:34:56 +00:00
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
void *initialize_tile_data(rcti *rect) override;
|
2012-06-13 12:34:56 +00:00
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
virtual MemoryBuffer *create_memory_buffer(rcti *rect) = 0;
|
2012-06-13 12:34:56 +00:00
|
|
|
};
|
2021-03-23 17:12:27 +01:00
|
|
|
|
|
|
|
|
} // namespace blender::compositor
|