summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian A. Weber <chris@gna.ch>2020-06-22 17:23:36 +0000
committerChristian A. Weber <chris@gna.ch>2020-06-22 17:23:36 +0000
commit23c25d6ed0e51021e5b8c2183d0cf8d3b6a47ffb (patch)
tree348eea63e6e752362b078efa423ac7d8e4fb2f44
parent82c4383ae7cc27c1d2508d94dedf71deff9dd5e3 (diff)
downloadbobi-23c25d6ed0e51021e5b8c2183d0cf8d3b6a47ffb.tar.gz
bobi-23c25d6ed0e51021e5b8c2183d0cf8d3b6a47ffb.tar.bz2
bobi-23c25d6ed0e51021e5b8c2183d0cf8d3b6a47ffb.zip
get rid of unnecsssary custom rastport/bitmap
-rw-r--r--Picture.c145
1 files changed, 66 insertions, 79 deletions
diff --git a/Picture.c b/Picture.c
index 19213fe..a9e55d5 100644
--- a/Picture.c
+++ b/Picture.c
@@ -7,7 +7,7 @@
#include <graphics/gfxbase.h>
#include "Bobi.h"
-#define MAX(a,b) ((a)>(b)?(a):(b))
+
extern struct Screen *mainscreen;
extern struct Screen *picturescreen;
@@ -21,11 +21,9 @@ extern char PicName[];
extern BYTE arexxflag;
extern char arexxfilename[];
-static struct RastPort *picturerastport;
-
/****************************************************************************
-** Ein IFF-Bild von Disk laden
+** Ein IFF-Bild von Disk laden und auf Screen anzeigen
*/
void LoadPicFunc()
@@ -48,104 +46,100 @@ void LoadPicFunc()
if(ifffile = IFFL_OpenIFF(name, IFFL_MODE_READ))
{
formptr = ifffile;
- if(formptr[2]==ID_ANIM) formptr+=3;
+ if(formptr[2]==ID_ANIM) /* ANIMs enthalten ein FORM ILBM nach dem FORM ANIM */
+ formptr+=3;
if(bmhd = IFFL_GetBMHD(formptr))
{
- CloseScreenFunc();
- if(picturerastport = CreateRastPort(bmhd->nPlanes,
- MAX(bmhd->w,GfxBase->NormalDisplayColumns>>1),
- MAX(bmhd->h,GfxBase->NormalDisplayRows)))
+ static struct TagItem mytagitems[] =
{
- static struct TagItem mytagitems[] =
- {
- SA_Overscan,OSCAN_TEXT,
- SA_AutoScroll,TRUE,
- };
- struct ExtNewScreen ns;
- struct NewWindow nw;
+ SA_Overscan,OSCAN_TEXT,
+ SA_AutoScroll,TRUE,
+ };
+ struct ExtNewScreen ns;
+ struct NewWindow nw;
- ClearMem(&ns,sizeof(ns));
- ClearMem(&nw,sizeof(nw));
+ ClearMem(&ns,sizeof(ns));
+ ClearMem(&nw,sizeof(nw));
- if(OSVERSION(37))
- {
- ns.Width = bmhd->w;
- ns.Height = bmhd->h;
- }
- else
- {
- ns.Width = GfxBase->NormalDisplayColumns>>1;
- ns.Height = GfxBase->NormalDisplayRows;
- }
- ns.Depth = bmhd->nPlanes;
- // ns.Depth = (bmhd->nPlanes > 5) ? bmhd->nPlanes:5;
- ns.ViewModes = IFFL_GetViewModes(formptr);
- ns.CustomBitMap = picturerastport->BitMap;
- ns.Type = CUSTOMSCREEN|CUSTOMBITMAP|SCREENQUIET|SCREENBEHIND|NS_EXTENDED;
- ns.Extension = mytagitems;
-
- nw.IDCMPFlags = IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_DELTAMOVE;
- nw.Flags = WFLG_BACKDROP | WFLG_BORDERLESS
- | WFLG_SIMPLE_REFRESH | WFLG_NOCAREREFRESH
- | WFLG_REPORTMOUSE | WFLG_RMBTRAP;
- nw.Type = CUSTOMSCREEN;
-
- if(picturescreen = OpenScreen(&ns))
+ if(OSVERSION(37))
+ {
+ ns.Width = bmhd->w;
+ ns.Height = bmhd->h;
+ }
+ else
+ {
+ ns.Width = GfxBase->NormalDisplayColumns>>1;
+ ns.Height = GfxBase->NormalDisplayRows;
+ }
+ ns.Depth = bmhd->nPlanes;
+ ns.ViewModes = IFFL_GetViewModes(formptr);
+ ns.Type = CUSTOMSCREEN|SCREENQUIET|SCREENBEHIND|NS_EXTENDED;
+ ns.Extension = mytagitems;
+ nw.IDCMPFlags = IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_DELTAMOVE;
+ nw.Flags = WFLG_BACKDROP | WFLG_BORDERLESS
+ | WFLG_SIMPLE_REFRESH | WFLG_NOCAREREFRESH
+ | WFLG_REPORTMOUSE | WFLG_RMBTRAP;
+ nw.Type = CUSTOMSCREEN;
+
+ CloseScreenFunc();
+
+ if(picturescreen = OpenScreen(&ns))
+ {
+ nw.Screen = picturescreen;
+ nw.Width = picturescreen->Width;
+ nw.Height = picturescreen->Height;
+ if(picturewindow = OpenWindow(&nw))
{
- nw.Screen = picturescreen;
- nw.Width = picturescreen->Width;
- nw.Height = picturescreen->Height;
- if(picturewindow = OpenWindow(&nw))
+ ShowTitle(picturescreen,FALSE);
+ count = IFFL_GetColorTab(formptr,(WORD *)picturepalette);
+ if(count>32)
+ count = 32;
+ CopyMem(picturepalette,mainpalette,count*2);
+ LoadRGB4(&picturescreen->ViewPort,picturepalette,count);
+ WaitBlit(); /* sonst ist der obere Teil des Bildes manchmal kaputt ?! */
+
+ if(IFFL_DecodePic(formptr,&(picturescreen->BitMap)))
{
- ShowTitle(picturescreen,FALSE);
- count = IFFL_GetColorTab(formptr,(WORD *)picturepalette);
- if(count>32) count = 32;
- CopyMem(picturepalette,mainpalette,count*2);
- LoadRGB4(&picturescreen->ViewPort,picturepalette,count);
-
- if(IFFL_DecodePic(formptr,&(picturescreen->BitMap)))
+ if(!arexxflag)
{
- if(!arexxflag)
- {
- ScreenToFront(picturescreen);
- MoveScreen(mainscreen,0,-255);
- MoveScreen(mainscreen,0,255);
- Delay(15);
- ScreenToFront(mainscreen);
- for(count=28; count>0; --count)
- MoveScreen(mainscreen,0,-10);
- }
- }
- else
- {
- CloseScreenFunc();
- ShowIFFError("Error decoding picture");
+ ScreenToFront(picturescreen);
+ MoveScreen(mainscreen,0,-255);
+ MoveScreen(mainscreen,0,255);
+ Delay(15);
+ ScreenToFront(mainscreen);
+ for(count=28; count>0; --count)
+ MoveScreen(mainscreen,0,-10);
}
}
else
{
CloseScreenFunc();
- ShowMonoReq2("Can't open window!");
+ ShowIFFError("Error decoding picture");
}
}
else
{
CloseScreenFunc();
- ShowMonoReq2("Can't open screen!");
+ ShowMonoReq2("Can't open window!");
}
}
- else ShowMonoReq2("No mem for rastport!");
+ else
+ {
+ CloseScreenFunc();
+ ShowMonoReq2("Can't open screen!");
+ }
}
else ShowIFFError("Mangled IFF picture");
IFFL_CloseIFF(ifffile);
}
else ShowIFFError(name);
+ }
- } /* if(FileRequest()) */
UnLockWindows();
}
+
/****************************************************************************
** Picture-Screen schliessen und Bild freigeben
*/
@@ -163,12 +157,5 @@ void CloseScreenFunc()
CloseScreen(picturescreen);
picturescreen = 0;
}
-
- if(picturerastport)
- {
- DeleteRastPort(picturerastport);
- picturerastport = 0;
- }
-
}