Refactor artLock with FrmImage

This commit is contained in:
Alexander Batalov 2022-11-07 13:55:05 +03:00
parent 23bee9fd62
commit b2420bdc80
1 changed files with 4 additions and 7 deletions

View File

@ -131,16 +131,15 @@ int displayMonitorInit()
gDisplayMonitorBackgroundFrmData, gDisplayMonitorBackgroundFrmData,
DISPLAY_MONITOR_WIDTH); DISPLAY_MONITOR_WIDTH);
} else { } else {
CacheEntry* backgroundFrmHandle; FrmImage backgroundFrmImage;
int backgroundFid = buildFid(OBJ_TYPE_INTERFACE, 16, 0, 0, 0); int backgroundFid = buildFid(OBJ_TYPE_INTERFACE, 16, 0, 0, 0);
Art* backgroundFrm = artLock(backgroundFid, &backgroundFrmHandle); if (!backgroundFrmImage.lock(backgroundFid)) {
if (backgroundFrm == NULL) {
internal_free(gDisplayMonitorBackgroundFrmData); internal_free(gDisplayMonitorBackgroundFrmData);
return -1; return -1;
} }
unsigned char* backgroundFrmData = artGetFrameData(backgroundFrm, 0, 0); unsigned char* backgroundFrmData = backgroundFrmImage.getData();
_intface_full_width = artGetWidth(backgroundFrm, 0, 0); _intface_full_width = backgroundFrmImage.getWidth();
blitBufferToBuffer(backgroundFrmData + _intface_full_width * DISPLAY_MONITOR_Y + DISPLAY_MONITOR_X, blitBufferToBuffer(backgroundFrmData + _intface_full_width * DISPLAY_MONITOR_Y + DISPLAY_MONITOR_X,
DISPLAY_MONITOR_WIDTH, DISPLAY_MONITOR_WIDTH,
@ -148,8 +147,6 @@ int displayMonitorInit()
_intface_full_width, _intface_full_width,
gDisplayMonitorBackgroundFrmData, gDisplayMonitorBackgroundFrmData,
DISPLAY_MONITOR_WIDTH); DISPLAY_MONITOR_WIDTH);
artUnlock(backgroundFrmHandle);
} }
gDisplayMonitorScrollUpButton = buttonCreate(gInterfaceBarWindow, gDisplayMonitorScrollUpButton = buttonCreate(gInterfaceBarWindow,