]> hackdaworld.org Git - my-code/dfb-photoshow.git/commitdiff
corrected while loop
authorhackbard <hackbard>
Tue, 25 Feb 2003 17:35:36 +0000 (17:35 +0000)
committerhackbard <hackbard>
Tue, 25 Feb 2003 17:35:36 +0000 (17:35 +0000)
dfb-photoshow.c

index 4975c733f7db7f1700061c2ae76f9abff8029176..6b6c23a6c2c9864537d75b49a1c0c91d298440ae 100644 (file)
@@ -93,30 +93,32 @@ int main(int argc,char **argv) {
  font->Release(font);
 
  /* display pictures */
+ i=2;
  while(state_escape==DIKS_UP) { 
-  for(i=2;i<argc;i++) {
-   DFBCHECK(dfb->CreateImageProvider(dfb,argv[i],&img_prov));
-   DFBCHECK(img_prov->GetSurfaceDescription(img_prov,&dsc));
-   DFBCHECK(dfb->CreateSurface(dfb,&dsc,&logo ));
-   DFBCHECK(img_prov->RenderTo(img_prov,logo,NULL));
-   img_prov->Release(img_prov);
-   DFBCHECK (primary->SetColor(primary,0x00,0x00,0x00,0x00));
-   DFBCHECK(primary->FillRectangle(primary,0,0,screen_width,screen_height));
-   DFBCHECK(primary->SetColor(primary,0x80,0x80,0xff,0xff));
-   DFBCHECK(primary->DrawLine(primary,0,0,screen_width-1,screen_height-1));
-   if((screen_width>=dsc.width)&&(screen_height>=dsc.height)) {
-    DFBCHECK(primary->Blit(primary,logo,NULL,(screen_width-dsc.width)/2,(screen_height-dsc.height)/2));
-   }
-   else {
-    DFBCHECK(primary->StretchBlit(primary,logo,NULL,NULL));
-   }
-   DFBCHECK(primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC));
-   sleep(atoi(argv[1]));
-   logo->Release(logo);
-   DFBCHECK(keyboard->GetKeyState(keyboard,DIKI_ESCAPE,&state_escape));
+  DFBCHECK(dfb->CreateImageProvider(dfb,argv[i],&img_prov));
+  DFBCHECK(img_prov->GetSurfaceDescription(img_prov,&dsc));
+  DFBCHECK(dfb->CreateSurface(dfb,&dsc,&logo ));
+  DFBCHECK(img_prov->RenderTo(img_prov,logo,NULL));
+  img_prov->Release(img_prov);
+  DFBCHECK (primary->SetColor(primary,0x00,0x00,0x00,0x00));
+  DFBCHECK(primary->FillRectangle(primary,0,0,screen_width,screen_height));
+  DFBCHECK(primary->SetColor(primary,0x80,0x80,0xff,0xff));
+  DFBCHECK(primary->DrawLine(primary,0,0,screen_width-1,screen_height-1));
+  if((screen_width>=dsc.width)&&(screen_height>=dsc.height)) {
+   DFBCHECK(primary->Blit(primary,logo,NULL,(screen_width-dsc.width)/2,(screen_height-dsc.height)/2));
   }
+  else {
+   DFBCHECK(primary->StretchBlit(primary,logo,NULL,NULL));
+  }
+  DFBCHECK(primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC));
+  sleep(atoi(argv[1]));
+  logo->Release(logo);
+  DFBCHECK(keyboard->GetKeyState(keyboard,DIKI_ESCAPE,&state_escape));
+  i++;
+  if(i==argc) state_escape=DIKS_DOWN;
  }
 
+
  keyboard->Release(keyboard);
  logo->Release(logo);
  primary->Release(primary);