test desaturate

This commit is contained in:
Bunny67
2022-01-05 00:09:42 +03:00
parent d6de7c391d
commit d9af2978fc
3 changed files with 37 additions and 20 deletions
+18
View File
@@ -978,6 +978,19 @@ local funcs = {
end
}
local function setDesaturated(self, desaturated, ...)
self.isDesaturated = desaturated and 1 or 0
return self._SetDesaturated(self, desaturated, ...)
end
local function setTexture(self, ...)
local apply = self._SetTexture(self, ...)
if self.isDesaturated ~= nil then
self._SetDesaturated(self, self._isDesaturated)
end
return apply
end
-- Called when first creating a new region/display
local function create(parent)
-- Create overall region (containing everything else)
@@ -1013,6 +1026,11 @@ local function create(parent)
region.icon = icon;
icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark");
icon._SetDesaturated = self.SetDesaturated
icon.SetDesaturated = setDesaturated
icon._SetTexture = self._SetTexture
icon.SetTexture = setTexture
-- Region variables
region.values = {};
+18
View File
@@ -174,6 +174,19 @@ local function AnchorSubRegion(self, subRegion, anchorType, selfPoint, anchorPoi
end
end
local function setDesaturated(self, desaturated, ...)
self.isDesaturated = desaturated and 1 or 0
return self._SetDesaturated(self, desaturated, ...)
end
local function setTexture(self, ...)
local apply = self._SetTexture(self, ...)
if self.isDesaturated ~= nil then
self._SetDesaturated(self, self._isDesaturated)
end
return apply
end
local function create(parent, data)
local font = "GameFontHighlight";
@@ -226,6 +239,11 @@ local function create(parent, data)
region.icon = icon;
icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark");
icon._SetDesaturated = self.SetDesaturated
icon.SetDesaturated = setDesaturated
icon._SetTexture = self._SetTexture
icon.SetTexture = setTexture
--This section creates a unique frame id for the cooldown frame so that it can be created with a global reference
--The reason is so that WeakAuras cooldown frames can interact properly with OmniCC (i.e., put on its ignore list for timer overlays)
local id = data.id;
+1 -20
View File
@@ -143,23 +143,4 @@ if not SmoothStatusBarMixin then
self.lastSmoothedMin = min;
self.lastSmoothedMax = max;
end
end
do
local texture_mt = getmetatable(CreateFrame("Frame"):CreateTexture()).__index
local setDesaturated = texture_mt.SetDesaturated
texture_mt.SetDesaturated = function(self, desaturated, ...)
self._isDesaturated = desaturated
return setDesaturated(self, desaturated, ...)
end
local setTexture = texture_mt.SetTexture
texture_mt.SetTexture = function(self, ...)
local isDesaturated = self._isDesaturated
local apply = setTexture(self, ...)
self:SetDesaturated(isDesaturated)
return apply
end
end
end