From d091cdec92947211c7675329c370ffad0e9c91a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 6 Feb 2014 16:28:45 +0100 Subject: [PATCH] Painter: Complete bitmap clipping and transformation * Turn off optimized code-paths when an alpha mask is set. The generic path already included the alpha-mask version of the AGG pipeline. * Add transformation to generic bitmap rendering. (It already worked with a transformation, so there is no slow down compared to before, only now it also includes the transformation set via BView::SetTransform()) --- src/servers/app/drawing/Painter/Painter.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/servers/app/drawing/Painter/Painter.cpp b/src/servers/app/drawing/Painter/Painter.cpp index eb38756e5e..e9f8132209 100644 --- a/src/servers/app/drawing/Painter/Painter.cpp +++ b/src/servers/app/drawing/Painter/Painter.cpp @@ -1869,7 +1869,8 @@ Painter::_DrawBitmap(agg::rendering_buffer& srcBuffer, color_space format, double yOffset = viewRect.top - bitmapRect.top; // optimized code path for B_CMAP8 and no scale - if (xScale == 1.0 && yScale == 1.0) { + if (xScale == 1.0 && yScale == 1.0 && fIdentityTransform + && fMaskedUnpackedScanline == NULL) { if (format == B_CMAP8) { if (fDrawingMode == B_OP_COPY) { _DrawBitmapNoScale32(copy_bitmap_row_cmap8_copy, 1, @@ -1958,7 +1959,8 @@ Painter::_DrawBitmap(agg::rendering_buffer& srcBuffer, color_space format, } // maybe we can use an optimized version if there is no scale - if (xScale == 1.0 && yScale == 1.0) { + if (xScale == 1.0 && yScale == 1.0 && fIdentityTransform + && fMaskedUnpackedScanline == NULL) { if (fDrawingMode == B_OP_COPY) { _DrawBitmapNoScale32(copy_bitmap_row_bgr32_copy, 4, srcBuffer, (int32)xOffset, (int32)yOffset, viewRect); @@ -1973,7 +1975,8 @@ Painter::_DrawBitmap(agg::rendering_buffer& srcBuffer, color_space format, } } - if (fDrawingMode == B_OP_COPY) { + if (fDrawingMode == B_OP_COPY && fIdentityTransform + && fMaskedUnpackedScanline == NULL) { if ((options & B_FILTER_BITMAP_BILINEAR) != 0) { _DrawBitmapBilinearCopy32(srcBuffer, xOffset, yOffset, xScale, yScale, viewRect); @@ -2611,12 +2614,14 @@ Painter::_DrawBitmapGeneric32(agg::rendering_buffer& srcBuffer, // NOTE: R5 seems to ignore this offset when drawing bitmaps // srcMatrix *= agg::trans_affine_translation(-actualBitmapRect.left, // -actualBitmapRect.top); + srcMatrix *= fTransform; agg::trans_affine imgMatrix; imgMatrix *= agg::trans_affine_translation(xOffset - viewRect.left, yOffset - viewRect.top); imgMatrix *= agg::trans_affine_scaling(xScale, yScale); imgMatrix *= agg::trans_affine_translation(viewRect.left, viewRect.top); + imgMatrix *= fTransform; imgMatrix.invert(); // image interpolator