summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-07-21 12:53:16 -0500
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-22 17:03:27 +0000
commit3712d96a3988ff05a3d3ea842bccf6bba8b38085 (patch)
tree7f58ada190f917a3288014506b072c6c175ff687
parent3b8d2fe1382618ab247db89a6c508f537e416098 (diff)
Resolves: #i122418# Added workaround to not use GetBitmap on windows
(cherry picked from commit 136976efb17b8617a83c7f26601cd04031b51e7f) Change-Id: I9c3aeae76c155c9050404f67adeb91106502c3f1 Reviewed-on: https://gerrit.libreoffice.org/5011 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--include/vcl/bitmap.hxx29
-rw-r--r--include/vcl/bitmapex.hxx32
-rw-r--r--svtools/source/control/ctrlbox.cxx14
-rw-r--r--svtools/source/control/valueset.cxx14
-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, 259 deletions
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 85aead9d1ff9..b6c00c2aa58b 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -821,35 +821,6 @@ public:
const Link* pProgress = NULL );
public:
- /** 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();
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index ce1b2ae0bd99..00a3c4e83886 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -395,6 +395,38 @@ public:
const Size &rSize );
};
+// ------------------------------------------------------------------
+/** 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
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 37cf88741fac..b839b898588c 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -307,16 +307,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 9623b29f4d50..75a8d5374c54 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -341,16 +341,14 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
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/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index b15bfc3b37fe..7684ca8bcad7 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1870,19 +1870,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);
}
}
}
@@ -2963,17 +2960,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 efe8209129e2..5defb3eb8176 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -981,7 +981,6 @@ sal_Bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link*
return bRet;
}
-
double* MakeBlurKernel(const double radius, int& rows) {
int intRadius = (int) radius + 1.0;
rows = intRadius * 2 + 1;
@@ -1164,197 +1163,4 @@ bool Bitmap::ImplSeparableUnsharpenFilter(const double radius) {
return true;
}
-
-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);
- }
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index fb3cc392ad02..12660437ce42 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -925,4 +925,153 @@ bool BitmapEx::Create( const ::com::sun::star::uno::Reference<
return false;
}
+// -----------------------------------------------------------------------------
+
+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;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index e17842609cf7..232eedb64115 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1151,6 +1151,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() );
@@ -1160,7 +1161,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 ) );
bool bClipped = false;
@@ -1218,7 +1219,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() );
}