diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-30 10:22:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-30 10:34:34 +0000 |
commit | a80dea3e77c2a8465cdd309c5f740fb8102dd826 (patch) | |
tree | f714a25df51f2c0c18bfc56870828f92ee9db760 /vcl | |
parent | c7b2d473e32af9b2dad4f294105505084ee0a1f6 (diff) |
gtk3: implement SAL_INVERT_50 rectangle case
missing stipple effect around slides in layout panel
Change-Id: I8a55c6bda1e742e105ba22e4566658099ea16f46
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/headless/svpgdi.cxx | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 6ad14586de2a..2d98b2693802 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1172,9 +1172,69 @@ SalColor SvpSalGraphics::getPixel( long nX, long nY ) return aColor.toInt32(); } -void SvpSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert /*nFlags*/ ) +namespace { - // FIXME: handle SAL_INVERT_50 and SAL_INVERT_TRACKFRAME + cairo_pattern_t * create_stipple() + { + static unsigned char data[16] = { 0xFF, 0xFF, 0x00, 0x00, + 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0xFF, + 0x00, 0x00, 0xFF, 0xFF }; + cairo_surface_t* surface = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_A8, 4, 4, 4); + cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface); + cairo_surface_destroy(surface); + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); + cairo_pattern_set_filter(pattern, CAIRO_FILTER_NEAREST); + return pattern; + } +} + +void SvpSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags ) +{ + // FIXME: handle SAL_INVERT_TRACKFRAME + if ( nFlags & SAL_INVERT_TRACKFRAME ) + { + SAL_WARN("vcl.gdi", "SvpSalGraphics::invert, unhandled SAL_INVERT_TRACKFRAME"); + } + else if ( nFlags & SAL_INVERT_50 ) + { + if (cairo_t* cr = getCairoContext()) + { + assert(m_aDevice->isTopDown()); + + clipRegion(cr); + + cairo_pattern_t *pattern = create_stipple(); + + cairo_rectangle_int_t extents; + basebmp::IBitmapDeviceDamageTrackerSharedPtr xDamageTracker(m_aDevice->getDamageTracker()); + + cairo_rectangle(cr, nX, nY, nWidth, nHeight); + + if (xDamageTracker) + extents = getFillDamage(cr); + + cairo_clip(cr); + + cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); + cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE); + cairo_mask(cr, pattern); + cairo_pattern_destroy(pattern); + + cairo_surface_flush(cairo_get_target(cr)); + cairo_destroy(cr); // unref + + return; + } + else + SAL_WARN("vcl.gdi", "SvpSalGraphics::invert unhandled XOR (?)"); + } + else + { + SAL_WARN("vcl.gdi", "SvpSalGraphics::invert, unhandled SAL_INVERT_TRACKFRAME"); + } + + basegfx::B2DPolygon aRect = basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) ); basegfx::B2DPolyPolygon aPolyPoly( aRect ); basegfx::B2IBox aDestRange( nX, nY, nX + nWidth, nY + nHeight ); @@ -1187,6 +1247,8 @@ void SvpSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInv void SvpSalGraphics::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert /*nFlags*/ ) { + SAL_WARN("vcl.gdi", "SvpSalGraphics::invert, unhandled points case"); + // FIXME: handle SAL_INVERT_50 and SAL_INVERT_TRACKFRAME basegfx::B2DPolygon aPoly; aPoly.append( basegfx::B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints ); |