[Libreoffice-commits] core.git: vcl/headless
Caolán McNamara
caolanm at redhat.com
Wed Nov 25 12:43:29 PST 2015
vcl/headless/svpgdi.cxx | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
New commits:
commit db884459a0e250122f8bbcc906107ce424f1e955
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 25 20:39:34 2015 +0000
gtk3: use cairo to do drawAlphaBitmap with scaling
now we're beautiful
Change-Id: If688a89c3a65b7f9bb01890f8ddc81fc6cc8c2b8
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index ccfdd5c..477b33e 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -156,12 +156,6 @@ bool SvpSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, const SalBitmap& rS
return false;
}
- if (rTR.mnSrcWidth != rTR.mnDestWidth || rTR.mnSrcHeight != rTR.mnDestHeight)
- {
- SAL_WARN("vcl.gdi", "unsupported SvpSalGraphics::drawAlphaBitmap scale case");
- return false;
- }
-
cairo_surface_t* source = nullptr;
const SvpSalBitmap& rSrc = static_cast<const SvpSalBitmap&>(rSourceBitmap);
@@ -259,13 +253,15 @@ bool SvpSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR, const SalBitmap& rS
cairo_rectangle(cr, rTR.mnDestX, rTR.mnDestY, rTR.mnDestWidth, rTR.mnDestHeight);
- cairo_set_source_surface(cr, source, rTR.mnDestX - rTR.mnSrcX, rTR.mnDestY - rTR.mnSrcY);
-
if (xDamageTracker)
extents = getFillDamage(cr);
cairo_clip(cr);
- cairo_mask_surface(cr, mask, rTR.mnDestX - rTR.mnSrcX, rTR.mnDestY - rTR.mnSrcY);
+
+ cairo_translate(cr, rTR.mnDestX, rTR.mnDestY);
+ cairo_scale(cr, (double)(rTR.mnDestWidth)/rTR.mnSrcWidth, ((double)rTR.mnDestHeight)/rTR.mnSrcHeight);
+ cairo_set_source_surface(cr, source, -rTR.mnSrcX, -rTR.mnSrcY);
+ cairo_mask_surface(cr, mask, -rTR.mnSrcX, -rTR.mnSrcY);
cairo_surface_flush(cairo_get_target(cr));
cairo_surface_destroy(mask);
More information about the Libreoffice-commits
mailing list