Only clone the gradient's matrix when there is one

This commit is contained in:
Robin Dunn
2019-08-07 15:38:28 -07:00
committed by Robin Dunn
parent 222049f3ce
commit 320acc1796

View File

@@ -475,6 +475,7 @@ void * wxMacCoreGraphicsMatrixData::GetNativeMatrix() const
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Pen and Brush common data. Base class for information shared between pens and // Pen and Brush common data. Base class for information shared between pens and
// brushes, basically just the things needed for gradient support. // brushes, basically just the things needed for gradient support.
@@ -587,8 +588,11 @@ wxMacCoreGraphicsPenBrushDataBase::CreateLinearGradientShading(
CGPointMake((CGFloat) x2, (CGFloat) y2), CGPointMake((CGFloat) x2, (CGFloat) y2),
m_gradientFunction, true, true ); m_gradientFunction, true, true );
m_isShading = true; m_isShading = true;
if (! matrix.IsNull() )
{
m_shadingMatrix = (wxMacCoreGraphicsMatrixData*)((wxMacCoreGraphicsMatrixData*)matrix.GetRefData())->Clone(); m_shadingMatrix = (wxMacCoreGraphicsMatrixData*)((wxMacCoreGraphicsMatrixData*)matrix.GetRefData())->Clone();
m_shadingMatrix->Invert(); m_shadingMatrix->Invert();
}
} }
void void
@@ -605,8 +609,11 @@ wxMacCoreGraphicsPenBrushDataBase::CreateRadialGradientShading(
CGPointMake((CGFloat) xc, (CGFloat) yc), (CGFloat) radius, CGPointMake((CGFloat) xc, (CGFloat) yc), (CGFloat) radius,
m_gradientFunction, true, true ); m_gradientFunction, true, true );
m_isShading = true; m_isShading = true;
if (! matrix.IsNull() )
{
m_shadingMatrix = (wxMacCoreGraphicsMatrixData*)((wxMacCoreGraphicsMatrixData*)matrix.GetRefData())->Clone(); m_shadingMatrix = (wxMacCoreGraphicsMatrixData*)((wxMacCoreGraphicsMatrixData*)matrix.GetRefData())->Clone();
m_shadingMatrix->Invert(); m_shadingMatrix->Invert();
}
} }
void wxMacCoreGraphicsPenBrushDataBase::CalculateShadingValues(void *info, const CGFloat *in, CGFloat *out) void wxMacCoreGraphicsPenBrushDataBase::CalculateShadingValues(void *info, const CGFloat *in, CGFloat *out)