void DoQuery(char *name) { ULONG *n; struct DTMethod *m; printf("Metodi disponibili per %s.\n",name); printf("\nMetodi:\n"); if (GetDTAttrs(dto,DTA_Methods,&n,TAG_DONE)) { while (*n!=(~0)) printf("%08x ",*n++); printf("\n"); } printf("\nMetodi Trigger:\n"); if (GetDTAttrs(dto,DTA_TriggerMethods,&m,TAG_DONE)) if (m) { while (m->dtm_Label) { printf("Label %-20.20s Command %-20.20s Method %08x\n", m->dtm_Label, m->dtm_Command, m->dtm_Method); m++; } } else printf("Nessuno.\n"); }
bool amiga_dt_picture_convert(struct content *c) { LOG(("amiga_dt_picture_convert")); union content_msg_data msg_data; int width, height; char title[100]; const uint8 *data; UBYTE *bm_buffer; ULONG size; Object *dto; struct BitMapHeader *bmh; unsigned int bm_flags = BITMAP_NEW; int bm_format = PBPAFMT_RGBA; /* This is only relevant for picture datatypes... */ data = (uint8 *)content__get_source_data(c, &size); if(dto = NewDTObject(NULL, DTA_SourceType, DTST_MEMORY, DTA_SourceAddress, data, DTA_SourceSize, size, DTA_GroupID, GID_PICTURE, PDTA_DestMode, PMODE_V43, TAG_DONE)) { if(GetDTAttrs(dto, PDTA_BitMapHeader, &bmh, TAG_DONE)) { width = (int)bmh->bmh_Width; height = (int)bmh->bmh_Height; } else return false; DisposeDTObject(dto); } else return false; c->width = width; c->height = height; c->size = width * height * 4; image_cache_add(c, NULL, amiga_dt_picture_cache_convert); /* snprintf(title, sizeof(title), "image (%lux%lu, %lu bytes)", width, height, size); content__set_title(c, title); */ content_set_ready(c); content_set_done(c); content_set_status(c, ""); return true; }
IPTR Ascii__OM_NEW(Class * cl, Object *o, struct opSet *msg) { IPTR retval; if ((retval = DoSuperMethodA (cl, o, (Msg)msg))) { struct AsciiData *data; IPTR len, estlines, poolsize; BOOL success = FALSE; STRPTR buffer; /* Get a pointer to the object data */ data = INST_DATA (cl, (Object *) retval); /* Get the attributes that we need to determine * memory pool size */ GetDTAttrs ((Object *) retval, TDTA_Buffer , (IPTR)&buffer, TDTA_BufferLen , (IPTR)&len, TAG_DONE); D(bug("AsciiDataType_new: buffer = %x bufferlen = %d\n", buffer, len)); /* Make sure we have a text buffer */ if (buffer && len) { /* Estimate the pool size that we will need */ estlines = (len / 80) + 1; estlines = (estlines > 200) ? 200 : estlines; poolsize = sizeof (struct Line) * estlines; /* Create a memory pool for the line list */ if ((data->Pool = CreatePool (MEMF_CLEAR | MEMF_PUBLIC, poolsize, poolsize))) success = TRUE; else SetIoErr (ERROR_NO_FREE_STORE); } else { /* Indicate that something was missing that we * needed */ SetIoErr (ERROR_REQUIRED_ARG_MISSING); } if (!success) { CoerceMethod (cl, (Object *) retval, OM_DISPOSE); retval = 0; } } return retval; }
bool amiga_dt_picture_convert(struct content *c) { LOG(("amiga_dt_picture_convert")); union content_msg_data msg_data; int width, height; char *title; UBYTE *bm_buffer; Object *dto; struct BitMapHeader *bmh; unsigned int bm_flags = BITMAP_NEW; int bm_format = PBPAFMT_RGBA; char *filetype; if(dto = amiga_dt_picture_newdtobject((struct amiga_dt_picture_content *)c)) { if(GetDTAttrs(dto, PDTA_BitMapHeader, &bmh, TAG_DONE)) { width = (int)bmh->bmh_Width; height = (int)bmh->bmh_Height; } else return false; } else return false; c->width = width; c->height = height; c->size = width * height * 4; /* set title text */ if(filetype = amiga_dt_picture_datatype(c)) { title = messages_get_buff("DataTypesTitle", nsurl_access_leaf(llcache_handle_get_url(c->llcache)), filetype, c->width, c->height); if (title != NULL) { content__set_title(c, title); free(title); } free(filetype); } image_cache_add(c, NULL, amiga_dt_picture_cache_convert); content_set_ready(c); content_set_done(c); content_set_status(c, ""); return true; }
bool amiga_dt_picture_convert(struct content *c) { NSLOG(netsurf, INFO, "amiga_dt_picture_convert"); int width, height; char *title; Object *dto; struct BitMapHeader *bmh; char *filetype; if((dto = amiga_dt_picture_newdtobject((struct amiga_dt_picture_content *)c))) { if(GetDTAttrs(dto, PDTA_BitMapHeader, &bmh, TAG_DONE)) { width = (int)bmh->bmh_Width; height = (int)bmh->bmh_Height; } else return false; } else return false; c->width = width; c->height = height; c->size = width * height * 4; /* set title text */ if((filetype = amiga_dt_picture_datatype(c))) { title = messages_get_buff("DataTypesTitle", nsurl_access_leaf(llcache_handle_get_url(c->llcache)), filetype, c->width, c->height); if (title != NULL) { content__set_title(c, title); free(title); } free(filetype); } image_cache_add(c, NULL, amiga_dt_picture_cache_convert); content_set_ready(c); content_set_done(c); content_set_status(c, ""); return true; }
IPTR Ascii__OM_DISPOSE(Class *cl, Object *o, Msg msg) { struct AsciiData *data; struct List *linelist = 0; IPTR retval; /* Get a pointer to our object data */ data = INST_DATA (cl, o); /* Don't let the super class free the line list */ if (GetDTAttrs (o, TDTA_LineList, (IPTR) &linelist, TAG_DONE) && linelist) NewList (linelist); /* Delete the line pool */ DeletePool (data->Pool); retval = DoSuperMethodA(cl, o, msg); return retval; }
/************* * DESCRIPTION: Loads a image with the datatypes. * INPUT: filename name of picture to load * OUTPUT: FALSE if failed *************/ BOOL IMAGE::LoadAsDatatype(char *filename) { struct Library *PictureDTBase; BOOL pic24bit; // TRUE for new 24bit picture.datatype (V43) Object *obj; struct BitMapHeader *bmhd; struct BitMap *bitmap, *tempbitmap; int x,y; SMALL_COLOR *c; UBYTE *colreg, *buffer; int color; ULONG modeid; struct DisplayInfo dispinfo; UBYTE r,g,b; struct RastPort rp, temprp; struct gpBlitPixelArray arg; DataTypesBase = OpenLibrary((unsigned char*)"datatypes.library", 39); if(!DataTypesBase) return FALSE; // try to open the 24bit picture datatype PictureDTBase = OpenLibrary("datatypes/picture.datatype", 43L); if(PictureDTBase) { // we only need the picture.datatype to test the version, therefore // close it now CloseLibrary(PictureDTBase); pic24bit = TRUE; } else pic24bit = FALSE; if(!pic24bit) { // no 24bit version available // get the picture object obj = NewDTObject(filename, DTA_SourceType, DTST_FILE, DTA_GroupID, GID_PICTURE, PDTA_Remap, FALSE, TAG_DONE); if(!obj) { CloseLibrary(DataTypesBase); return FALSE; } } else { // get the picture object obj = NewDTObject(filename, DTA_SourceType, DTST_FILE, DTA_GroupID, GID_PICTURE, PDTA_Remap, FALSE, PDTA_DestMode, MODE_V43, TAG_DONE); if(!obj) { CloseLibrary(DataTypesBase); return FALSE; } } // get the bitmap header if(GetDTAttrs(obj, PDTA_ColorRegisters, &colreg, PDTA_BitMap, &bitmap, PDTA_ModeID, &modeid, PDTA_BitMapHeader, &bmhd, TAG_DONE) != 4) { DisposeDTObject(obj); CloseLibrary(DataTypesBase); return FALSE; } if(!bmhd || !bitmap) { DisposeDTObject(obj); CloseLibrary(DataTypesBase); return FALSE; } width = bmhd->bmh_Width; height = bmhd->bmh_Height; if(!GetDisplayInfoData(NULL, (UBYTE*)&dispinfo, sizeof(struct DisplayInfo), DTAG_DISP, modeid)) { DisposeDTObject(obj); CloseLibrary(DataTypesBase); return FALSE; } colormap = (SMALL_COLOR*)malloc(sizeof(SMALL_COLOR)*width*height); if(!colormap) { DisposeDTObject(obj); CloseLibrary(DataTypesBase); return FALSE; } c = colormap; if((bmhd->bmh_Depth > 8) && pic24bit) { // true color picture buffer = (UBYTE*)AllocVec(3*width, MEMF_PUBLIC); if(!buffer) { DisposeDTObject(obj); CloseLibrary(DataTypesBase); return FALSE; } for(y=0; y<height; y++) { arg.MethodID = DTM_READPIXELARRAY; arg.PixelArray = buffer; arg.PixelArrayMode = RECTFMT_RGB; arg.PixelArrayMod = 3*width; arg.LeftEdge = 0; arg.TopEdge = y; arg.Width = width; arg.Height = 1; #ifdef __PPC__ ppc_DoMethodA(obj, (Msg)&arg); #else DoMethodA(obj, (Msg)&arg); #endif for(x=0; x<width; x++) { c->r = buffer[x*3]; c->g = buffer[x*3+1]; c->b = buffer[x*3+2]; c++; } } FreeVec(buffer); } else { // normal picture // planar to chunky conversion InitRastPort(&rp); rp.BitMap = bitmap; tempbitmap = AllocBitMap(width, 1, bmhd->bmh_Depth, BMF_CLEAR, NULL); if(!tempbitmap) { DisposeDTObject(obj); CloseLibrary(DataTypesBase); return FALSE; } InitRastPort(&temprp); temprp.BitMap = tempbitmap; buffer = (UBYTE*)AllocVec((width+15)&(~15), MEMF_PUBLIC); if(!buffer) { FreeBitMap(tempbitmap); DisposeDTObject(obj); CloseLibrary(DataTypesBase); return FALSE; } if(dispinfo.PropertyFlags & DIPF_IS_HAM) { // Simulate HAM mode if(bmhd->bmh_Depth == 8) { // Super HAM for(y=0; y<height; y++) { r = g = b = 0; ReadPixelLine8(&rp, 0, y, width, buffer, &temprp); for(x=0; x<width; x++) { color = buffer[x]; switch(color & 0xc0) { case 0x00: // Take it from color registers color *= 3; r = colreg[color]; g = colreg[color+1]; b = colreg[color+2]; break; case 0x40: // modify blue b = color << 2; break; case 0x80: // modify red r = color << 2; break; case 0xc0: // modify green g = color << 2; break; } c->r = r; c->g = g; c->b = b; c++; } } } else { // Normal HAM for(y=0; y<height; y++) { r = g = b = 0; ReadPixelLine8(&rp, 0, y, width, buffer, &temprp); for(x=0; x<width; x++) { color = buffer[x]; switch(color & 0x30) { case 0x00: // Take it from color registers color *= 3; r = colreg[color]; g = colreg[color+1]; b = colreg[color+2]; break; case 0x40: // modify blue b = color << 4; break; case 0x80: // modify red r = color << 4; break; case 0xc0: // modify green g = color << 4; break; } c->r = r; c->g = g; c->b = b; c++; } } } } else { for(y=0; y<height; y++) { ReadPixelLine8(&rp, 0, y, width, buffer, &temprp); for(x=0; x<width; x++) { color = buffer[x]; color *= 3; c->r = colreg[color]; c->g = colreg[color+1]; c->b = colreg[color+2]; c++; } } } FreeVec(buffer); FreeBitMap(tempbitmap); } DisposeDTObject(obj); CloseLibrary(DataTypesBase); return TRUE; }
void shutdownwnd_open(void) { if ((scr = LockPubScreen(NULL))) { char *filename; /* get a white pen for the color of our text */ pen = ObtainBestPenA(scr->ViewPort.ColorMap,0xffffffff,0xffffffff,0xffffffff,NULL); if ((filename = mycombinepath(gui_get_images_directory(),"shutdown"))) { if ((obj = LoadAndMapPicture("PROGDIR:Images/shutdown",scr))) { struct BitMapHeader *bmhd = NULL; struct BitMap *bitmap = NULL; GetDTAttrs(obj,PDTA_BitMapHeader,&bmhd,TAG_DONE); GetDTAttrs(obj,PDTA_DestBitMap,&bitmap,TAG_DONE); if (!bitmap) GetDTAttrs(obj,PDTA_BitMap,&bitmap,TAG_DONE); if (bmhd && bitmap) { int width = bmhd->bmh_Width; int height = bmhd->bmh_Height; int wndleft,wndtop; wndleft = (scr->Width - width)/2; wndtop = (scr->Height - height)/2; if ((shutdown_wnd = OpenWindowTags(NULL, WA_SmartRefresh, TRUE, WA_NoCareRefresh, TRUE, WA_Borderless, TRUE, WA_Width, width, WA_Height, height, WA_PubScreen, scr, WA_Left, wndleft, WA_Top, wndtop, WA_BackFill, LAYERS_NOBACKFILL, TAG_DONE))) { BltBitMapRastPort(bitmap,0,0, shutdown_wnd->RPort, 0, 0, width, height, 0xc0); if (!user.config.dont_show_shutdown_text) { struct TextExtent te; const char *txt = _("Shutting down..."); SetDrMd(shutdown_wnd->RPort,JAM1); SetAPen(shutdown_wnd->RPort,pen); TextExtent(shutdown_wnd->RPort,txt,strlen(txt),&te); if ((te.te_Width < width) && (te.te_Height < height)) { /* only draw the text if there is enought space for it */ Move(shutdown_wnd->RPort,(width - te.te_Width)/2, height - te.te_Height - 4 + shutdown_wnd->RPort->TxBaseline); Text(shutdown_wnd->RPort,txt,strlen(txt)); } } } } } free(filename); } } }
// Load a backfill pattern; pattern must be locked exclusively void GetPattern(PatternData *pattern,struct Screen *screen,ULONG border_col) { // Initially make invalid pattern->valid=FALSE; pattern->border_pen=0; // Set screen pointer pattern->screen=screen; // Check for invalid data if (!pattern->data) { // Update border pen GetPatternBorder(pattern,screen,border_col); return; } // Bitmap pattern? if (pattern->prefs.wbp_Flags&WBPF_PATTERN) { UWORD *ptr,*planes[MAXDEPTH]; short num,row,col,pen; // Get plane pointers for (num=0;num<pattern->prefs.wbp_Depth;num++) { planes[num]=((UWORD *)pattern->data)+(PAT_HEIGHT*num); } pattern->fill_plane_key=0; // Clear fill initially for (num=0,ptr=pattern->fill[0];num<128;num++,ptr++) *ptr=0; // Under 37 use fill pattern as supplied if (((struct Library *)GfxBase)->lib_Version<39) { for (num=0;num<pattern->prefs.wbp_Depth;num++) { CopyMem( (char *)planes[num], (char *)pattern->fill[num], PAT_HEIGHT*sizeof(UWORD)); } pattern->fill_plane_key=pattern->prefs.wbp_Depth; } // Otherwise, we need to remap else { // Go through pattern rows for (row=0;row<PAT_HEIGHT;row++) { // Go through bits for (col=0;col<PAT_WIDTH;col++) { // Clear pen pen=0; // Calculate pixel colour for (num=0;num<pattern->prefs.wbp_Depth;num++) { // Is bit set in this bitplane? if (planes[num][row]&(1<<col)) pen|=(1<<num); } // Pixel set? if (pen) { // Map pens 4-7 to top four colours if (pen>=4 && screen->RastPort.BitMap->Depth<=8) { pen=(1<<screen->RastPort.BitMap->Depth)-(8-pen); } // Remap for (num=0;num<8;num++) { // Want this bit? if (pen&(1<<num)) { // Set bit pattern->fill[num][row]|=1<<col; if (num>=pattern->fill_plane_key) pattern->fill_plane_key=num+1; } } } } } } // Any data? if (pattern->fill_plane_key>0) { short depth; // Get depth for bitmap if (((struct Library *)GfxBase)->lib_Version>=39) depth=GetBitMapAttr(screen->RastPort.BitMap,BMA_DEPTH); else depth=screen->RastPort.BitMap->Depth; // Check its not too deep if (depth>8) depth=8; // Allocate bitmap for pattern if ((pattern->pattern_bitmap= NewBitMap( PATTILE_SIZE, PATTILE_SIZE, depth, BMF_CLEAR, 0))) { struct RastPort rp; struct BitMap *bitmap; // Initialise dummy rastport InitRastPort(&rp); rp.BitMap=pattern->pattern_bitmap; // Set fill pattern SetAfPt(&rp,pattern->fill[0],-4); // Fill bitmap SetRast(&rp,0); RectFill(&rp,0,0,PATTILE_SIZE-1,PATTILE_SIZE-1); // Is the screen a non-standard bitmap? if (((struct Library *)GfxBase)->lib_Version>=39 && !(GetBitMapAttr(screen->RastPort.BitMap,BMA_FLAGS)&BMF_STANDARD)) { // Try and allocate friend bitmap if ((bitmap= NewBitMap( PATTILE_SIZE, PATTILE_SIZE, depth, BMF_CLEAR, screen->RastPort.BitMap))) { // Copy to friend bitmap BltBitMap( pattern->pattern_bitmap,0,0, bitmap,0,0, PATTILE_SIZE,PATTILE_SIZE, 0xc0,0xff,0); // Free original bitmap DisposeBitMap(pattern->pattern_bitmap); // Use new bitmap pointer pattern->pattern_bitmap=bitmap; } } // Get bitmap pointer pattern->bitmap=pattern->pattern_bitmap; // Get pattern size pattern->width=PATTILE_SIZE; pattern->height=PATTILE_SIZE; } } } // Picture; must have datatypes else if (DataTypesBase) { short len; BOOL remap=1; long precision=PRECISION_IMAGE; char name[256]; long ver=0; struct Library *pdt; #ifdef PATCH_OK APTR patchhandle=0; #endif // Check picture datatype version if ((pdt=OpenLibrary("sys:classes/datatypes/picture.datatype",0)) || (pdt=OpenLibrary("picture.datatype",0))) { // Get version ver=pdt->lib_Version; CloseLibrary(pdt); } // No remap? if ((len=strlen(pattern->data))>8 && stricmp(pattern->data+len-8,".noremap")==0) remap=0; // Precision? if (len>6 && stricmp(pattern->data+len-6,".exact")==0) precision=PRECISION_EXACT; // Specified in prefs? else if (pattern->precision) { if (pattern->precision==-1) remap=0; else if (pattern->precision==1) precision=PRECISION_ICON; else if (pattern->precision==2) precision=PRECISION_GUI; else if (pattern->precision==3) precision=PRECISION_EXACT; } #ifdef PATCH_OK // If we've got v43 of the datatype, we don't need the fastram patch if (ver<43) { // Add this task to the patchlist for allocbitmap patchhandle=AddAllocBitmapPatch(FindTask(0),screen); } #endif // Turn back on requesters ((struct Process *)FindTask(0))->pr_WindowPtr=GUI->window; // Check for random pictures, and then load picture if (pattern_check_random(pattern,name) && (pattern->object= NewDTObject(name, DTA_GroupID,GID_PICTURE, PDTA_Screen,screen, PDTA_FreeSourceBitMap,TRUE, (ver>42)?PDTA_DestMode:TAG_IGNORE,MODE_V43, (ver>42)?PDTA_UseFriendBitMap:TAG_IGNORE,TRUE, TAG_END))) { struct BitMapHeader *header; struct BitMap *bitmap; D_S(struct FileInfoBlock, fib) // Get file information if (GetFileInfo(name,fib) && strnicmp(fib->fib_Comment,"dopus ",6)==0) { char *args=fib->fib_Comment+6; short val; rexx_skip_space(&args); while ((val=rexx_match_keyword(&args,background_key,0))!=-1) { // Tile/center/stretch if (val==3) pattern->flags&=~(PATF_CENTER|PATF_STRETCH); else if (val==4) { pattern->flags|=PATF_CENTER; pattern->flags&=~PATF_STRETCH; } else if (val==5 && pattern->prefs.wbp_Which==0) { pattern->flags|=PATF_STRETCH; pattern->flags&=~PATF_CENTER; } // Precision else if (val==6) { // Get precision rexx_skip_space(&args); if ((val=rexx_match_keyword(&args,precision_key,0))>-1) { if (val==0) remap=0; else if (val==1) precision=PRECISION_GUI; else if (val==2) precision=PRECISION_ICON; else if (val==3) precision=PRECISION_IMAGE; else if (val==4) precision=PRECISION_EXACT; } } // Border else if (val==8) { // Off? rexx_skip_space(&args); if (rexx_match_keyword(&args,on_off_strings2,0)==0) border_col&=~ENVBF_USE_COLOUR; else { border_col=ENVBF_USE_COLOUR; border_col|=Atoh(args,-1)<<8; } } } } // Layout picture (should check for success) SetDTAttrs(pattern->object,0,0, OBP_Precision,precision, PDTA_Remap,remap, TAG_END); DoMethod(pattern->object,DTM_PROCLAYOUT,0,1); // Get bitmap pointer and header GetDTAttrs(pattern->object, PDTA_BitMap,&bitmap, PDTA_DestBitMap,&pattern->bitmap, PDTA_BitMapHeader,&header, TAG_END); // No dest bitmap? if (!pattern->bitmap) pattern->bitmap=bitmap; // Valid bitmap? if (pattern->bitmap) { // Get width and height pattern->width=header->bmh_Width; pattern->height=header->bmh_Height; } } // Turn off requesters ((struct Process *)FindTask(0))->pr_WindowPtr=(APTR)-1; #ifdef PATCH_OK // Remove this task from the patchlist for allocbitmap if (patchhandle) RemAllocBitmapPatch(patchhandle); #endif // Got bitmap? if (pattern->bitmap) { // Stretch? if (pattern->flags&PATF_STRETCH) { // Not the size of the screen? if (pattern->width!=screen->Width || pattern->height!=screen->Height) { // Allocate a bitmap for the stretched picture if ((pattern->pattern_bitmap= NewBitMap( screen->Width, screen->Height, GetBitMapAttr(pattern->bitmap,BMA_DEPTH), BMF_CLEAR, screen->RastPort.BitMap))) { struct BitScaleArgs scale; // Scale bitmap scale.bsa_SrcX=0; scale.bsa_SrcY=0; scale.bsa_SrcWidth=pattern->width; scale.bsa_SrcHeight=pattern->height; scale.bsa_DestX=0; scale.bsa_DestY=0; scale.bsa_DestWidth=screen->Width; scale.bsa_DestHeight=screen->Height; scale.bsa_XSrcFactor=scale.bsa_SrcWidth; scale.bsa_XDestFactor=scale.bsa_DestWidth; scale.bsa_YSrcFactor=scale.bsa_SrcHeight; scale.bsa_YDestFactor=scale.bsa_DestHeight; scale.bsa_SrcBitMap=pattern->bitmap; scale.bsa_DestBitMap=pattern->pattern_bitmap; scale.bsa_Flags=0; BitMapScale(&scale); // Get pointer to scaled bitmap pattern->bitmap=pattern->pattern_bitmap; pattern->width=screen->Width; pattern->height=screen->Height; } } } } // Update border pen GetPatternBorder(pattern,screen,border_col); } // Pattern ok now pattern->valid=TRUE; }
IPTR Ascii__DTM_ASYNCLAYOUT(Class *cl, Object *o, struct gpLayout *gpl) { struct DTSpecialInfo *si = (struct DTSpecialInfo *) G (o)->SpecialInfo; struct AsciiData *data = INST_DATA (cl, o); ULONG visible = 0, total = 0; struct RastPort trp; ULONG hunit = 1; ULONG bsig = 0; /* Switches */ BOOL linefeed = FALSE; BOOL newseg = FALSE; BOOL abort = FALSE; /* Attributes obtained from super-class */ struct TextAttr *tattr; struct TextFont *font; struct List *linelist; struct IBox *domain; IPTR wrap = FALSE; IPTR bufferlen; STRPTR buffer; STRPTR title; /* Line information */ ULONG num, offset, swidth; ULONG anchor = 0, newanchor; ULONG style = FS_NORMAL; struct Line *line; ULONG yoffset = 0; ULONG linelength, max_linelength = 0; UBYTE fgpen = 1; UBYTE bgpen = 0; ULONG tabspace; ULONG numtabs; ULONG i; ULONG nomwidth, nomheight; D(bug("AsciiDataType_AsyncLayout\n")); /* Get all the attributes that we are going to need for a successful layout */ if (GetDTAttrs (o, DTA_TextAttr , (IPTR) &tattr , DTA_TextFont , (IPTR) &font , DTA_Domain , (IPTR) &domain , DTA_ObjName , (IPTR) &title , TDTA_Buffer , (IPTR) &buffer , TDTA_BufferLen , (IPTR) &bufferlen , TDTA_LineList , (IPTR) &linelist , TDTA_WordWrap , (IPTR) &wrap , TAG_DONE) == 8) { D(bug("AsciiDataType_AsyncLayout: Got all attrs\n")); /* Lock the global object data so that nobody else can manipulate it */ ObtainSemaphore (&(si->si_Lock)); /* Make sure we have a buffer */ if (buffer) { D(bug("AsciiDataType_AsyncLayout: Got buffer\n")); /* Initialize the temporary RastPort */ InitRastPort (&trp); SetFont (&trp, font); D(bug("AsciiDataType_AsyncLayout: Temp RastPort initialized\n")); /* Calculate the nominal size */ nomheight = (ULONG) (24 * font->tf_YSize); nomwidth = (ULONG) (80 * font->tf_XSize); /* Calculate the tab space */ tabspace = font->tf_XSize * 8; /* We only need to perform layout if we are doing word wrap, or this * is the initial layout call */ D(bug("AsciiDataType_AsyncLayout: Checking if layout is needed\n")); if (wrap || gpl->gpl_Initial) { D(bug("AsciiDataType_AsyncLayout: Layout IS needed. Freeing old LineList\n")); /* Delete the old line list */ while ((line = (struct Line *) RemHead (linelist))) FreePooled (data->Pool, line, sizeof (struct Line)); D(bug("AsciiDataType_AsyncLayout. Old LineList freed\n")); /* Step through the text buffer */ for (i = offset = num = numtabs = 0; (i < bufferlen) && (bsig == 0) && !abort; i++) { /* Convert DOS and Mac line endings */ if (buffer[i] == '\r') { if (buffer[i + 1] == '\n') i++; else buffer[i] = '\n'; } /* Check for end of line */ if (buffer[i] == '\n') { newseg = linefeed = TRUE; newanchor = i + 1; } /* Check for end of page */ else if (buffer[i] == 12) { newseg = linefeed = TRUE; newanchor = i + 1; } /* Check for tab */ else if (buffer[i] == '\t') { /* See if we need to terminate a line segment */ if ((numtabs == 0) && num) { newseg = TRUE; } numtabs++; } else { /* See if we have any TABs that we need to finish out */ if (numtabs) { offset += (((offset / tabspace) + 1) * tabspace) - offset; num = numtabs = 0; anchor = i; } /* Compute the width of the line. */ swidth = TextLength(&trp, &buffer[anchor], num + 1); num++; } if (i == bufferlen - 1) newseg = TRUE; /* Time for a new text segment yet? */ if (newseg) { /* Allocate a new line segment from our memory pool */ if ((line = AllocPooled(data->Pool, sizeof(struct Line)))) { swidth = TextLength(&trp, &buffer[anchor], num); line->ln_Text = &buffer[anchor]; line->ln_TextLen = num; line->ln_XOffset = offset; line->ln_YOffset = yoffset + font->tf_Baseline; line->ln_Width = swidth; line->ln_Height = font->tf_YSize; line->ln_Flags = (linefeed) ? LNF_LF : 0; line->ln_FgPen = fgpen; line->ln_BgPen = bgpen; line->ln_Style = style; line->ln_Data = NULL; linelength = line->ln_Width + line->ln_XOffset; if (linelength > max_linelength) { max_linelength = linelength; } /* Add the line to the list */ AddTail(linelist, (struct Node *) line); /* Increment the line count */ if (linefeed) { yoffset += font->tf_YSize; offset = 0; total++; } else { /* Increment the offset */ offset += swidth; } } else { abort = TRUE; } /* Clear the variables */ newseg = linefeed = FALSE; anchor = newanchor; num = 0; /* Check to see if layout has been aborted */ bsig = CheckSignal (SIGBREAKF_CTRL_C); } /* if (newseg) */ } /* * check for last line */ D(bug("AsciiDataType_AsyncLayout: end textloop, anchor %ld\n",anchor)); #if 0 if (buffer[anchor]) { linefeed=TRUE; D(bug("AsciiDataType_AsyncLayout: add last line <%s>\n", &buffer[anchor])); /* Allocate a new line segment from our memory pool */ if ((line = AllocPooled(data->Pool, sizeof(struct Line)))) { swidth = TextLength(&trp, &buffer[anchor], num); line->ln_Text = &buffer[anchor]; line->ln_TextLen = num; line->ln_XOffset = offset; line->ln_YOffset = yoffset + font->tf_Baseline; line->ln_Width = swidth; line->ln_Height = font->tf_YSize; line->ln_Flags = (linefeed) ? LNF_LF : 0; line->ln_FgPen = fgpen; line->ln_BgPen = bgpen; line->ln_Style = style; line->ln_Data = NULL; linelength = line->ln_Width + line->ln_XOffset; if (linelength > max_linelength) { max_linelength = linelength; } /* Add the line to the list */ AddTail(linelist, (struct Node *) line); /* Increment the line count */ if (linefeed) { yoffset += font->tf_YSize; offset = 0; total++; } else { /* Increment the offset */ offset += swidth; } } else { abort = TRUE; } } #endif } /* if (wrap || gpl->gpl_Initial) */ else { /* No layout to perform */ total = si->si_TotVert; max_linelength = si->si_TotHoriz * si->si_HorizUnit; } DeinitRastPort(&trp); } /* if (buffer) */ /* Compute the lines and columns type information */ si->si_VertUnit = font->tf_YSize; si->si_VisVert = visible = domain->Height / si->si_VertUnit; si->si_TotVert = total; /* si->si_HorizUnit = hunit = 1; si->si_VisHoriz = (LONG) domain->Width / hunit; si->si_TotHoriz = domain->Width;*/ si->si_HorizUnit = hunit = font->tf_XSize; si->si_VisHoriz = domain->Width / hunit; si->si_TotHoriz = max_linelength / hunit; /* Release the global data lock */ ReleaseSemaphore (&si->si_Lock); /* Were we aborted? */ if (bsig == 0) { /* Not aborted, so tell the world of our newest attributes */ NotifyAttrChanges (o, gpl->gpl_GInfo, 0, GA_ID , G(o)->GadgetID, DTA_VisibleVert , visible , DTA_TotalVert , total , DTA_NominalVert , nomheight , DTA_VertUnit , font->tf_YSize , /* DTA_TopVert , si->si_TopVert , */ DTA_VisibleHoriz , (domain->Width / hunit) , DTA_TotalHoriz , max_linelength / hunit , DTA_NominalHoriz , nomwidth , DTA_HorizUnit , hunit , DTA_TopHoriz , si->si_TopHoriz , DTA_Title , (IPTR)title , DTA_Busy , FALSE , DTA_Sync , TRUE , TAG_DONE); } /* if (bsig == 0) */ } /* if GetDTAttrs(... */ D(bug("AsciiDataType_AsyncLayout: Done. Returning %d\n", total)); return (IPTR)total; }
///ImageBackFill__MUIM_IconWindow_BackFill_ProcessBackground() IPTR ImageBackFill__MUIM_IconWindow_BackFill_ProcessBackground ( Class *CLASS, Object *self, struct MUIP_IconWindow_BackFill_ProcessBackground *message ) { LONG Depth = 0; Object *_IconWindows_PrefsObj = NULL, *_IconWindows_WindowObj = NULL; Object *_IconWindows_IconListObj = NULL; BOOL options_changed = FALSE; IPTR prefs_processing = 0; IPTR BackGround_Attrib = 0, BackGround_Base = 0, BackGround_RenderMode = 0, BackGround_TileMode = 0, BackGround_XOffset = 0, BackGround_YOffset = 0; struct BackFillInfo *this_BFI =(struct BackFillInfo *) message->BackFill_Data; UBYTE *this_bgtype; char *this_ImageName; D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground()\n")); GET(_app(self), MUIA_Wanderer_Prefs, &_IconWindows_PrefsObj); D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: PrefsObj @ %x\n", _IconWindows_PrefsObj)); GET(self, MUIA_IconWindow_Window, &_IconWindows_WindowObj); GET(self, MUIA_IconWindow_IconList, &_IconWindows_IconListObj); D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: MUIA_IconWindow_Window = %x\n", _IconWindows_WindowObj)); if ((_IconWindows_PrefsObj == NULL) || (_IconWindows_WindowObj == NULL) || (_IconWindows_IconListObj == NULL)) return FALSE; GET(_IconWindows_PrefsObj, MUIA_WandererPrefs_Processing, &prefs_processing); #if defined(DEBUG) if (prefs_processing) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Wanderer Prefs (re)loading detected\n")); } #endif GET(_IconWindows_WindowObj, MUIA_IconWindow_BackgroundAttrib, &BackGround_Attrib); D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Background Attrib = '%s'\n", BackGround_Attrib)); if (BackGround_Attrib == (IPTR) NULL) return FALSE; if ((BackGround_Base = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute, BackGround_Attrib, MUIA_Background)) == -1) return FALSE; if ((BackGround_RenderMode = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute, BackGround_Attrib, MUIA_IconWindowExt_ImageBackFill_BGRenderMode)) == -1) BackGround_RenderMode = IconWindowExt_ImageBackFill_RenderMode_Tiled; this_bgtype = (UBYTE *)BackGround_Base; this_ImageName = (char *)(BackGround_Base + 2); D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: BackFillInfo @ %x\n", this_BFI)); D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Background '%s', mode %d\n", BackGround_Base, BackGround_RenderMode)); if ((this_bgtype[0] - 48) != 5) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Background is NOT an image - letting our windoclass handle it ..\n")); goto pb_cleanup_buffer; } GET(self, MUIA_Window_Screen, &this_BFI->bfi_Screen); GET(_IconWindows_IconListObj, MUIA_IconList_BufferRastport, &this_BFI->bfi_RastPort); D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Wanderers Screen @ %x, Using RastPort @ %x\n", this_BFI->bfi_Screen, this_BFI->bfi_RastPort)); if (this_BFI->bfi_Source) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: BackFillInfo has existing source record @ %x\n", this_BFI->bfi_Source)); if ((strcmp(this_BFI->bfi_Source->bfsir_SourceImage, this_ImageName) == 0) && (this_BFI->bfi_Source->bfsir_BackGroundRenderMode == BackGround_RenderMode)) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: existing BackFillInfo Using the same background / mode\n")); goto check_imagebuffer; } else { if (this_BFI->bfi_Buffer) { ImageBackFill_CloseSourceBuffer(this_BFI->bfi_Source, this_BFI->bfi_Buffer); this_BFI->bfi_Buffer = NULL; } ImageBackFill_CloseSourceRecord(this_BFI->bfi_Source); this_BFI->bfi_Source = NULL; } } if (!(this_BFI->bfi_Source)) this_BFI->bfi_Source = ImageBackFill_FindSourceRecord(this_ImageName, BackGround_RenderMode); if (!(this_BFI->bfi_Source)) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Creating NEW ImageSource Record\n")); if (!(this_BFI->bfi_Source = AllocMem(sizeof(struct BackFillSourceImageRecord), MEMF_CLEAR|MEMF_PUBLIC))) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Couldnt allocate enough mem for source record!\n")); return FALSE; } if (!(this_BFI->bfi_Source->bfsir_SourceImage = AllocVec(strlen(this_ImageName) +1, MEMF_CLEAR|MEMF_PUBLIC))) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Couldnt allocate enough mem for source image name store\n")); FreeMem(this_BFI->bfi_Source, sizeof(struct BackFillSourceImageRecord)); return FALSE; } strcpy(this_BFI->bfi_Source->bfsir_SourceImage, this_ImageName); if ((this_BFI->bfi_Source->bfsir_DTPictureObject = NewDTObject(this_BFI->bfi_Source->bfsir_SourceImage, DTA_SourceType, DTST_FILE, DTA_GroupID, GID_PICTURE, PDTA_DestMode, PMODE_V43, PDTA_Remap, TRUE, PDTA_Screen, this_BFI->bfi_Screen, PDTA_FreeSourceBitMap, TRUE, OBP_Precision, PRECISION_IMAGE, TAG_DONE))) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Opened Datatype Object @ %x for image '%s'\n", this_BFI->bfi_Source->bfsir_DTPictureObject, this_BFI->bfi_Source->bfsir_SourceImage)); if (DoMethod(this_BFI->bfi_Source->bfsir_DTPictureObject, DTM_PROCLAYOUT, NULL, 1)) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Caused Datatype Object LAYOUT\n")); GetDTAttrs(this_BFI->bfi_Source->bfsir_DTPictureObject, PDTA_BitMapHeader, &this_BFI->bfi_Source->bfsir_DTBitMapHeader, TAG_DONE); GetDTAttrs(this_BFI->bfi_Source->bfsir_DTPictureObject, PDTA_DestBitMap, &this_BFI->bfi_Source->bfsir_DTBitMap, TAG_DONE); if (!this_BFI->bfi_Source->bfsir_DTBitMap) GetDTAttrs(this_BFI->bfi_Source->bfsir_DTPictureObject, PDTA_BitMap, &this_BFI->bfi_Source->bfsir_DTBitMap, TAG_DONE); if (this_BFI->bfi_Source->bfsir_DTBitMap) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Datatype Object BitMap @ %x\n", this_BFI->bfi_Source->bfsir_DTBitMap)); if ((this_BFI->bfi_Source->bfsir_DTRastPort = CreateRastPort())) { this_BFI->bfi_Source->bfsir_DTRastPort->BitMap = this_BFI->bfi_Source->bfsir_DTBitMap; this_BFI->bfi_Source->bfsir_BackGroundRenderMode = BackGround_RenderMode; this_BFI->bfi_Source->bfsir_OpenerCount = 0x01; NewList(&this_BFI->bfi_Source->bfsir_Buffers); AddTail(&image_backfill_images, &this_BFI->bfi_Source->bfsir_Node); goto check_imagebuffer; } } /* Failed to obtain datatype object's BM */ } /* Failed to Layout datatype object */ } /* Failed to open datatype object */ #if defined(DEBUG) if (!this_BFI->bfi_Source->bfsir_DTRastPort) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create ImageSource RastPort\n")); } #endif if (this_BFI->bfi_Source->bfsir_DTBitMap) { FreeBitMap(this_BFI->bfi_Source->bfsir_DTBitMap); this_BFI->bfi_Source->bfsir_DTBitMap = NULL; } #if defined(DEBUG) else { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create ImageSource BitMap\n")); } #endif if (this_BFI->bfi_Source->bfsir_DTPictureObject) { DisposeDTObject(this_BFI->bfi_Source->bfsir_DTPictureObject); this_BFI->bfi_Source->bfsir_DTPictureObject = NULL; } #if defined(DEBUG) else { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create ImageSource Datatype Object\n")); } #endif D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create ImageSource Record\n")); if (this_BFI->bfi_Source->bfsir_SourceImage) FreeVec(this_BFI->bfi_Source->bfsir_SourceImage); FreeMem(this_BFI->bfi_Source, sizeof(struct BackFillSourceImageRecord)); this_BFI->bfi_Source = NULL; return FALSE; } else { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Using existing ImageSource Record\n")); this_BFI->bfi_Source->bfsir_OpenerCount += 1; } check_imagebuffer: Depth = GetBitMapAttr(this_BFI->bfi_Source->bfsir_DTBitMap, BMA_DEPTH); this_BFI->bfi_CopyWidth = this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Width; this_BFI->bfi_CopyHeight = this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Height; switch (BackGround_RenderMode) { case IconWindowExt_ImageBackFill_RenderMode_Scale: { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED mode\n")); this_BFI->bfi_Options.bfo_TileMode = IconWindowExt_ImageBackFill_TileMode_Fixed; SET(_IconWindows_IconListObj, MUIA_IconListview_FixedBackground, TRUE); SET(_IconWindows_IconListObj, MUIA_IconListview_ScaledBackground, TRUE); if ((BOOL)XGET(self, MUIA_IconWindow_IsRoot)) { struct BackFillSourceImageBuffer *this_Buffer; D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Root Window = TRUE!\n")); this_BFI->bfi_CopyWidth = GetBitMapAttr(this_BFI->bfi_Screen->RastPort.BitMap, BMA_WIDTH); this_BFI->bfi_CopyHeight = GetBitMapAttr(this_BFI->bfi_Screen->RastPort.BitMap, BMA_HEIGHT); D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Base Dimensions (%d x %d)\n", this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight)); if (!((BOOL)XGET(self, MUIA_IconWindow_IsBackdrop))) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Adjusting for window border Dimensions ..\n")); D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - WBorTop %d, WBorLeft %d, WBorRight %d, WBorBottom %d\n", this_BFI->bfi_Screen->WBorTop, this_BFI->bfi_Screen->WBorLeft, this_BFI->bfi_Screen->WBorRight, this_BFI->bfi_Screen->WBorBottom)); this_BFI->bfi_CopyWidth -= (this_BFI->bfi_Screen->WBorLeft + this_BFI->bfi_Screen->WBorRight); this_BFI->bfi_CopyHeight -= (this_BFI->bfi_Screen->WBorTop + this_BFI->bfi_Screen->WBorBottom);; } this_BFI->bfi_CopyHeight -= (this_BFI->bfi_Screen->BarHeight + 1); this_Buffer = NULL; if (this_BFI->bfi_Buffer) { if ((this_BFI->bfi_Buffer->bfsib_BitMapWidth == this_BFI->bfi_CopyWidth) && (this_BFI->bfi_Buffer->bfsib_BitMapHeight == this_BFI->bfi_CopyHeight)) { goto pb_backfillsetup_complete; } else { ImageBackFill_CloseSourceBuffer(this_BFI->bfi_Source, this_BFI->bfi_Buffer); this_BFI->bfi_Buffer = NULL; } } if (!(this_Buffer = ImageBackFill_FindBufferRecord(this_BFI->bfi_Source, this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight))) { this_Buffer = AllocMem(sizeof(struct BackFillSourceImageBuffer), MEMF_CLEAR|MEMF_PUBLIC); this_Buffer->bfsib_BitMapWidth = this_BFI->bfi_CopyWidth; this_Buffer->bfsib_BitMapHeight = this_BFI->bfi_CopyHeight; if (!(this_Buffer->bfsib_BitMapRastPort = CreateRastPort())) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Failed to create RastPort for BackFill BitMap\n")); break; } if ((this_Buffer->bfsib_BitMap = AllocBitMap(this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight, Depth, Depth == 8 ? BMF_MINPLANES : 0L, this_BFI->bfi_Screen->RastPort.BitMap))) { struct Rectangle CopyBounds; D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Scale Dimensions (%d x %d)\n", this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight)); this_Buffer->bfsib_BitMapRastPort->BitMap = this_Buffer->bfsib_BitMap; this_BFI->bfi_Buffer = this_Buffer; CopyBounds.MinX = 0; CopyBounds.MinY = 0; CopyBounds.MaxX = this_BFI->bfi_CopyWidth - 1; CopyBounds.MaxY = this_BFI->bfi_CopyHeight - 1; ImageBackFill_CopyScaledBitMap(this_BFI->bfi_Source->bfsir_DTRastPort, 0, 0, this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Width, this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Height, this_Buffer->bfsib_BitMapRastPort, &CopyBounds, &CopyBounds, blit_MODE_Blit); this_Buffer->bfsib_OpenerCount = 0x01; AddTail(&this_BFI->bfi_Source->bfsir_Buffers, &this_Buffer->bfsib_Node); goto pb_backfillsetup_complete; } break; } else { this_BFI->bfi_Buffer = this_Buffer; this_Buffer->bfsib_OpenerCount += 1; goto pb_backfillsetup_complete; } } // We arent the "ROOT" (desktop) window so only tile ... D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: SCALED - Drawer window scaling unsupported ...\n")); } default: { struct BackFillSourceImageBuffer *this_Buffer; D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: TILED mode\n")); if ((BackGround_TileMode = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute, BackGround_Attrib, MUIA_IconWindowExt_ImageBackFill_BGTileMode)) == -1) BackGround_TileMode = IconWindowExt_ImageBackFill_TileMode_Float; if ((BackGround_XOffset = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute, BackGround_Attrib, MUIA_IconWindowExt_ImageBackFill_BGXOffset)) == -1) BackGround_XOffset = 0; if ((BackGround_YOffset = DoMethod(_IconWindows_PrefsObj, MUIM_WandererPrefs_ViewSettings_GetAttribute, BackGround_Attrib, MUIA_IconWindowExt_ImageBackFill_BGYOffset)) == -1) this_BFI->bfi_Options.bfo_OffsetY = 0; if (this_BFI->bfi_Options.bfo_TileMode != BackGround_TileMode) { this_BFI->bfi_Options.bfo_TileMode = BackGround_TileMode; options_changed = TRUE; } if (this_BFI->bfi_Options.bfo_OffsetX != BackGround_XOffset) { this_BFI->bfi_Options.bfo_OffsetX = BackGround_XOffset; options_changed = TRUE; } if (this_BFI->bfi_Options.bfo_OffsetY != BackGround_YOffset) { this_BFI->bfi_Options.bfo_OffsetY = BackGround_YOffset; options_changed = TRUE; } if (this_BFI->bfi_Options.bfo_TileMode == IconWindowExt_ImageBackFill_TileMode_Float) SET(_IconWindows_IconListObj, MUIA_IconListview_FixedBackground, FALSE); else SET(_IconWindows_IconListObj, MUIA_IconListview_FixedBackground, TRUE); SET(_IconWindows_IconListObj, MUIA_IconListview_ScaledBackground, FALSE); this_Buffer = NULL; if (this_BFI->bfi_Buffer) { if ((this_BFI->bfi_Buffer->bfsib_BitMapWidth == this_BFI->bfi_CopyWidth) && (this_BFI->bfi_Buffer->bfsib_BitMapHeight == this_BFI->bfi_CopyHeight)) { goto pb_backfillsetup_complete; } else { ImageBackFill_CloseSourceBuffer(this_BFI->bfi_Source, this_BFI->bfi_Buffer); this_BFI->bfi_Buffer = NULL; } } D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Dimensions Width %d, Height %d\n", this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight)); if (!(this_Buffer = ImageBackFill_FindBufferRecord(this_BFI->bfi_Source, this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight))) { this_Buffer = AllocMem(sizeof(struct BackFillSourceImageBuffer), MEMF_CLEAR|MEMF_PUBLIC); this_Buffer->bfsib_BitMapWidth = this_BFI->bfi_CopyWidth; this_Buffer->bfsib_BitMapHeight = this_BFI->bfi_CopyHeight; if ((this_Buffer->bfsib_BitMap = AllocBitMap(this_BFI->bfi_CopyWidth, this_BFI->bfi_CopyHeight, Depth, Depth == 8 ? BMF_MINPLANES : 0L, this_BFI->bfi_Screen->RastPort.BitMap))) { struct Rectangle CopyBounds; if (!(this_Buffer->bfsib_BitMapRastPort = CreateRastPort())) { D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: TILED - Failed to create RastPort for BackFill BitMap\n")); break; } this_Buffer->bfsib_BitMapRastPort->BitMap = this_Buffer->bfsib_BitMap; this_BFI->bfi_Buffer = this_Buffer; CopyBounds.MinX = 0; CopyBounds.MinY = 0; CopyBounds.MaxX = this_BFI->bfi_CopyWidth - 1; CopyBounds.MaxY = this_BFI->bfi_CopyHeight - 1; ImageBackFill_CopyTiledBitMap(this_BFI->bfi_Source->bfsir_DTRastPort, 0, 0, this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Width, this_BFI->bfi_Source->bfsir_DTBitMapHeader->bmh_Height, this_BFI->bfi_Buffer->bfsib_BitMapRastPort, &CopyBounds, &CopyBounds, blit_MODE_Blit); this_Buffer->bfsib_OpenerCount = 0x01; AddTail(&this_BFI->bfi_Source->bfsir_Buffers, &this_BFI->bfi_Buffer->bfsib_Node); goto pb_backfillsetup_complete; } break; } else { this_BFI->bfi_Buffer = this_Buffer; this_Buffer->bfsib_OpenerCount += 1; goto pb_backfillsetup_complete; } } } D(bug("[IconWindow.ImageBackFill] MUIM_IconWindow_BackFill_ProcessBackground: Failed to create image datatype object\n")); return FALSE; pb_cleanup_buffer: if (this_BFI->bfi_Buffer) { ImageBackFill_CloseSourceBuffer(this_BFI->bfi_Source, this_BFI->bfi_Buffer); this_BFI->bfi_Buffer = NULL; } pb_cleanup_source: if (this_BFI->bfi_Source) { ImageBackFill_CloseSourceRecord(this_BFI->bfi_Source); this_BFI->bfi_Source = NULL; } return FALSE; pb_backfillsetup_complete: if ((prefs_processing) && (options_changed)) SET(self, MUIA_IconWindow_Changed, TRUE); return TRUE; }