convert PaintMode to scoped enum
and drop unused INVERT enumerator Change-Id: I6db12ff76a5515bcb4691403b8fb380f9d74c1c9 Reviewed-on: https://gerrit.libreoffice.org/34055 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -393,7 +393,7 @@ SvpSalGraphics::SvpSalGraphics()
|
|||||||
, m_fScale(1.0)
|
, m_fScale(1.0)
|
||||||
, m_aLineColor(MAKE_SALCOLOR(0x00, 0x00, 0x00))
|
, m_aLineColor(MAKE_SALCOLOR(0x00, 0x00, 0x00))
|
||||||
, m_aFillColor(MAKE_SALCOLOR(0xFF, 0xFF, 0XFF))
|
, m_aFillColor(MAKE_SALCOLOR(0xFF, 0xFF, 0XFF))
|
||||||
, m_ePaintMode(OVERPAINT)
|
, m_ePaintMode(PaintMode::Over)
|
||||||
, m_aTextRenderImpl(*this)
|
, m_aTextRenderImpl(*this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -462,7 +462,7 @@ void SvpSalGraphics::SetFillColor( SalColor nSalColor )
|
|||||||
|
|
||||||
void SvpSalGraphics::SetXORMode(bool bSet )
|
void SvpSalGraphics::SetXORMode(bool bSet )
|
||||||
{
|
{
|
||||||
m_ePaintMode = bSet ? XOR : OVERPAINT;
|
m_ePaintMode = bSet ? PaintMode::Xor : PaintMode::Over;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SvpSalGraphics::SetROPLineColor( SalROPColor nROPColor )
|
void SvpSalGraphics::SetROPLineColor( SalROPColor nROPColor )
|
||||||
@@ -1291,16 +1291,13 @@ cairo_t* SvpSalGraphics::createTmpCompatibleCairoContext() const
|
|||||||
cairo_t* SvpSalGraphics::getCairoContext(bool bXorModeAllowed) const
|
cairo_t* SvpSalGraphics::getCairoContext(bool bXorModeAllowed) const
|
||||||
{
|
{
|
||||||
cairo_t* cr;
|
cairo_t* cr;
|
||||||
if (m_ePaintMode == XOR && bXorModeAllowed)
|
if (m_ePaintMode == PaintMode::Xor && bXorModeAllowed)
|
||||||
cr = createTmpCompatibleCairoContext();
|
cr = createTmpCompatibleCairoContext();
|
||||||
else
|
else
|
||||||
cr = cairo_create(m_pSurface);
|
cr = cairo_create(m_pSurface);
|
||||||
cairo_set_line_width(cr, 1);
|
cairo_set_line_width(cr, 1);
|
||||||
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
|
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
|
||||||
cairo_set_antialias(cr, getAntiAliasB2DDraw() ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
|
cairo_set_antialias(cr, getAntiAliasB2DDraw() ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE);
|
||||||
if (m_ePaintMode == INVERT)
|
|
||||||
cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
|
|
||||||
else
|
|
||||||
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
|
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
|
||||||
return cr;
|
return cr;
|
||||||
}
|
}
|
||||||
@@ -1335,7 +1332,7 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons
|
|||||||
//For the most part we avoid the use of XOR these days, but there
|
//For the most part we avoid the use of XOR these days, but there
|
||||||
//are some edge cases where legacy stuff still supports it, so
|
//are some edge cases where legacy stuff still supports it, so
|
||||||
//emulate it (slowly) here.
|
//emulate it (slowly) here.
|
||||||
if (m_ePaintMode == XOR && bXorModeAllowed)
|
if (m_ePaintMode == PaintMode::Xor && bXorModeAllowed)
|
||||||
{
|
{
|
||||||
cairo_surface_t* target_surface = m_pSurface;
|
cairo_surface_t* target_surface = m_pSurface;
|
||||||
if (cairo_surface_get_type(target_surface) != CAIRO_SURFACE_TYPE_IMAGE)
|
if (cairo_surface_get_type(target_surface) != CAIRO_SURFACE_TYPE_IMAGE)
|
||||||
|
@@ -65,7 +65,7 @@ typedef struct _cairo cairo_t;
|
|||||||
typedef struct _cairo_surface cairo_surface_t;
|
typedef struct _cairo_surface cairo_surface_t;
|
||||||
typedef struct _cairo_user_data_key cairo_user_data_key_t;
|
typedef struct _cairo_user_data_key cairo_user_data_key_t;
|
||||||
|
|
||||||
enum PaintMode { OVERPAINT, XOR, INVERT };
|
enum class PaintMode { Over, Xor };
|
||||||
|
|
||||||
typedef void (*damageHandler)(void* handle,
|
typedef void (*damageHandler)(void* handle,
|
||||||
sal_Int32 nExtentsX, sal_Int32 nExtentsY,
|
sal_Int32 nExtentsX, sal_Int32 nExtentsY,
|
||||||
|
Reference in New Issue
Block a user