aboutsummaryrefslogtreecommitdiff
path: root/Plugins/tile.cpp
diff options
context:
space:
mode:
authorJuha Vehviläinen <jusu@users.sourceforge.net>2002-07-06 17:50:18 +0000
committerJuha Vehviläinen <jusu@users.sourceforge.net>2002-07-06 17:50:18 +0000
commit4d64e4cd434426234a5c313c151cd79b6afc299e (patch)
tree5c23dd6acc65b869741d3bb9d33912d74bb7407d /Plugins/tile.cpp
*** empty log message ***svn2git-root
svn path=/trunk/Framestein/; revision=27
Diffstat (limited to 'Plugins/tile.cpp')
-rw-r--r--Plugins/tile.cpp59
1 files changed, 59 insertions, 0 deletions
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 <stdlib.h>
+#include <string.h>
+#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;
+ }
+}