From f071afe243ec7d8eef04319413611f74d46e34ae Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 21 Aug 2008 21:42:48 +0000 Subject: Code cleanup. svn path=/trunk/netsurf/; revision=5167 --- amiga/compat.c | 11 ++++++++++- amiga/font.c | 3 ++- amiga/object.c | 35 ----------------------------------- amiga/object.h | 2 ++ amiga/plotters.c | 35 ++++++++++++++++++++--------------- 5 files changed, 34 insertions(+), 52 deletions(-) diff --git a/amiga/compat.c b/amiga/compat.c index 39b17e370..c87f5ba0d 100755 --- a/amiga/compat.c +++ b/amiga/compat.c @@ -57,12 +57,21 @@ int uname(struct utsname *uts) if(VersionBase = OpenLibrary("version.library",50)) { sprintf(uts->release,"%ld.%ld",VersionBase->lib_Version,VersionBase->lib_Version); + + if((VersionBase->lib_Version >= 50) && (VersionBase->lib_Version <=52)) + { + strcpy(uts->version,"4.0"); + } + else if((VersionBase->lib_Version >= 53)) + { + strcpy(uts->version,"4.1"); + } + CloseLibrary(VersionBase); } strcpy(uts->sysname,"AmigaOS"); strcpy(uts->nodename,"amiga"); - strcpy(uts->version,"4.0"); strcpy(uts->machine,"ppc"); } diff --git a/amiga/font.c b/amiga/font.c index 1bb0674c2..3d476c0e2 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -75,6 +75,7 @@ bool nsfont_position_in_string(const struct css_style *style, { struct TextExtent extent; struct TextFont *tfont = ami_open_font(style); + *char_offset = TextFit(currp,string,length, &extent,NULL,1,x,32767); @@ -228,5 +229,5 @@ void ami_close_font(struct TextFont *tfont) RPTAG_Font,origrpfont, TAG_DONE); - CloseFont(tfont); + if(tfont) CloseFont(tfont); } diff --git a/amiga/object.c b/amiga/object.c index 2cfd5d020..32886fe89 100755 --- a/amiga/object.c +++ b/amiga/object.c @@ -43,7 +43,6 @@ struct nsObject *AddObject(struct MinList *objlist,ULONG otype) AddTail((struct List *)objlist,(struct Node *)dtzo); dtzo->Type = otype; -// dtzo->SubType = ostype; return(dtzo); } @@ -63,45 +62,11 @@ void FreeObjList(struct MinList *objlist) node = (struct nsObject *)objlist->mlh_Head; -// for(node = objlist->mlh_Head ; node->dtz_Node.mln_Succ ; node = node->dtz_Node.mln_Succ) - while(nnode=(struct nsObject *)(node->dtz_Node.mln_Succ)) { - printf("%lx next %lx node objtype %ld\n",node,nnode,node->Type); DelObject(node); node=nnode; } FreeVec(objlist); } - -/* -int main(int argc, char **argv) -{ - struct MinList *ol; - struct DTZObject *dtzo; - struct DTZObject *tobj; - - ol = NewObjList(); - - - tobj = AddObject(ol); - - tobj->Data = 6; - - dtzo = AddObject(ol); - - dtzo->Data = 7; - -// tobj = (struct DTZObject *)ol->mlh_Head; - -// tobj = ol->dtz_Node.mln_Succ; - -// printf("%ld\n",tobj->Data); - - FreeObjList(ol); - - return(0); -} - -*/ diff --git a/amiga/object.h b/amiga/object.h index fc5e48d6f..33e41b2be 100755 --- a/amiga/object.h +++ b/amiga/object.h @@ -23,6 +23,8 @@ #define AMINS_CALLBACK 0 #define AMINS_WINDOW 1 +#define AMINS_FRAME 2 +#define AMINS_DLWINDOW 3 struct nsObject { diff --git a/amiga/plotters.c b/amiga/plotters.c index e3f167d03..de416ab06 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -51,17 +51,22 @@ const struct plotter_table amiplot = { NULL, //ami_group_end, ami_flush, // optional ami_path, - 0 // option_knockout + true // option_knockout }; bool ami_clg(colour c) { DebugPrintF("clg %lx\n",c); - SetDrMd(currp,BGBACKFILL); + SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,c), + TAG_DONE); + + ClearScreen(currp); +/* p96RectFill(currp,clipx0,clipy0,clipx1,clipy1, p96EncodeColor(RGBFB_A8B8G8R8,c)); +*/ return true; } @@ -86,6 +91,10 @@ bool ami_rectangle(int x0, int y0, int width, int height, Draw(currp,x0,y0+height); Draw(currp,x0,y0); + currp->PenWidth = 1; + currp->PenHeight = 1; + currp->LinePtrn = PATT_LINE; + return true; } @@ -106,6 +115,10 @@ bool ami_line(int x0, int y0, int x1, int y1, int width, Move(currp,x0,y0); Draw(currp,x1,y1); + currp->PenWidth = 1; + currp->PenHeight = 1; + currp->LinePtrn = PATT_LINE; + return true; } @@ -115,9 +128,6 @@ bool ami_polygon(int *p, unsigned int n, colour fill) ULONG cx,cy; DebugPrintF("poly\n"); - currp->PenWidth = 1; - currp->PenHeight = 1; - currp->LinePtrn = PATT_LINE; SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill), TAG_DONE); @@ -144,6 +154,9 @@ bool ami_fill(int x0, int y0, int x1, int y1, colour c) bool ami_clip(int x0, int y0, int x1, int y1) { +/* to do - need to actually clip to this region using layers.library */ + + DebugPrintF("clip\n"); clipx0=x0; clipy0=y0; clipx1=x1; @@ -177,10 +190,6 @@ bool ami_disc(int x, int y, int radius, colour c, bool filled) DebugPrintF("disc\n"); - currp->PenWidth = 1; - currp->PenHeight = 1; - currp->LinePtrn = PATT_LINE; - SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c), TAG_DONE); @@ -205,10 +214,6 @@ bool ami_arc(int x, int y, int radius, int angle1, int angle2, CommonFuncsPPC.lha */ DebugPrintF("arc\n"); - currp->PenWidth = 1; - currp->PenHeight = 1; - currp->LinePtrn = PATT_LINE; - return true; } @@ -219,9 +224,9 @@ bool ami_bitmap(int x, int y, int width, int height, DebugPrintF("bitmap plotter %ld %ld %ld %ld (%ld %ld)\n",x,y,width,height,bitmap->width,bitmap->height); -// ami_fill(x,y,x+width,y+height,bg); +/* needs to also scale */ - if(x<0 || y<0) DebugPrintF("NEGATIVE X,Y COORDINATES\n"); +// ami_fill(x,y,x+width,y+height,bg); SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg), TAG_DONE); -- cgit v1.2.3