From 957eabcedbe247d61ba176c6707eea264d26219f Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Sat, 29 Aug 2015 02:18:14 +0300 Subject: [PATCH] Update Photoshop.lua --- Applications/Photoshop/Photoshop.lua | 30 ++++++++++------------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/Applications/Photoshop/Photoshop.lua b/Applications/Photoshop/Photoshop.lua index c4a7e769..194ae0c7 100644 --- a/Applications/Photoshop/Photoshop.lua +++ b/Applications/Photoshop/Photoshop.lua @@ -189,35 +189,27 @@ local function drawFromMassiv(clearScreenOrNot) if MasterPixels[i][j][3] ~= transparentSymbol then --Оптимизация - if j > 1 then - if MasterPixels[i][j - 1][1] ~= MasterPixels[i][j][1] then - gpu.setBackground(MasterPixels[i][j][1]) - end - if MasterPixels[i][j - 1][2] ~= MasterPixels[i][j][2] then - gpu.setForeground(MasterPixels[i][j][2]) - end - else + + if MasterPixels[i][j][1] ~= gpu.getBackground() then gpu.setBackground(MasterPixels[i][j][1]) - gpu.setForeground(MasterPixels[i][j][2]) end + if MasterPixels[i][j][2] ~= gpu.getForeground() then + gpu.setForeground(MasterPixels[i][j][1]) + end + gpu.set(x+j, y+i, MasterPixels[i][j][3]) else - --Оптимизация - if j > 1 then - if MasterPixels[i][j - 1][1] ~= MasterPixels[i][j][1] then - gpu.setBackground(transparentBackground) - end - if MasterPixels[i][j - 1][2] ~= MasterPixels[i][j][2] then - gpu.setForeground(transparentForeground) - end - else + if transparentBackground ~= gpu.getBackground() then gpu.setBackground(transparentBackground) - gpu.setForeground(transparentForeground) end + if transparentForeground ~= gpu.getForeground() then + gpu.setForeground(transparentForeground) + end + gpu.set(x+j, y+i, transparentSymbol) end