From 694b7e11fcdffc416edfd16cf2990cb969eb89cf Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 31 Jul 2019 00:03:37 -0700 Subject: [PATCH] Move the new methods to the wxCairoPenBrushBaseData section of the file --- src/generic/graphicc.cpp | 92 ++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index f4c7ccbeff..78bbe25499 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -720,6 +720,52 @@ void wxCairoPenBrushBaseData::Apply( wxGraphicsContext* context ) cairo_set_source_rgba(ctext, m_red, m_green, m_blue, m_alpha); } +void wxCairoPenBrushBaseData::AddGradientStops(const wxGraphicsGradientStops& stops) +{ + // loop over all the stops, they include the beginning and ending ones + const unsigned numStops = stops.GetCount(); + for ( unsigned n = 0; n < numStops; n++ ) + { + const wxGraphicsGradientStop stop = stops.Item(n); + + const wxColour col = stop.GetColour(); + + cairo_pattern_add_color_stop_rgba + ( + m_pattern, + stop.GetPosition(), + col.Red()/255.0, + col.Green()/255.0, + col.Blue()/255.0, + col.Alpha()/255.0 + ); + } + + wxASSERT_MSG(cairo_pattern_status(m_pattern) == CAIRO_STATUS_SUCCESS, + wxT("Couldn't create cairo pattern")); +} + +void +wxCairoPenBrushBaseData::CreateLinearGradientBrush(wxDouble x1, wxDouble y1, + wxDouble x2, wxDouble y2, + const wxGraphicsGradientStops& stops) +{ + m_pattern = cairo_pattern_create_linear(x1,y1,x2,y2); + + AddGradientStops(stops); +} + +void +wxCairoPenBrushBaseData::CreateRadialGradientBrush(wxDouble xo, wxDouble yo, + wxDouble xc, wxDouble yc, + wxDouble radius, + const wxGraphicsGradientStops& stops) +{ + m_pattern = cairo_pattern_create_radial(xo,yo,0.0,xc,yc,radius); + + AddGradientStops(stops); +} + //----------------------------------------------------------------------------- // wxCairoPenData implementation //----------------------------------------------------------------------------- @@ -925,52 +971,6 @@ wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer, } } -void wxCairoPenBrushBaseData::AddGradientStops(const wxGraphicsGradientStops& stops) -{ - // loop over all the stops, they include the beginning and ending ones - const unsigned numStops = stops.GetCount(); - for ( unsigned n = 0; n < numStops; n++ ) - { - const wxGraphicsGradientStop stop = stops.Item(n); - - const wxColour col = stop.GetColour(); - - cairo_pattern_add_color_stop_rgba - ( - m_pattern, - stop.GetPosition(), - col.Red()/255.0, - col.Green()/255.0, - col.Blue()/255.0, - col.Alpha()/255.0 - ); - } - - wxASSERT_MSG(cairo_pattern_status(m_pattern) == CAIRO_STATUS_SUCCESS, - wxT("Couldn't create cairo pattern")); -} - -void -wxCairoPenBrushBaseData::CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops) -{ - m_pattern = cairo_pattern_create_linear(x1,y1,x2,y2); - - AddGradientStops(stops); -} - -void -wxCairoPenBrushBaseData::CreateRadialGradientBrush(wxDouble xo, wxDouble yo, - wxDouble xc, wxDouble yc, - wxDouble radius, - const wxGraphicsGradientStops& stops) -{ - m_pattern = cairo_pattern_create_radial(xo,yo,0.0,xc,yc,radius); - - AddGradientStops(stops); -} - void wxCairoBrushData::Init() { m_pattern = NULL;