diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2014-11-13 09:32:41 -0500 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-11-15 12:17:42 +0100 |
commit | ec5fa3c9073db79489d8eba1eb8a09029b699e3f (patch) | |
tree | eb55f47971319b8f90bb86ad37430c857fc751ae /vcl/unx/generic | |
parent | some formatting improvements (diff) | |
download | core-ec5fa3c9073db79489d8eba1eb8a09029b699e3f.tar.gz core-ec5fa3c9073db79489d8eba1eb8a09029b699e3f.zip |
vcl: Replace GetPixmapFromScreen by FillPixmapFromScreen
Conflicts:
vcl/unx/generic/gdi/gdiimpl.cxx
vcl/unx/generic/gdi/salgdi2.cxx
Change-Id: I2cb960d194ee5bc38beece97e8b21cc6fa3b3fbc
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.cxx | 16 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/pixmap.cxx | 54 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi2.cxx | 4 |
4 files changed, 9 insertions, 67 deletions
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 0088028dfd45..ee7e596fbc95 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -159,19 +159,16 @@ void X11SalGraphicsImpl::Init() mnBrushPixel = mrParent.GetPixel( mnBrushColor ); } -X11Pixmap* X11SalGraphicsImpl::GetPixmapFromScreen( const Rectangle& rRect ) +bool X11SalGraphicsImpl::FillPixmapFromScreen( X11Pixmap* pPixmap, int nX, int nY ) { //TODO lfrb: don't hardcode the depth Display* pDpy = mrParent.GetXDisplay(); - X11Pixmap* pPixmap = new X11Pixmap( pDpy, mrParent.GetScreenNumber(), - rRect.GetWidth(), rRect.GetHeight(), 24 ); GC aTmpGC = XCreateGC( pDpy, pPixmap->GetPixmap(), 0, NULL ); - if (!aTmpGC) + if( !aTmpGC ) { - delete pPixmap; - SAL_WARN( "vcl", "Could not get valid GC from screen" ); - return NULL; + SAL_WARN( "vcl", "Could not create GC from screen" ); + return false; } // Copy the background of the screen into a composite pixmap @@ -181,12 +178,11 @@ X11Pixmap* X11SalGraphicsImpl::GetPixmapFromScreen( const Rectangle& rRect ) pPixmap->GetDrawable(), pPixmap->GetScreen(), pPixmap->GetDepth(), aTmpGC, - rRect.Left(), rRect.Top(), - rRect.GetWidth(), rRect.GetHeight(), + nX, nY, pPixmap->GetWidth(), pPixmap->GetHeight(), 0, 0 ); XFreeGC( pDpy, aTmpGC ); - return pPixmap; + return true; } bool X11SalGraphicsImpl::RenderPixmapToScreen( X11Pixmap* pPixmap, int nX, int nY ) diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index fed9bc6b9a4b..2d9294a629d9 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -274,7 +274,7 @@ public: // implementation of X11GraphicsImpl void Init() SAL_OVERRIDE; - X11Pixmap* GetPixmapFromScreen( const Rectangle& rRect ) SAL_OVERRIDE; + bool FillPixmapFromScreen( X11Pixmap* pPixmap, int nX, int nY ) SAL_OVERRIDE; bool RenderPixmapToScreen( X11Pixmap* pPixmap, int nX, int nY ) SAL_OVERRIDE; }; diff --git a/vcl/unx/generic/gdi/pixmap.cxx b/vcl/unx/generic/gdi/pixmap.cxx deleted file mode 100644 index 0440c463c2e5..000000000000 --- a/vcl/unx/generic/gdi/pixmap.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "unx/pixmap.hxx" - -X11Pixmap::X11Pixmap() -: mpDisplay( NULL ) -, mnScreen( 0 ) -, mpPixmap( 0 ) -, mbDeletePixmap( false ) -, mnWidth( -1 ) -, mnHeight( -1 ) -, mnDepth( 0 ) -{ -} - -X11Pixmap::X11Pixmap( Display* pDisplay, SalX11Screen nScreen, int nWidth, int nHeight, int nDepth ) -: mpDisplay( pDisplay ) -, mnScreen( nScreen ) -, mbDeletePixmap( true ) -, mnWidth( nWidth ) -, mnHeight( nHeight ) -, mnDepth( nDepth ) -{ - Window root = RootWindow( pDisplay, 0 ); - mpPixmap = XCreatePixmap( pDisplay, root, nWidth, nHeight, nDepth ); -} - -X11Pixmap::X11Pixmap( X11Pixmap& rOther ) -: mpDisplay( rOther.mpDisplay ) -, mnScreen( rOther.mnScreen ) -, mbDeletePixmap( rOther.mbDeletePixmap ) -, mnWidth( rOther.mnWidth ) -, mnHeight( rOther.mnHeight ) -, mnDepth( rOther.mnDepth ) -{ - mpPixmap = rOther.mpPixmap; - rOther.mpPixmap = 0; - rOther.mbDeletePixmap = false; -} - -X11Pixmap::~X11Pixmap() -{ - if (mbDeletePixmap && mpPixmap) - XFreePixmap( mpDisplay, mpPixmap ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx index 768e5967e323..9ef50b87c747 100644 --- a/vcl/unx/generic/gdi/salgdi2.cxx +++ b/vcl/unx/generic/gdi/salgdi2.cxx @@ -83,10 +83,10 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay, } } -X11Pixmap* X11SalGraphics::GetPixmapFromScreen( const Rectangle& rRect ) +bool X11SalGraphics::FillPixmapFromScreen( X11Pixmap* pPixmap, int nX, int nY ) { X11GraphicsImpl& rImpl = dynamic_cast<X11GraphicsImpl&>(*mpImpl.get()); - return rImpl.GetPixmapFromScreen( rRect ); + return rImpl.FillPixmapFromScreen( pPixmap, nX, nY ); } bool X11SalGraphics::RenderPixmapToScreen( X11Pixmap* pPixmap, int nX, int nY ) |