diff scn2k/scn2k_grpimpl.cc @ 71:1fd20d231376

Fix objScale with 2D zoom; implement objWidth and objHeight.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 01 Apr 2011 23:49:12 +0200
parents bdd8a5ff8f46
children f8751d74918b
line wrap: on
line diff
--- a/scn2k/scn2k_grpimpl.cc
+++ b/scn2k/scn2k_grpimpl.cc
@@ -629,9 +629,35 @@ void Grp::impl_objScale(Cmd& cmd) {
 	int base_arg = 0;
 	GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
 
-	int zoom = (cmd.args[base_arg + 1].value + cmd.args[base_arg + 2].value)/2; //FIXME: eurk
+	int zoomx = cmd.args[base_arg + 1].value;
+	zoomx = zoomx*256/100;
+
+	int zoomy = cmd.args[base_arg + 2].value;
+	zoomy = zoomy*256/100;
+
+	g->SetZoomRotate(zoomx, zoomy, -1);
+	cmd.clear();
+}
+
+void Grp::impl_objWidth(Cmd& cmd) {
+	int base_arg = 0;
+	GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
+
+	int zoom = cmd.args[base_arg + 1].value;
 	zoom = zoom*256/100;
-	g->SetZoomRotate(zoom, -1);
+
+	g->SetZoomRotate(zoom, -1, -1);
+	cmd.clear();
+}
+
+void Grp::impl_objHeight(Cmd& cmd) {
+	int base_arg = 0;
+	GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
+
+	int zoom = cmd.args[base_arg + 1].value;
+	zoom = zoom*256/100;
+
+	g->SetZoomRotate(-1, zoom, -1);
 	cmd.clear();
 }
 
@@ -646,7 +672,7 @@ void Grp::impl_objRotate(Cmd& cmd) {
 		angle += 360;
 	}
 	angle %= 360;
-	g->SetZoomRotate(-1, angle);
+	g->SetZoomRotate(-1, -1, angle);
 	cmd.clear();
 }