diff --git a/main/vcl/source/gdi/bitmapex.cxx b/main/vcl/source/gdi/bitmapex.cxx index c2503da..7d86dc2 100644 --- a/main/vcl/source/gdi/bitmapex.cxx +++ b/main/vcl/source/gdi/bitmapex.cxx @@ -1255,44 +1255,53 @@ BitmapEx VCL_DLLPUBLIC createBlendFrame( pContent->SetPixel(y, x, aColorTopLeft); pAlpha->SetPixelIndex(y, x, nAlpha); - for(x = 1; x < nW - 1; x++) // y == 0 + if ( nW > 1 ) { - Color aMix(aColorTopLeft); + for ( x = 1; x < nW - 1; x++ ) // y == 0 + { + Color aMix( aColorTopLeft ); - aMix.Merge(aColorTopRight, 255 - sal_uInt8((x * 255) / nW)); - pContent->SetPixel(y, x, aMix); - pAlpha->SetPixelIndex(y, x, nAlpha); + aMix.Merge( aColorTopRight, 255 - sal_uInt8( ( x * 255 ) / nW ) ); + pContent->SetPixel( y, x, aMix ); + pAlpha->SetPixelIndex( y, x, nAlpha ); + } } // x == nW - 1, y == 0 pContent->SetPixel(y, x, aColorTopRight); pAlpha->SetPixelIndex(y, x, nAlpha); - for(y = 1; y < nH - 1; y++) // x == 0 and nW - 1 + if ( nH > 1 ) { - Color aMixA(aColorTopLeft); - Color aMixB(aColorTopRight); + for ( y = 1; y < nH - 1; y++ ) // x == 0 and nW - 1 + { + Color aMixA( aColorTopLeft ); + Color aMixB( aColorTopRight ); - aMixA.Merge(aColorBottomLeft, 255 - sal_uInt8((y * 255) / nH)); - pContent->SetPixel(y, 0, aMixA); - pAlpha->SetPixelIndex(y, 0, nAlpha); + aMixA.Merge( aColorBottomLeft, 255 - sal_uInt8( ( y * 255 ) / nH ) ); + pContent->SetPixel( y, 0, aMixA ); + pAlpha->SetPixelIndex( y, 0, nAlpha ); - aMixB.Merge(aColorBottomRight, 255 - sal_uInt8((y * 255) / nH)); - pContent->SetPixel(y, nW - 1, aMixB); - pAlpha->SetPixelIndex(y, nW - 1, nAlpha); + aMixB.Merge( aColorBottomRight, 255 - sal_uInt8( ( y * 255 ) / nH ) ); + pContent->SetPixel( y, nW - 1, aMixB ); + pAlpha->SetPixelIndex( y, nW - 1, nAlpha ); + } } x = 0; // x == 0, y == nH - 1 pContent->SetPixel(y, x, aColorBottomLeft); pAlpha->SetPixelIndex(y, x, nAlpha); - for(x = 1; x < nW - 1; x++) // y == nH - 1 + if ( nW > 1 ) { - Color aMix(aColorBottomLeft); + for ( x = 1; x < nW - 1; x++ ) // y == nH - 1 + { + Color aMix( aColorBottomLeft ); - aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - 0)* 255) / nW)); - pContent->SetPixel(y, x, aMix); - pAlpha->SetPixelIndex(y, x, nAlpha); + aMix.Merge( aColorBottomRight, 255 - sal_uInt8( ( ( x - 0 ) * 255 ) / nW ) ); + pContent->SetPixel( y, x, aMix ); + pAlpha->SetPixelIndex( y, x, nAlpha ); + } } // x == nW - 1, y == nH - 1