optimize by not drawing blur if alpha == 255

This commit is contained in:
Cynthia Foxwell 2023-12-18 00:02:11 -07:00
parent 27d4dda2a2
commit bb7de8eac9

View file

@ -77,7 +77,9 @@ local function CreateChatbox()
frame.lblTitle:SetVisible(false) frame.lblTitle:SetVisible(false)
function frame:Paint(w, h) function frame:Paint(w, h)
if CHATBOX_BLUR:GetBool() then local alpha = CHATBOX_ALPHA:GetInt()
if CHATBOX_BLUR:GetBool() and alpha ~= 255 then
local x, y = self:LocalToScreen(0, 0) local x, y = self:LocalToScreen(0, 0)
surface_SetMaterial(MATERIAL_BLUR) surface_SetMaterial(MATERIAL_BLUR)
@ -92,7 +94,7 @@ local function CreateChatbox()
end end
local color = string.Explode(" ", CHATBOX_COLOR:GetString()) local color = string.Explode(" ", CHATBOX_COLOR:GetString())
surface_SetDrawColor(tonumber(color[1]), tonumber(color[2]), tonumber(color[3]), CHATBOX_ALPHA:GetInt()) surface_SetDrawColor(tonumber(color[1]), tonumber(color[2]), tonumber(color[3]), alpha)
surface_DrawRect(0, 0, w, h) surface_DrawRect(0, 0, w, h)
end end