From 4d64e4cd434426234a5c313c151cd79b6afc299e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Vehvil=C3=A4inen?= Date: Sat, 6 Jul 2002 17:50:18 +0000 Subject: *** empty log message *** svn path=/trunk/Framestein/; revision=27 --- Plugins/tile.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Plugins/tile.cpp (limited to 'Plugins/tile.cpp') diff --git a/Plugins/tile.cpp b/Plugins/tile.cpp new file mode 100644 index 0000000..47fa5ca --- /dev/null +++ b/Plugins/tile.cpp @@ -0,0 +1,59 @@ +#include +#include +#include "plugin.h" +#include "pixels.h" + +void perform_copy(_frame f1, _frame f2, _args a) +{ + pixels px(f2); + pixel16 *p16; + pixel24 *p24; + pixel32 *p32; + int tile, tiley=-1, prevy=-1; + char *t; + + tile = atoi(a.s); + if(tile<=0) tile=2; + if(t = strstr(a.s, " ")) + { + tiley = atoi(t+1); + if(tiley<=0) tiley=2; + } + + // i could have the switch() inside the while-loop.. + // but is it more efficient this way? + + switch(f1.pixelformat) + { + case 16: + while(!px.eof()) { + if(px.y != prevy) { + p16 = scanline16(f1, (px.y * (tiley>0 ? tiley : tile))%f1.height); + prevy = px.y; + } + px.dot16(p16[ (px.x * tile)%f1.width ]); + px.next(); + } + break; + case 24: + while(!px.eof()) { + if(px.y != prevy) { + p24 = scanline24(f1, (px.y * (tiley>0 ? tiley : tile))%f1.height); + prevy = px.y; + } + px.dot24(p24[ (px.x * tile)%f1.width ]); + px.next(); + } + break; + case 32: + while(!px.eof()) { + if(px.y != prevy) { + p32 = scanline32(f1, (px.y * (tiley>0 ? tiley : tile))%f1.height); + prevy = px.y; + } + px.dot32(p32[ (px.x * tile)%f1.width ]); + px.next(); + } + break; + } +} -- cgit v1.2.1