Subject:
regarding banner lagging
From:
sai baba ####@####.####
Date:
6 Feb 2006 08:36:57 +0000
Message-Id: <20060206083653.25398.qmail@web35914.mail.mud.yahoo.com>
hi ,
i have implemented banner with u r idea of 2
offscreen buffers .Now i have lagging problem with the
banner application when i am loading the buffer with
the below given loop.
Here is the buffer fill up routine i implemented(for
scrolling the bmp image from left to right).
GR_IMAGE_ID image_id;
GR_IMAGE_INFO info;
GR_IMAGE_ID p;
int x;//for showing how much buffer filled when the
image is completed
if ( fileptr > nofiles ) //fileptr for keeping track
of the bmp file name
fileptr = 0 ; //if it ends start from first
if ( partial == 1 ) { //partial for image is loaded
partial into buffer or full
if ( fileptr > nofiles )
fileptr = 0 ;
image_id = GrLoadImageFromFile(filenames [
fileptr ] ,0);
GrGetImageInfo(image_id, &info);
p = GrNewPixmap(info.width,h,0);
if ( width >= w ) {
if ( width == w ) { //w,h are the width and
height of the banner window in nanox
partial = 0;
fileptr ++;
}
GrDrawImageToFit( p , gc,0,0,info.width,h,
image_id);// image to be scaled to h
GrCopyArea(offscreen, gc, 0,0,w,h,
p,width-w,0,MWROP_SRCCOPY);
width -= w;
GrDestroyWindow(p);
GrFreeImage(image_id);
return;
}
else {
GrDrawImageToFit( p , gc,0,0,info.width,h,
image_id);
GrCopyArea(offscreen, gc,w-width ,0,width,h,
p,0,0,MWROP_SRCCOPY);
GrFreeImage(image_id);
x = width ;
fileptr ++;
partial = 0 ;
width = 0;
GrDestroyWindow(p); // new code on 02/02
while ( x <= w ) {
if ( fileptr > nofiles )
fileptr = 0 ;
image_id = GrLoadImageFromFile(filenames [
fileptr ] ,0);
// GrDrawImageToFit( p ,
gc,0,0,info.width,h, image_id);
GrGetImageInfo(image_id, &info);
p=GrNewPixmap(info.width,h,0); // new
code on 02/02
GrDrawImageToFit(p,gc,0,0,info.width,h,image_id);
if (info.width >= ( w - x ) ) {
GrCopyArea(offscreen, gc,0 ,0, w - x ,h,
p,info.width-(w-x),0,MWROP_SRCCOPY);
if ( info.width > ( w - x ) ) {
partial = 1;
width = info.width - (w - x) ;
}
else
fileptr ++;
GrDestroyWindow(p);
GrFreeImage(image_id);
return;
}
else {
GrCopyArea(offscreen, gc,w-(x+info.width)
,0,info.width,h, p,0,0,MWROP_SRCCOPY);
GrFreeImage(image_id);
x += info.width;
fileptr ++;
GrDestroyWindow(p);
}
}
}
}
else if ( partial == 0 ) {
if ( fileptr > nofiles )
fileptr = 0 ;
image_id = GrLoadImageFromFile(filenames [
fileptr ] ,0);
GrGetImageInfo(image_id, &info);
p = GrNewPixmap(info.width,h,0);
if (info.width >= w ) {
if ( info.width > w ) {
partial = 1;
width = info.width - w;
}
else
fileptr++;
GrDrawImageToFit( p , gc,0,0,info.width,h,
image_id);// image to be scaled to h
GrCopyArea(offscreen, gc, 0,0,w,h,
p,width,0,MWROP_SRCCOPY);
GrDestroyWindow(p);
GrFreeImage(image_id);
return;
}
else {
GrDrawImageToFit( p , gc,0,0,info.width,h,
image_id);
GrCopyArea(offscreen, gc,w-info.width
,0,info.width ,h, p,0,0,MWROP_SRCCOPY);
GrFreeImage(image_id);
x = info.width ;
fileptr ++;
GrDestroyWindow(p); // new code on 02/02
while ( x <= w ) {
if ( fileptr > nofiles )
fileptr = 0 ;
image_id = GrLoadImageFromFile(filenames [
fileptr ] ,0);
//GrDrawImageToFit( p ,
gc,0,0,info.width,h, image_id);
GrGetImageInfo(image_id, &info);
p=GrNewPixmap(info.width,h,0); // new code
on 02/02
GrDrawImageToFit(p , gc , 0 , 0
,info.width,h,image_id);
if (info.width >= ( w - x ) ) {
GrCopyArea(offscreen, gc,0 ,0, w - x ,h,
p,info.width-(w-x),0,MWROP_SRCCOPY);
if ( info.width > ( w - x ) ) {
partial = 1;
width = info.width - ( w - x ) ;
}
else
fileptr++;
GrDestroyWindow(p);
GrFreeImage(image_id);
return;
}
else {
GrCopyArea(offscreen, gc,w-(x+info.width)
,0, info.width,h, p,0,0,MWROP_SRCCOPY);
GrFreeImage(image_id);
x += info.width;
fileptr ++;
GrDestroyWindow(p);
}
}
}
}
}
Is there any other way of implementing this with some
less processing .
Thanking you
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com