summaryrefslogtreecommitdiffstats
path: root/xorg/tests/xdemo/xdemo.c
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-02-21 13:43:13 -0800
committerJay Sorg <jay.sorg@gmail.com>2012-02-21 13:43:13 -0800
commit50fec9a21615f6aef311de6ef3f5a5b5365f4e0d (patch)
tree399370d9ff954f25a4a54f4e3712b441b8502ac0 /xorg/tests/xdemo/xdemo.c
parentcadad6e181d2a67698e5eb7cacd6b233ae29eb97 (diff)
downloadxrdp-proprietary-50fec9a21615f6aef311de6ef3f5a5b5365f4e0d.tar.gz
xrdp-proprietary-50fec9a21615f6aef311de6ef3f5a5b5365f4e0d.zip
xorg/tests: added smooth3 and 4 option
Diffstat (limited to 'xorg/tests/xdemo/xdemo.c')
-rw-r--r--xorg/tests/xdemo/xdemo.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/xorg/tests/xdemo/xdemo.c b/xorg/tests/xdemo/xdemo.c
index 073516f0..50963fd0 100644
--- a/xorg/tests/xdemo/xdemo.c
+++ b/xorg/tests/xdemo/xdemo.c
@@ -26,6 +26,8 @@
#define SCROLL_JUMP 1 // scroll in increments of g_winHeight
#define SCROLL_SMOOTH1 2 // scroll using XPutImage + XCopyArea
#define SCROLL_SMOOTH2 3 // scroll using XPutImage only
+#define SCROLL_SMOOTH3 4 // scroll using XPutImage only
+#define SCROLL_SMOOTH4 5 // scroll using XPutImage only
int parse_bmp(char *filename, struct pic_info *);
int drawBMP(char *filename, int scroll_type);
@@ -206,7 +208,8 @@ usage()
printf(" -g <WxH> geometry, default is 640x480\n");
printf(" -c <count> iteration count, default is 5000\n");
printf(" -d <delay> loop delay in micro seconds, default 1000\n");
- printf(" -o <jump|smooth1|smooth2> define scrolling method\n");
+ printf(" -o <jump|smooth1|smooth2| define scrolling method\n");
+ printf(" smooth3|smooth4>\n");
printf(" -z <proxy_app> zero proxy counters for specified application\n\n");
}
@@ -361,6 +364,12 @@ int main(int argc, char **argv)
else if (strcmp(optarg, "smooth2") == 0) {
scroll_type = SCROLL_SMOOTH2;
}
+ else if (strcmp(optarg, "smooth3") == 0) {
+ scroll_type = SCROLL_SMOOTH3;
+ }
+ else if (strcmp(optarg, "smooth4") == 0) {
+ scroll_type = SCROLL_SMOOTH4;
+ }
else {
fprintf(stderr, "\ninvalid scroll type specified\n\n");
usage();
@@ -535,9 +544,10 @@ int drawBMP(char *filename, int scroll_type)
return 0;
}
+ // copy image to pixelmap
+ XPutImage(g_disp, pixmap, g_gc, image, 0, 0, 0, 0, pic_info.width, pic_info.height);
+
if (scroll_type == SCROLL_JUMP) {
- // copy image to pixelmap
- XPutImage(g_disp, pixmap, g_gc, image, 0, 0, 0, 0, pic_info.width, pic_info.height);
if (pic_info.height <= g_winHeight) {
// image too small - no scrolling required
@@ -583,6 +593,7 @@ int drawBMP(char *filename, int scroll_type)
j = pic_info.height - g_winHeight;
if (scroll_type == SCROLL_SMOOTH1) {
+ printf("running SCROLL_SMOOTH1\n");
XFlush(g_disp);
XPutImage(g_disp, g_win, g_gc, image, 0, 0, 0, 0, pic_info.width, pic_info.height);
XFlush(g_disp);
@@ -598,6 +609,7 @@ int drawBMP(char *filename, int scroll_type)
}
if (scroll_type == SCROLL_SMOOTH2) {
+ printf("running SCROLL_SMOOTH2\n");
XFlush(g_disp);
for (i = 0; i < j; i++)
{
@@ -606,6 +618,33 @@ int drawBMP(char *filename, int scroll_type)
usleep(10000);
}
}
+ if (scroll_type == SCROLL_SMOOTH3) {
+ printf("running SCROLL_SMOOTH3\n");
+ XFlush(g_disp);
+ XCopyArea(g_disp, pixmap, g_win, g_gc, 0, 0, pic_info.width, pic_info.height, 0, 0);
+ XFlush(g_disp);
+ usleep(10000);
+ for (i = 0; i < j; i++)
+ {
+ XCopyArea(g_disp, g_win, g_win, g_gc, 0, 1, g_winWidth, g_winHeight - 1, 0, 0);
+ XCopyArea(g_disp, pixmap, g_win, g_gc, 0, g_winHeight + i, pic_info.width, 1, 0, g_winHeight -1);
+ XFlush(g_disp);
+ usleep(10000);
+ }
+ return 0;
+ }
+
+ if (scroll_type == SCROLL_SMOOTH4) {
+ printf("running SCROLL_SMOOTH4\n");
+ XFlush(g_disp);
+ for (i = 0; i < j; i++)
+ {
+ XCopyArea(g_disp, pixmap, g_win, g_gc, 0, i, pic_info.width, pic_info.height - i, 0, 0);
+ XFlush(g_disp);
+ usleep(10000);
+ }
+ }
+
return 0;
}