IPTR MenuDecorClass__MDM_GETDEFSIZE_SYSIMAGE(Class *cl, Object *obj, struct mdpGetDefSizeSysImage *msg) { switch(msg->mdp_Which) { case SUBMENUIMAGE: *msg->mdp_Width = 0; *msg->mdp_Height = 0; struct RastPort *rp = CreateRastPort(); if (rp) { struct TextExtent TextExt; SetFont(rp, msg->mdp_ReferenceFont); TextExtent(rp, ">>", 2, &TextExt); *msg->mdp_Width = TextExt.te_Width; *msg->mdp_Height = TextExt.te_Height; FreeRastPort(rp); } break; case MENUCHECK: *msg->mdp_Width = REFWIDTH / 2 + 4; // reffont->tf_XSize * 3 / 2; *msg->mdp_Height= REFHEIGHT; break; default: *msg->mdp_Width = DEFSIZE_WIDTH; *msg->mdp_Height = DEFSIZE_HEIGHT; break; } return TRUE; }
VOID METHOD(VC4Gallium, Hidd_Gallium, DisplayResource) { struct RastPort * rp; #if (0) OOP_GetAttr(o, aHidd_Gallium_WinSys, &vc4_ws); if (vc4_ws) { if ((data == NULL) && (spr->dt != NULL)) data = vc4_ws->displaytarget_map(vc4_ws, spr->dt, 0); if (data) { rp = CreateRastPort(); rp->BitMap = msg->bitmap; WritePixelArray( data, msg->srcx, msg->srcy, spr->stride[0], rp, msg->dstx, msg->dsty, msg->width, msg->height, AROS_PIXFMT); FreeRastPort(rp); } if ((spr->data == NULL) && (data != NULL)) vc4_ws->displaytarget_unmap(vc4_ws, spr->dt); } #endif }
///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; }