[Libreoffice-commits] core.git: 2 commits - vcl/inc vcl/win
Jan Holesovsky
kendy at collabora.com
Thu Mar 19 12:30:48 PDT 2015
vcl/inc/win/salgdi.h | 3 +++
vcl/win/source/gdi/salgdi.cxx | 3 ++-
vcl/win/source/gdi/salnativewidgets-luna.cxx | 10 ++++++----
3 files changed, 11 insertions(+), 5 deletions(-)
New commits:
commit 5b0f3cf836054da94968eddffc2647b50236739e
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 19 20:24:07 2015 +0100
opengl dr.memory: DC that contains selected object being deleted.
Change-Id: I3cfb09eacfa129a92dace47fd26ccf6e5d1a6756
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 287daf4..e956e0f 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -155,6 +155,9 @@ private:
/// DIBSection that we use for the GDI drawing, and later obtain.
HBITMAP mhBitmap;
+ /// Return the previous bitmap to undo the SelectObject.
+ HBITMAP mhOrigBitmap;
+
/// DIBSection data.
sal_uInt32 *mpData;
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index fc74d05..ff74b0f 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -582,13 +582,14 @@ OpenGLCompatibleDC::OpenGLCompatibleDC(SalGraphics &rGraphics, int x, int y, int
mhBitmap = WinSalVirtualDevice::ImplCreateVirDevBitmap(mhCompatibleDC, width, height, 32, reinterpret_cast<void **>(&mpData));
- SelectObject(mhCompatibleDC, mhBitmap);
+ mhOrigBitmap = (HBITMAP) SelectObject(mhCompatibleDC, mhBitmap);
}
OpenGLCompatibleDC::~OpenGLCompatibleDC()
{
if (mpImpl)
{
+ SelectObject(mhCompatibleDC, mhOrigBitmap);
DeleteObject(mhBitmap);
DeleteDC(mhCompatibleDC);
}
commit a175977e1eb7fe63b2314dcfb3944e87889af455
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 19 20:11:31 2015 +0100
dr.memory: Deleting a drawing object that is selected into DC.
Change-Id: I2b04152896cdd231cc9be4ab008bc57a65c840da
diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index 9b690db..aedbf89 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -475,12 +475,13 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool bHorizontal )
// and a darker horizontal line under that
HPEN hpen = CreatePen( PS_SOLID, 1, RGB( 0xb0, 0xb0, 0xb0 ) );
- SelectObject( hDC, hpen );
+ HPEN hOrigPen = (HPEN) SelectObject(hDC, hpen);
MoveToEx( hDC, rc.left, gradient_bottom, NULL );
LineTo( hDC, rc.right, gradient_bottom );
- DeleteObject( hpen );
+ SelectObject(hDC, hOrigPen);
+ DeleteObject(hpen);
}
else
{
@@ -500,12 +501,13 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool bHorizontal )
from_y = to_y = rc.top;
HPEN hpen = CreatePen( PS_SOLID, 1, RGB( 0xb0, 0xb0, 0xb0 ) );
- SelectObject( hDC, hpen );
+ HPEN hOrigPen = (HPEN) SelectObject(hDC, hpen);
MoveToEx( hDC, from_x, from_y, NULL );
LineTo( hDC, to_x, to_y );
- DeleteObject( hpen );
+ SelectObject(hDC, hOrigPen);
+ DeleteObject(hpen);
}
}
}
More information about the Libreoffice-commits
mailing list