[Libreoffice] [PATCH] fdo#31251 Writer & Impress shadow consistency

David Tardon dtardon at redhat.com
Tue May 3 05:23:44 PDT 2011


On Sat, Apr 30, 2011 at 06:58:29PM +0200, Sébastien Le Ray wrote:
>      if(aShadowColor != SwViewOption::GetShadowColor() ) {
>          aShadowColor = SwViewOption::GetShadowColor();
> -        AlphaMask aMask( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK ) );
> -        Bitmap aFilledSquare( Size( mnShadowPxWidth, mnShadowPxWidth ), 24 );
> -        aFilledSquare.Erase( aShadowColor );
>  
> +        AlphaMask aMask( shadowMask.getBottomRight().GetBitmap() );
> +        Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
> +        aFilledSquare.Erase( aShadowColor );
> ...

This looks like a good candidate for a function... Like

void lcl_createShadow(Color const& rColor, BitmapEx const& rMask,
BitmapEx& rShadow)
{
    AlphaMask aMask( rMask.GetBitmap() );
    Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
    aFilledSquare.Erase( rColor );
    rShadow = aFilledSquare;
}

But this is really just "nice to have", not a blocker :)

>      if ( bPaintRightShadow )
>      {
> -        SwPageFrm::GetRightShadowRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar );
> +        pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + 1, aPagePxRect.Bottom() + 1 - (aPageBottomRightShadow.GetSizePixel().Height() - mnShadowPxWidth) ) ),
> +            aPageBottomRightShadow );
> +        pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + 1, aPagePxRect.Top() - mnShadowPxWidth ) ),
> +            aPageTopRightShadow );
>          BitmapEx aPageRightShadow = aPageRightShadowBase;
> -        aPageRightShadow.Scale( 1, aPaintRect.Height() );
> -        pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageRightShadow );
> -        pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left(), aPaintRect.Top() - mnShadowPxWidth ) ), aPageTopRightShadow );
> -        pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.BottomLeft() ), aPageBottomRightShadow );
> +        aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
> +        pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPagePxRect.Right() + 1, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageRightShadow );

Do I count wrong or is the right shadow painted over the bottom right
corner shadow? And the same for left shadow lower.

> @@ -5326,20 +5326,19 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 9;
>              aPageTopRightShadow );
>          BitmapEx aPageRightShadow = aPageRightShadowBase;
>          aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
> -        pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPagePxRect.Right() + 1, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageRightShadow );
> +        pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageRightShadow );

Is this really correct? AFAICS it moves the shadow too much to the
right... And if it is correct, why the corner shadows do not need to be
adjusted too?

D.


More information about the LibreOffice mailing list