summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-06-05 14:51:49 +0000
committerArmin Le Grand <alg@apache.org>2013-06-05 14:51:49 +0000
commit136976efb17b8617a83c7f26601cd04031b51e7f (patch)
treebf03f9cb3add49720107f352170cb7a5b07ac7cf
parent79824393b320ecb277763a1fd7c2b9b770a83534 (diff)
i122418 Added workaround to not use GetBitmap on windows
Notes
-rw-r--r--svtools/source/control/ctrlbox.cxx14
-rw-r--r--svtools/source/control/valueset.cxx14
-rw-r--r--vcl/inc/vcl/bitmap.hxx30
-rw-r--r--vcl/inc/vcl/bitmapex.hxx32
-rw-r--r--vcl/source/control/ilstbox.cxx32
-rw-r--r--vcl/source/gdi/bitmap4.cxx194
-rw-r--r--vcl/source/gdi/bitmapex.cxx149
-rw-r--r--vcl/source/gdi/outdev2.cxx9
8 files changed, 214 insertions, 260 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 6e17dc13f161..537e4e6c9d80 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -232,16 +232,14 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt )
if(nEdgeBlendingPercent)
{
- Bitmap aBitmap(rUDEvt.GetDevice()->GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+ const BitmapEx aBlendFrame(createBlendFrame(aRect.GetSize(), nAlpha, rTopLeft, rBottomRight));
- if(!aBitmap.IsEmpty())
+ if(!aBlendFrame.IsEmpty())
{
- const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
- const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
- const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
-
- aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
- rUDEvt.GetDevice()->DrawBitmap(aRect.TopLeft(), aBitmap);
+ rUDEvt.GetDevice()->DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
}
}
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index eb0d2d160be7..819bcb5346e2 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -330,16 +330,14 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem )
if(nEdgeBlendingPercent)
{
- Bitmap aBitmap(maVirDev.GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+ const BitmapEx aBlendFrame(createBlendFrame(aRect.GetSize(), nAlpha, rTopLeft, rBottomRight));
- if(!aBitmap.IsEmpty())
+ if(!aBlendFrame.IsEmpty())
{
- const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
- const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
- const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
-
- aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
- maVirDev.DrawBitmap(aRect.TopLeft(), aBitmap);
+ maVirDev.DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
}
}
}
diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx
index 855d107a035b..9a8ee88c71bd 100644
--- a/vcl/inc/vcl/bitmap.hxx
+++ b/vcl/inc/vcl/bitmap.hxx
@@ -884,36 +884,6 @@ public:
const BmpFilterParam* pFilterParam = NULL,
const Link* pProgress = NULL );
- /** Draw a blend frame to the Bitmap
-
- @param nAlpha
- The blend value defines how strong the frame will be blended with the
- existing content, 255 == full coverage, 0 == no frame will be drawn
-
- @param aColorTopLeft, aColorBottomRight, aColorTopRight, aColorBottomLeft
- The colors defining the frame. If the version without aColorTopRight and
- aColorBottomLeft is used, these colors are linearly interpolated from
- aColorTopLeft and aColorBottomRight using the width and height of the area
-
- @param rTopLeft
- The start point of the frame in pixels
-
- @param rSize
- The size of the frame in pixels
- */
- void DrawBlendFrame(
- sal_uInt8 nAlpha = 128,
- Color aColorTopLeft = Color(COL_WHITE),
- Color aColorBottomRight = Color(COL_BLACK));
- void DrawBlendFrame(
- const Point& rTopLeft,
- const Size& rSize,
- sal_uInt8 nAlpha = 128,
- Color aColorTopLeft = Color(COL_WHITE),
- Color aColorTopRight = Color(COL_GRAY),
- Color aColorBottomRight = Color(COL_BLACK),
- Color aColorBottomLeft = Color(COL_GRAY));
-
BitmapReadAccess* AcquireReadAccess();
BitmapWriteAccess* AcquireWriteAccess();
void ReleaseAccess( BitmapReadAccess* pAccess );
diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx
index 0ba8ebb4ed5a..a7663bd6f966 100644
--- a/vcl/inc/vcl/bitmapex.hxx
+++ b/vcl/inc/vcl/bitmapex.hxx
@@ -421,4 +421,36 @@ public:
BitmapEx ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorModifierStack) const;
};
+// ------------------------------------------------------------------
+/** Create a blend frame as BitmapEx
+
+ @param nAlpha
+ The blend value defines how strong the frame will be blended with the
+ existing content, 255 == full coverage, 0 == no frame will be drawn
+
+ @param aColorTopLeft, aColorBottomRight, aColorTopRight, aColorBottomLeft
+ The colors defining the frame. If the version without aColorTopRight and
+ aColorBottomLeft is used, these colors are linearly interpolated from
+ aColorTopLeft and aColorBottomRight using the width and height of the area
+
+ @param rSize
+ The size of the frame in pixels
+ */
+
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorBottomRight);
+
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorTopRight,
+ Color aColorBottomRight,
+ Color aColorBottomLeft);
+
+// ------------------------------------------------------------------
+
#endif // _SV_BITMAPEX_HXX
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 3dbce51ae2c9..c4d36d0965e5 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1856,19 +1856,16 @@ void ImplListBoxWindow::DrawEntry( sal_uInt16 nPos, sal_Bool bDrawImage, sal_Boo
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0);
- if(nEdgeBlendingPercent)
+ if(nEdgeBlendingPercent && aImgSz.Width() && aImgSz.Height())
{
- const Rectangle aRect(aPtImg, aImgSz);
- Bitmap aBitmap(GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+ const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight));
- if(!aBitmap.IsEmpty())
+ if(!aBlendFrame.IsEmpty())
{
- const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
- const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
- const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
-
- aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
- DrawBitmap(aRect.TopLeft(), aBitmap);
+ DrawBitmapEx(aPtImg, aBlendFrame);
}
}
}
@@ -2996,17 +2993,14 @@ void ImplWin::DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDraw
if(nEdgeBlendingPercent)
{
- const Rectangle aRect(aPtImg, aImgSz);
- Bitmap aBitmap(GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+ const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight));
- if(!aBitmap.IsEmpty())
+ if(!aBlendFrame.IsEmpty())
{
- const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
- const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
- const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
-
- aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
- DrawBitmap(aRect.TopLeft(), aBitmap);
+ DrawBitmapEx(aPtImg, aBlendFrame);
}
}
}
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index 34238caf305a..a765d4ea45be 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -1005,198 +1005,4 @@ sal_Bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link*
}
// -----------------------------------------------------------------------------
-
-void impMixPixel(BitmapWriteAccess& rAcc, long y, long x, const Color& rColor, sal_uInt8 nAlpha)
-{
- const BitmapColor aBitmapColor(rColor);
-
- if(nAlpha)
- {
- if(255 != nAlpha)
- {
- BitmapColor aTarget(rAcc.GetColor(y, x));
-
- aTarget.Merge(aBitmapColor, nAlpha);
- rAcc.SetPixel(y, x, aTarget);
- }
- }
- else
- {
- rAcc.SetPixel(y, x, aBitmapColor);
- }
-}
-
-inline bool impVisibleX(long x, const Size& rSizePixel)
-{
- return x >= 0 && x < rSizePixel.Width();
-}
-
-inline bool impVisibleY(long y, const Size& rSizePixel)
-{
- return y >= 0 && y < rSizePixel.Width();
-}
-
-inline bool impVisibleXY(long y, long x, const Size& rSizePixel)
-{
- return impVisibleX(x, rSizePixel) && impVisibleY(y, rSizePixel);
-}
-
-void Bitmap::DrawBlendFrame(
- const Point& rTopLeft,
- const Size& rSize,
- sal_uInt8 nAlpha,
- Color aColorTopLeft,
- Color aColorTopRight,
- Color aColorBottomRight,
- Color aColorBottomLeft)
-{
- if(!IsEmpty())
- {
- const Size aSizePixel(GetSizePixel());
-
- if(aSizePixel.Width() && aSizePixel.Height())
- {
- const long nW(rSize.Width());
- const long nH(rSize.Height());
-
- if(nW || nH)
- {
- BitmapWriteAccess* pAcc = AcquireWriteAccess();
- const long nStartX(rTopLeft.X());
- const long nStartY(rTopLeft.X());
- const long nEndX(rTopLeft.X() + nW);
- const long nEndY(rTopLeft.X() + nH);
- long x(nStartX);
- long y(nStartY);
-
- if(pAcc)
- {
- if(impVisibleXY(y, x, aSizePixel))
- {
- // x == nStartX, y == nStartY
- impMixPixel(*pAcc, y, x, aColorTopLeft, nAlpha);
- }
-
- if(impVisibleY(y, aSizePixel))
- {
- for(x = 1; x < nEndX - 1; x++) // y == nStartY
- {
- if(impVisibleX(x, aSizePixel))
- {
- Color aMix(aColorTopLeft);
- aMix.Merge(aColorTopRight, 255 - sal_uInt8(((x - nStartX) * 255) / nW));
- impMixPixel(*pAcc, y, x, aMix, nAlpha);
- }
- }
- }
- else
- {
- x = nEndX - 1;
- }
-
- if(impVisibleXY(y, x, aSizePixel))
- {
- // x == nEndX - 1, y == nStartY
- impMixPixel(*pAcc, y, x, aColorTopRight, nAlpha);
- }
-
- const bool bLeftVisible(impVisibleX(nStartX, aSizePixel));
- const bool bRightVisible(impVisibleX(x, aSizePixel));
-
- if(bLeftVisible || bRightVisible)
- {
- if(bLeftVisible)
- {
- for(y = 1; y < nEndY - 1; y++) // x == nStartX and nEndX-1
- {
- if(impVisibleY(y, aSizePixel))
- {
- Color aMix(aColorTopLeft);
- aMix.Merge(aColorBottomLeft, 255 - sal_uInt8(((y - nStartY) * 255) / nH));
- impMixPixel(*pAcc, y, nStartX, aMix, nAlpha);
- }
- }
- }
-
- if(bRightVisible)
- {
- for(y = 1; y < nEndY - 1; y++) // x == nStartX and nEndX-1
- {
- if(impVisibleY(y, aSizePixel))
- {
- Color aMix(aColorTopRight);
- aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((y -nStartY) * 255) / nH));
- impMixPixel(*pAcc, y, x, aMix, nAlpha);
- }
- }
- }
- }
- else
- {
- y = nEndY - 1;
- }
-
- if(impVisibleXY(y, x, aSizePixel))
- {
- x = nStartX; // x == nStartX, y == nEndY-1
- impMixPixel(*pAcc, y, x, aColorBottomLeft, nAlpha);
- }
-
- if(impVisibleY(y, aSizePixel))
- {
- for(x = 1; x < nEndX - 1; x++) // y == nEndY-1
- {
- if(impVisibleX(x, aSizePixel))
- {
- Color aMix(aColorBottomLeft);
- aMix.Merge(aColorBottomRight, 255 - sal_uInt8(((x - nStartX)* 255) / nW));
- impMixPixel(*pAcc, y, x, aMix, nAlpha);
- }
- }
- }
- else
- {
- x = nEndX - 1;
- }
-
- if(impVisibleXY(y, x, aSizePixel))
- {
- // x == nEndX - 1, y == nEndY - 1
- impMixPixel(*pAcc, y, x, aColorBottomRight, nAlpha);
- }
-
- ReleaseAccess(pAcc);
- }
- }
- }
- }
-}
-
-void Bitmap::DrawBlendFrame(
- sal_uInt8 nAlpha,
- Color aColorTopLeft,
- Color aColorBottomRight)
-{
- if(!IsEmpty())
- {
- const Point aTopLeft(0, 0);
- const Size aSize(GetSizePixel());
- const sal_uInt32 nW(aSize.Width());
- const sal_uInt32 nH(aSize.Height());
-
- if(nW || nH)
- {
- Color aColTopRight(aColorTopLeft);
- Color aColBottomLeft(aColorTopLeft);
- const sal_uInt32 nDE(nW + nH);
-
- aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE));
- aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE));
-
- DrawBlendFrame(aTopLeft, aSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft);
- }
- }
-}
-
-// -----------------------------------------------------------------------------
// eof
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index e8ce7b97549c..f86ebe0c8bd6 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -1200,5 +1200,154 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod
}
}
+// -----------------------------------------------------------------------------
+
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorBottomRight)
+{
+ const sal_uInt32 nW(rSize.Width());
+ const sal_uInt32 nH(rSize.Height());
+
+ if(nW || nH)
+ {
+ Color aColTopRight(aColorTopLeft);
+ Color aColBottomLeft(aColorTopLeft);
+ const sal_uInt32 nDE(nW + nH);
+
+ aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE));
+ aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE));
+
+ return createBlendFrame(rSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft);
+ }
+
+ return BitmapEx();
+}
+
+BitmapEx VCL_DLLPUBLIC createBlendFrame(
+ const Size& rSize,
+ sal_uInt8 nAlpha,
+ Color aColorTopLeft,
+ Color aColorTopRight,
+ Color aColorBottomRight,
+ Color aColorBottomLeft)
+{
+ static Size aLastSize(0, 0);
+ static sal_uInt8 nLastAlpha(0);
+ static Color aLastColorTopLeft(COL_BLACK);
+ static Color aLastColorTopRight(COL_BLACK);
+ static Color aLastColorBottomRight(COL_BLACK);
+ static Color aLastColorBottomLeft(COL_BLACK);
+ static BitmapEx aLastResult;
+
+ if(aLastSize == rSize
+ && nLastAlpha == nAlpha
+ && aLastColorTopLeft == aLastColorTopLeft
+ && aLastColorTopRight == aLastColorTopRight
+ && aLastColorBottomRight == aLastColorBottomRight
+ && aLastColorBottomLeft == aLastColorBottomLeft)
+ {
+ return aLastResult;
+ }
+
+ aLastSize = rSize;
+ nLastAlpha = nAlpha;
+ aLastColorTopLeft = aLastColorTopLeft;
+ aLastColorTopRight = aLastColorTopRight;
+ aLastColorBottomRight = aLastColorBottomRight;
+ aLastColorBottomLeft = aLastColorBottomLeft;
+ aLastResult.Clear();
+
+ const long nW(rSize.Width());
+ const long nH(rSize.Height());
+
+ if(nW && nH)
+ {
+ sal_uInt8 aEraseTrans(0xff);
+ Bitmap aContent(rSize, 24);
+ AlphaMask aAlpha(rSize, &aEraseTrans);
+
+ aContent.Erase(COL_BLACK);
+
+ BitmapWriteAccess* pContent = aContent.AcquireWriteAccess();
+ BitmapWriteAccess* pAlpha = aAlpha.AcquireWriteAccess();
+
+ if(pContent && pAlpha)
+ {
+ long x(0);
+ long y(0);
+
+ // x == 0, y == 0
+ pContent->SetPixel(y, x, aColorTopLeft);
+ pAlpha->SetPixelIndex(y, x, nAlpha);
+
+ 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);
+ }
+
+ // 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
+ {
+ 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);
+
+ 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
+ {
+ Color aMix(aColorBottomLeft);
+
+ 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
+ pContent->SetPixel(y, x, aColorBottomRight);
+ pAlpha->SetPixelIndex(y, x, nAlpha);
+
+ aContent.ReleaseAccess(pContent);
+ aAlpha.ReleaseAccess(pAlpha);
+
+ aLastResult = BitmapEx(aContent, aAlpha);
+ }
+ else
+ {
+ if(pContent)
+ {
+ aContent.ReleaseAccess(pContent);
+ }
+
+ if(pAlpha)
+ {
+ aAlpha.ReleaseAccess(pAlpha);
+ }
+ }
+ }
+
+ return aLastResult;
+}
+
// ------------------------------------------------------------------
// eof
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 1ca43f10c913..1ec5f7560ec1 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1388,6 +1388,7 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
{
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ OSL_ENSURE(OUTDEV_PRINTER != GetOutDevType(), "OutputDevice::GetBitmap with sorce type OUTDEV_PRINTER should not be used (!)");
Bitmap aBmp;
long nX = ImplLogicXToDevicePixel( rSrcPt.X() );
@@ -1397,7 +1398,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
if ( mpGraphics || ( (OutputDevice*) this )->ImplGetGraphics() )
{
- if ( nWidth && nHeight )
+ if ( nWidth > 0 && nHeight > 0 && nX <= (mnOutWidth + mnOutOffX) && nY <= (mnOutHeight + mnOutOffY))
{
Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
sal_Bool bClipped = sal_False;
@@ -1456,7 +1457,13 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
aPosAry.mnDestHeight = nHeight;
if ( (nWidth > 0) && (nHeight > 0) )
+ {
(((OutputDevice*)&aVDev)->mpGraphics)->CopyBits( aPosAry, mpGraphics, this, this );
+ }
+ else
+ {
+ OSL_ENSURE(false, "CopyBits with negative width or height (!)");
+ }
aBmp = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
}