diff --git a/Classes/pdFloodFill.cls b/Classes/pdFloodFill.cls index 9c0e66c294..f042961888 100644 --- a/Classes/pdFloodFill.cls +++ b/Classes/pdFloodFill.cls @@ -200,7 +200,7 @@ Private Function floodFillContiguous(ByRef srcDIB As pdDIB, ByRef dstDIB As pdDI pushOntoStack m_InitPoint.x, m_InitPoint.y 'Make sure 24 and 32bpp sources are both handled correctly - Dim x As Long, y As Long, QuickX As Long, xOffset As Long, hasAlpha As Boolean + Dim x As Long, y As Long, QuickX As Long, dstQuickX As Long, xOffset As Long, hasAlpha As Boolean xOffset = srcDIB.getDIBColorDepth \ 8 If srcDIB.getDIBColorDepth = 32 Then hasAlpha = True Else hasAlpha = False @@ -320,8 +320,11 @@ Private Function floodFillContiguous(ByRef srcDIB As pdDIB, ByRef dstDIB As pdDI 'If this value is within the requested tolerance, mark it on the destination map If isWithinTolerance Then - - dstImageData(x * 3, y) = 255 + + dstQuickX = x * 3 + dstImageData(dstQuickX, y) = 255 + dstImageData(dstQuickX + 1, y) = 255 + dstImageData(dstQuickX + 2, y) = 255 'If antialiasing is active, mark this pixel as filled; this simplifies the AA process If m_AntialiasingMode Then m_AlreadyChecked(x, y) = 2 @@ -355,7 +358,7 @@ Private Function floodFillGlobal(ByRef srcDIB As pdDIB, ByRef dstDIB As pdDIB) A yBound = srcDIB.getDIBHeight - 1 'Make sure 24 and 32bpp sources are both handled correctly - Dim x As Long, y As Long, QuickX As Long, xOffset As Long, hasAlpha As Boolean + Dim x As Long, y As Long, QuickX As Long, dstQuickX As Long, xOffset As Long, hasAlpha As Boolean xOffset = srcDIB.getDIBColorDepth \ 8 If srcDIB.getDIBColorDepth = 32 Then hasAlpha = True Else hasAlpha = False @@ -471,7 +474,12 @@ Private Function floodFillGlobal(ByRef srcDIB As pdDIB, ByRef dstDIB As pdDIB) A End Select 'If this value is within the requested tolerance, mark it on the destination map - If isWithinTolerance Then dstImageData(x * 3, y) = 255 + If isWithinTolerance Then + dstQuickX = x * 3 + dstImageData(dstQuickX, y) = 255 + dstImageData(dstQuickX + 1, y) = 255 + dstImageData(dstQuickX + 2, y) = 255 + End If Next y Next x @@ -537,7 +545,7 @@ Private Function floodFillCustomAA(ByRef floodFillDIB As pdDIB) As Boolean CopyMemory ByVal VarPtrArray(fImageData()), VarPtr(fSA), 4 'Populate our reference comparison values - Dim aaStrength As Long + Dim aaStrength As Long, finalResult As Byte Dim yDownSafe As Boolean, yUpSafe As Boolean Dim constMultiplier As Double @@ -585,7 +593,10 @@ Private Function floodFillCustomAA(ByRef floodFillDIB As pdDIB) As Boolean 'We know the floodfill map at this position is unfilled, so we don't even need to retrieve the value to ' calculate proper AA. - fImageData(QuickX, y) = aaStrength * constMultiplier + finalResult = aaStrength * constMultiplier + fImageData(QuickX, y) = finalResult + fImageData(QuickX + 1, y) = finalResult + fImageData(QuickX + 2, y) = finalResult End If diff --git a/Classes/pdSelection.cls b/Classes/pdSelection.cls index fc1d819148..7353f84501 100644 --- a/Classes/pdSelection.cls +++ b/Classes/pdSelection.cls @@ -629,8 +629,8 @@ Public Function getLassoClosedState() As Boolean getLassoClosedState = m_LassoClosed End Function -Public Sub setLassoClosedState(ByVal NewState As Boolean) - m_LassoClosed = NewState +Public Sub setLassoClosedState(ByVal newState As Boolean) + m_LassoClosed = newState End Sub 'For polygon selections, the canvas needs to know if the current polygon selection is open (e.g. still under construction) or closed. @@ -638,8 +638,8 @@ Public Function getPolygonClosedState() As Boolean getPolygonClosedState = m_PolygonClosed End Function -Public Sub setPolygonClosedState(ByVal NewState As Boolean) - m_PolygonClosed = NewState +Public Sub setPolygonClosedState(ByVal newState As Boolean) + m_PolygonClosed = newState End Sub 'For lasso and polygon selections, this function will return the current selecton region as a GDI+ region handle. The mouse coordinate @@ -1543,14 +1543,16 @@ Private Sub createSelectionMask() Exit Sub End If - Dim maskBackColor As Long, maskForeColor As Long + Dim maskBackColor As Long, maskForeColor As Long, maskBackByte As Byte 'Interior and exterior selections are rendered using identical code; the only difference is the colors used If getSelectionProperty_Long(SP_AREA) = sExterior Then maskBackColor = RGB(255, 255, 255) + maskBackByte = 255 maskForeColor = RGB(0, 0, 0) Else maskBackColor = RGB(0, 0, 0) + maskBackByte = 0 maskForeColor = RGB(255, 255, 255) End If @@ -1576,7 +1578,11 @@ Private Sub createSelectionMask() ' As such, use caution when calling this function, as the existing mask will be completely erased. 'Start by creating a blank mask (this will also erase any existing mask) - selMask.createBlank containingPDImage.Width, containingPDImage.Height, 24, maskBackColor + If (selMask.getDIBWidth <> containingPDImage.Width) Or (selMask.getDIBHeight <> containingPDImage.Height) Then + selMask.createBlank containingPDImage.Width, containingPDImage.Height, 24, maskBackColor + Else + selMask.resetDIB maskBackByte + End If 'Border selections are automatically disabled if the border size exceeds the smallest dimension (width or height) ' of the image @@ -1967,7 +1973,8 @@ Private Sub applyFeatheringToMask() 'If GDI+ 1.1 exists, use it for a faster blur operation. If g_GDIPlusFXAvailable Then - GDIPlusBlurDIB selMask, getSelectionProperty_Long(SP_FEATHERING_RADIUS), boundLeft, boundTop, boundWidth, boundHeight + 'GDIPlusBlurDIB selMask, getSelectionProperty_Long(SP_FEATHERING_RADIUS), boundLeft, boundTop, boundWidth, boundHeight + quickBlurDIB selMask, getSelectionProperty_Long(SP_FEATHERING_RADIUS) 'If GDI+ v1.0 is found, blurring is not supported, so fall back to PD's internal Gaussian blur function. Else diff --git a/PhotoDemon.vbp b/PhotoDemon.vbp index 222c256105..c31afd0fbc 100644 --- a/PhotoDemon.vbp +++ b/PhotoDemon.vbp @@ -317,7 +317,7 @@ Description="PhotoDemon Photo Editor" CompatibleMode="0" MajorVer=6 MinorVer=7 -RevisionVer=595 +RevisionVer=598 AutoIncrementVer=1 ServerSupportFiles=0 VersionComments="Copyright 2000-2015 Tanner Helland - photodemon.org"