Skip to content

Commit

Permalink
fix render issue
Browse files Browse the repository at this point in the history
  • Loading branch information
thisdp committed Apr 2, 2022
1 parent db161bc commit 4d79aa7
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
7 changes: 3 additions & 4 deletions Core/combobox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,6 @@ dgsRenderer["dgs-dxcombobox-Box"] = function(source,x,y,w,h,mx,my,cx,cy,enabledI
textRenderBuffer.count = 0
if DataTab.bgRT then
dxSetRenderTarget(DataTab.bgRT,true)
dxSetBlendMode("modulate_add")
local align = DataTab.itemAlignment
local scbcheck = dgsElementData[scrollbar].visible and scbThick or 0
if MouseData.entered == source and mx >= cx and mx <= cx+w-scbcheck and my >= cy and my <= cy+h then
Expand Down Expand Up @@ -1099,14 +1098,14 @@ dgsRenderer["dgs-dxcombobox-Box"] = function(source,x,y,w,h,mx,my,cx,cy,enabledI
dgsDrawText(tRB[1],tRB[2],tRB[3],tRB[4],tRB[5],tRB[6],tRB[7],tRB[8],tRB[9],tRB[10],tRB[11],tRB[12],tRB[13],false,tRB[14],subPixelPos,0,0,0,0,shadowOffsetX,shadowOffsetY,shadowColor,shadowIsOutline,shadowFont)
end
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
dxSetRenderTarget(rndtgt)
dxSetBlendMode("blend")
if DataTab.bgRT then
__dxDrawImage(x,y,w,h,DataTab.bgRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
end
dxSetBlendMode("add")
if DataTab.textRT then
__dxDrawImage(x,y,w,h,DataTab.textRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
dxSetBlendMode("add")
__dxDrawImage(x,y,w,h,DataTab.textRT,0,0,0,white,isPostGUI)
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
end
Expand Down
10 changes: 6 additions & 4 deletions Core/edit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ dgsRenderer["dgs-dxedit"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInherited
textX_Right = textX_Right-textX_Right%1
if not placeHolderIgnoreRndTgt then
if isPlaceHolderShown then
local pColor = eleData.placeHolderColor
local pColor = applyColorAlpha(eleData.placeHolderColor,parentAlpha)
local pFont = eleData.placeHolderFont
local pColorCoded = eleData.placeHolderColorCoded
local pHolderTextSizeX,pHolderTextSizeY
Expand All @@ -1278,9 +1278,9 @@ dgsRenderer["dgs-dxedit"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInherited
end
end
if eleData.autoCompleteShow then
dgsDrawText(eleData.autoCompleteShow.result or "",textX_Left,0,textX_Right-posFix,h-sidelength*2,eleData.autoCompleteTextColor or applyColorAlpha(textColor,0.7),txtSizX,txtSizY,font,alignment[1],alignment[2],false,false,false,false)
dgsDrawText(eleData.autoCompleteShow.result or "",textX_Left,0,textX_Right-posFix,h-sidelength*2,eleData.autoCompleteTextColor or applyColorAlpha(textColor,0.7*parentAlpha),txtSizX,txtSizY,font,alignment[1],alignment[2],false,false,false,false)
end
dgsDrawText(text,textX_Left,0,textX_Right-posFix,h-sidelength*2,textColor,txtSizX,txtSizY,font,alignment[1],alignment[2],false,false,false,false)
dgsDrawText(text,textX_Left,0,textX_Right-posFix,h-sidelength*2,applyColorAlpha(textColor,parentAlpha),txtSizX,txtSizY,font,alignment[1],alignment[2],false,false,false,false)
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
dxSetRenderTarget(rndtgt)
Expand Down Expand Up @@ -1311,7 +1311,9 @@ dgsRenderer["dgs-dxedit"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInherited
end
end

__dxDrawImage(px,py,pw,ph,eleData.textRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
dxSetBlendMode("add")
__dxDrawImage(px,py,pw,ph,eleData.textRT,0,0,0,white,isPostGUI)
dxSetBlendMode(rndtgt and "modulate_add" or "blend")

if MouseData.focused == source and MouseData.EditMemoCursor then
local CaretShow = true
Expand Down
32 changes: 11 additions & 21 deletions Core/gridlist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2524,8 +2524,6 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher

local font = eleData.font or systemFont
local columnHeight = eleData.columnHeight
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
dxDrawImage(x,y+columnHeight,w,h-columnHeight,bgImage,0,0,0,bgColor,isPostGUI,rndtgt)
local columnData,rowData = eleData.columnData,eleData.rowData
local columnCount,rowCount = #columnData,#rowData
local columnTextColor = eleData.columnTextColor
Expand Down Expand Up @@ -2609,7 +2607,6 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
local columnPos = renderBuffer.columnPos
local columnEndPos = renderBuffer.columnEndPos
local columnShadow = eleData.columnShadow
dxDrawImage(x,y,w,columnHeight,columnImage,0,0,0,columnColor,isPostGUI,rndtgt)
local shadowOffsetX,shadowOffsetY,shadowColor,shadowIsOutline,shadowFont
if not eleData.mode then
dxSetRenderTarget(eleData.columnTextRT,true)
Expand All @@ -2620,11 +2617,11 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
local mouseSelectColumn = -1
local cPosStart,cPosEnd
if columnShadow then
shadowOffsetX,shadowOffsetY,shadowColor,shadowIsOutline,shadowFont = columnShadow[1],columnShadow[2],columnShadow[3],columnShadow[4],columnShadow[5]
shadowOffsetX,shadowOffsetY,shadowColor,shadowIsOutline,shadowFont = columnShadow[1],columnShadow[2],applyColorAlpha(columnShadow[3],parentAlpha),columnShadow[4],columnShadow[5]
end
for id = 1,#columnData do
local data = columnData[id]
local _columnTextColor = data[5] or columnTextColor
local _columnTextColor = applyColorAlpha(data[5] or columnTextColor,parentAlpha)
local _columnTextColorCoded = data[6] or colorCoded
local _columnTextSx,_columnTextSy = data[7] or columnTextSx,data[8] or columnTextSy
local _columnFont = data[9] or eleData.columnFont or font
Expand Down Expand Up @@ -2656,9 +2653,6 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
end
end
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")


local preSelectLastFrame = eleData.preSelectLastFrame
local preSelect = eleData.preSelect
if mouseInsideRow then
Expand Down Expand Up @@ -2691,8 +2685,6 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
local textBufferCnt = 0
local elementBuffer = renderBuffer.elementBuffer
local textBuffer = renderBuffer.textBuffer

dxSetBlendMode("modulate_add")
if eleData.rowRT then
dxSetRenderTarget(eleData.rowRT,true)
if cPosStart and cPosEnd then
Expand All @@ -2703,10 +2695,6 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
local rowpos = i*rowHeight+rowMoveOffset+(i-1)*leading--_RowHeight
local rowpos_1 = rowpos-rowHeight--_RowHeight
local _x,_y,_sx,_sy = tempColumnOffset+columnOffset,rowpos_1,sW,rowpos
--[[if eleData.PixelInt then
_x,_y,_sx,_sy = _x-_x%1,_y-_y%1,_sx-_sx%1,_sy-_sy%1
end]]

for id = cPosStart,cPosEnd do
local currentRowData = lc_rowData[id]
local text = currentRowData[1]
Expand Down Expand Up @@ -2781,7 +2769,7 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
currentTextBuffer[3] = textYS-textYS%1 --startY
currentTextBuffer[4] = textXE-textXE%1 --endX
currentTextBuffer[5] = textYE-textYE%1 --endY
currentTextBuffer[6] = type(currentRowData[2]) == "table" and currentRowData[2][rowState] or currentRowData[2]
currentTextBuffer[6] = applyColorAlpha(type(currentRowData[2]) == "table" and currentRowData[2][rowState] or currentRowData[2],parentAlpha)
currentTextBuffer[7] = _txtScalex
currentTextBuffer[8] = _txtScaley
currentTextBuffer[9] = _txtFont
Expand All @@ -2791,13 +2779,12 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
end
end
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
end
if eleData.rowTextRT then
dxSetRenderTarget(eleData.rowTextRT,true)
dxSetBlendMode("modulate_add")
if rowShadow then
shadowOffsetX,shadowOffsetY,shadowColor,shadowIsOutline,shadowFont = rowShadow[1],rowShadow[2],rowShadow[3],rowShadow[4],rowShadow[5]
shadowOffsetX,shadowOffsetY,shadowColor,shadowIsOutline,shadowFont = rowShadow[1],rowShadow[2],applyColorAlpha(rowShadow[3],parentAlpha),rowShadow[4],rowShadow[5]
end
for a=1,textBufferCnt do
local line = textBuffer[a]
Expand All @@ -2807,7 +2794,6 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
dgsDrawText(line[1],psx,psy,pex,pey,clr,tSclx,tScly,tFnt,tHozAlign,"center",clip,rowWordBreak,false,tClrCode,true,0,0,0,0,shadowOffsetX,shadowOffsetY,shadowColor,shadowIsOutline,shadowFont)
end

dxSetBlendMode("blend")
if not eleData.childOutsideHit then
if MouseData.hit ~= source then
enabledInherited = false
Expand All @@ -2829,16 +2815,18 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
dxSetRenderTarget(rndtgt)
dxDrawImage(x,y+columnHeight,w,h-columnHeight,bgImage,0,0,0,bgColor,isPostGUI,rndtgt)
dxDrawImage(x,y,w,columnHeight,columnImage,0,0,0,columnColor,isPostGUI,rndtgt)
if eleData.rowRT then
dxDrawImage(x,y+columnHeight,w-scbThickV,h-columnHeight-scbThickH,eleData.rowRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
end
dxSetBlendMode("add")
if eleData.rowTextRT then
dxDrawImage(x,y+columnHeight,w-scbThickV,h-columnHeight-scbThickH,eleData.rowTextRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
dxDrawImage(x,y+columnHeight,w-scbThickV,h-columnHeight-scbThickH,eleData.rowTextRT,0,0,0,white,isPostGUI)
end
if eleData.columnTextRT then
dxDrawImage(x,y,w-scbThickV,columnHeight,eleData.columnTextRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
dxDrawImage(x,y,w-scbThickV,columnHeight,eleData.columnTextRT,0,0,0,white,isPostGUI)
end

elseif columnCount >= 1 then --NO RT
local whichColumnToStart,whichColumnToEnd = -1,-1
local _rowMoveOffset = (1-eleData.FromTo[1])*rowHeightLeadingTemp--_RowHeight
Expand Down Expand Up @@ -2869,6 +2857,8 @@ dgsRenderer["dgs-dxgridlist"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
end
column_x = cx-cpos[whichColumnToStart]+columnOffset
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
dxDrawImage(x,y+columnHeight,w,h-columnHeight,bgImage,0,0,0,bgColor,isPostGUI,rndtgt)
dxDrawImage(x,y,w,columnHeight,columnImage,0,0,0,columnColor,isPostGUI,rndtgt)
local relativeBlack = applyColorAlpha(black,parentAlpha)
if columnShadow then
shadowOffsetX,shadowOffsetY,shadowColor,shadowIsOutline,shadowFont = columnShadow[1],columnShadow[2],applyColorAlpha(columnShadow[3],parentAlpha),columnShadow[4],columnShadow[5]
Expand Down
12 changes: 8 additions & 4 deletions Core/memo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ dgsRenderer["dgs-dxmemo"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInherited
textRenderBuffer[textRenderBuffer.count][3] = yPos
textRenderBuffer[textRenderBuffer.count][4] = -showPos
textRenderBuffer[textRenderBuffer.count][5] = fontHeight+yPos
textRenderBuffer[textRenderBuffer.count][6] = textColor
textRenderBuffer[textRenderBuffer.count][6] = applyColorAlpha(textColor,parentAlpha)
textRenderBuffer[textRenderBuffer.count][7] = txtSizX
textRenderBuffer[textRenderBuffer.count][8] = txtSizY
textRenderBuffer[textRenderBuffer.count][9] = font
Expand Down Expand Up @@ -1722,8 +1722,10 @@ dgsRenderer["dgs-dxmemo"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInherited
__dxDrawImageSection(px,py,pw-scbTakes1,ph-scbTakes2,0,0,pw-scbTakes1,ph-scbTakes2,eleData.bgRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
end
if eleData.textRT then
__dxDrawImageSection(px,py,pw-scbTakes1,ph-scbTakes2,0,0,pw-scbTakes1,ph-scbTakes2,eleData.textRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
dxSetBlendMode("add")
__dxDrawImageSection(px,py,pw-scbTakes1,ph-scbTakes2,0,0,pw-scbTakes1,ph-scbTakes2,eleData.textRT,0,0,0,white,isPostGUI)
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
if MouseData.focused == source and MouseData.EditMemoCursor then
local CaretShow = true
if eleData.readOnly then
Expand Down Expand Up @@ -1804,7 +1806,7 @@ dgsRenderer["dgs-dxmemo"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInherited
textRenderBuffer[textRenderBuffer.count][3] = yPos
textRenderBuffer[textRenderBuffer.count][4] = -showPos
textRenderBuffer[textRenderBuffer.count][5] = fontHeight+yPos
textRenderBuffer[textRenderBuffer.count][6] = textColor
textRenderBuffer[textRenderBuffer.count][6] = applyColorAlpha(textColor,parentAlpha)
textRenderBuffer[textRenderBuffer.count][7] = txtSizX
textRenderBuffer[textRenderBuffer.count][8] = txtSizY
textRenderBuffer[textRenderBuffer.count][9] = font
Expand Down Expand Up @@ -1833,8 +1835,10 @@ dgsRenderer["dgs-dxmemo"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInherited
__dxDrawImageSection(px,py,pw-scbTakes1,ph-scbTakes2,0,0,pw-scbTakes1,ph-scbTakes2,eleData.bgRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
end
if eleData.textRT then
__dxDrawImageSection(px,py,pw-scbTakes1,ph-scbTakes2,0,0,pw-scbTakes1,ph-scbTakes2,eleData.textRT,0,0,0,tocolor(255,255,255,255*parentAlpha),isPostGUI)
dxSetBlendMode("add")
__dxDrawImageSection(px,py,pw-scbTakes1,ph-scbTakes2,0,0,pw-scbTakes1,ph-scbTakes2,eleData.textRT,0,0,0,white,isPostGUI)
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
if MouseData.focused == source and MouseData.EditMemoCursor then
local CaretShow = true
if eleData.readOnly then
Expand Down
6 changes: 4 additions & 2 deletions Core/tabpanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ dgsRenderer["dgs-dxtabpanel"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
textRenderBuffer[textRenderBuffer.count][3] = 0
textRenderBuffer[textRenderBuffer.count][4] = width+tabX
textRenderBuffer[textRenderBuffer.count][5] = height
textRenderBuffer[textRenderBuffer.count][6] = type(tabTextColor) == "table" and tabTextColor[selState] or tabTextColor
textRenderBuffer[textRenderBuffer.count][6] = applyColorAlpha(type(tabTextColor) == "table" and tabTextColor[selState] or tabTextColor,parentAlpha)
textRenderBuffer[textRenderBuffer.count][7] = textSizeX
textRenderBuffer[textRenderBuffer.count][8] = textSizeY
textRenderBuffer[textRenderBuffer.count][9] = tabData.font or font
Expand Down Expand Up @@ -632,8 +632,10 @@ dgsRenderer["dgs-dxtabpanel"] = function(source,x,y,w,h,mx,my,cx,cy,enabledInher
__dxDrawImage(x,y,w,height,eleData.bgRT,0,0,0,applyColorAlpha(white,parentAlpha),isPostGUI)
end
if eleData.textRT then
__dxDrawImage(x,y,w,height,eleData.textRT,0,0,0,applyColorAlpha(white,parentAlpha),isPostGUI)
dxSetBlendMode("add")
__dxDrawImage(x,y,w,height,eleData.textRT,0,0,0,white,isPostGUI)
end
dxSetBlendMode(rndtgt and "modulate_add" or "blend")
local tabEleData = dgsElementData[ tabs[selected] ]
local colors = applyColorAlpha(tabEleData.bgColor,parentAlpha)
dxDrawImage(x,y+height,w,h-height,tabEleData.bgImage,0,0,0,colors,isPostGUI,rndtgt)
Expand Down
5 changes: 4 additions & 1 deletion test.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dgsLogLuaMemory()
local loadstring = loadstring
addEventHandler("onClientResourceStart",resourceRoot,function()
------------Full demo
Expand Down Expand Up @@ -386,6 +387,7 @@ function createFullDemoOOP()
end
end
end)
--demoUI.window.alpha = 0.2
end
--createFullDemoOOP()

Expand Down Expand Up @@ -1227,4 +1229,5 @@ function ChartTest()
dgsChartDatasetSetData(chart,datasetID,setdata)
end

end)

end)

0 comments on commit 4d79aa7

Please sign in to comment.