2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published
4 * by the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
12 * You should have received a copy of the GNU General Public
13 * License along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 #include "overlayframe.h"
19 #include "overlaydirect.h"
21 /* Direct translate / blend **********************************************/
23 DirectPackage::DirectPackage()
27 DirectUnit::DirectUnit(DirectEngine *server)
30 this->engine = server;
33 DirectUnit::~DirectUnit()
37 void DirectUnit::process_package(LoadPackage *package)
39 pkg = (DirectPackage*)package;
40 output = engine->output;
41 input = engine->input;
43 fade = BC_CModels::has_alpha(input->get_color_model()) &&
44 mode == TRANSFER_REPLACE ? 1.f : engine->alpha;
47 ow = engine->out_x2 - ox;
48 iy = engine->in_y1 - engine->out_y1;
50 switch(input->get_color_model()) {
51 case BC_RGB_FLOAT: rgb_float(); break;
52 case BC_RGBA_FLOAT: rgba_float(); break;
53 case BC_RGB888: rgb888(); break;
54 case BC_YUV888: yuv888(); break;
55 case BC_RGBA8888: rgba8888(); break;
56 case BC_YUVA8888: yuva8888(); break;
57 case BC_RGB161616: rgb161616(); break;
58 case BC_YUV161616: yuv161616(); break;
59 case BC_RGBA16161616: rgba16161616(); break;
60 case BC_YUVA16161616: yuva16161616(); break;
64 DirectEngine::DirectEngine(int cpus)
65 : LoadServer(cpus, cpus)
69 DirectEngine::~DirectEngine()
73 void DirectEngine::init_packages()
75 if(in_x1 < 0) { out_x1 -= in_x1; in_x1 = 0; }
76 if(in_y1 < 0) { out_y1 -= in_y1; in_y1 = 0; }
77 if(out_x1 < 0) { in_x1 -= out_x1; out_x1 = 0; }
78 if(out_y1 < 0) { in_y1 -= out_y1; out_y1 = 0; }
79 if(out_x2 > output->get_w()) out_x2 = output->get_w();
80 if(out_y2 > output->get_h()) out_y2 = output->get_h();
81 int out_w = out_x2 - out_x1;
82 int out_h = out_y2 - out_y1;
83 if( !out_w || !out_h ) return;
86 int pkgs = get_total_packages();
87 int row1 = out_y1, row2 = row1;
88 for(int i = 0; i < pkgs; row1=row2 ) {
89 DirectPackage *package = (DirectPackage*)get_package(i);
90 row2 = ++i * rows / pkgs + out_y1;
91 package->out_row1 = row1;
92 package->out_row2 = row2;
96 LoadClient* DirectEngine::new_client()
98 return new DirectUnit(this);
101 LoadPackage* DirectEngine::new_package()
103 return new DirectPackage;