vcl/inc/image.h | 2 + vcl/inc/unx/gtk/gtkgdi.hxx | 14 ++++++------ vcl/opengl/salbmp.cxx | 36 ++++++++++++++++++------------- vcl/source/gdi/impimage.cxx | 7 +++++- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 29 +++++++++++++++--------- 5 files changed, 55 insertions(+), 33 deletions(-)
New commits: commit 11b2e2e8113b67b9c9c8d1076c07d22ac93ada72 Author: Tomaž Vajngerl <[email protected]> Date: Mon Oct 5 17:05:45 2015 +0200 opengl: take row stride into account when reading to 1-bit bitmap Change-Id: Iaa67b209d5b6ab0d9c567a71dee0684a85f53f6b diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index a42cbae..1e62791 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -515,25 +515,31 @@ bool OpenGLSalBitmap::ReadTexture() sal_uInt8* pCurrent = pBuffer; - for (size_t i = 0; i < aBuffer.size(); i += 3) + for (int y = 0; y < mnHeight; ++y) { - sal_uInt8 nR = *pCurrent++; - sal_uInt8 nG = *pCurrent++; - sal_uInt8 nB = *pCurrent++; - - if (nR > 0 && nG > 0 && nB > 0) - { - pData[nIndex] |= (1 << nShift); - } - nShift--; - if (nShift < 0) + for (int x = 0; x < mnWidth; ++x) { - nShift = 7; - nIndex++; - pData[nIndex] = 0; + if (nShift < 0) + { + nShift = 7; + nIndex++; + pData[nIndex] = 0; + } + + sal_uInt8 nR = *pCurrent++; + sal_uInt8 nG = *pCurrent++; + sal_uInt8 nB = *pCurrent++; + + if (nR > 0 && nG > 0 && nB > 0) + { + pData[nIndex] |= (1 << nShift); + } + nShift--; } + nShift = 7; + nIndex++; + pData[nIndex] = 0; } - mnBufWidth = mnWidth; mnBufHeight = mnHeight; return true; commit 5bf651a993a466358c41d5edfe22f5085b9a0f75 Author: Tomaž Vajngerl <[email protected]> Date: Mon Oct 5 16:11:57 2015 +0200 opengl: cache Spinbox native widget textures Change-Id: Ib3e99ce36f3f0c855d2932038776f62f2d47f50c diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index b533cb4..b412286 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -189,7 +189,8 @@ protected: const clipList& aClip, ControlState nState, const ImplControlValue& aValue, - const OUString& rCaption ); + const OUString& rCaption, + ControlCacheKey& rControlCacheKey); bool NWPaintGTKArrow( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, @@ -246,11 +247,12 @@ protected: const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); - bool NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, - const Rectangle& rControlRectangle, - const clipList& rClipList, - ControlState nState, const ImplControlValue& aValue, - const OUString& rCaption ); + bool NWPaintGTKSpinBox(ControlType nType, ControlPart nPart, + const Rectangle& rControlRectangle, + const clipList& rClipList, + ControlState nState, const ImplControlValue& aValue, + const OUString& rCaption, + ControlCacheKey& rControlCacheKey); bool NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 6a0df25..7ea4892 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -971,8 +971,8 @@ bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart, if( gdkDrawable[i] == 0 ) return false; - returnVal = DoDrawNativeControl( gdkDrawable[i], nType, nPart, aCtrlRect, aClip, - nState, aValue, rCaption ); + returnVal = DoDrawNativeControl(gdkDrawable[i], nType, nPart, aCtrlRect, aClip, + nState, aValue, rCaption, aControlCacheKey); if( !returnVal ) break; } @@ -994,7 +994,8 @@ bool GtkSalGraphics::DoDrawNativeControl( const clipList& aClip, ControlState nState, const ImplControlValue& aValue, - const OUString& rCaption ) + const OUString& rCaption, + ControlCacheKey& rControlCacheKey) { if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) ) { @@ -1026,7 +1027,7 @@ bool GtkSalGraphics::DoDrawNativeControl( else if ( ((nType==CTRL_SPINBOX) || (nType==CTRL_SPINBUTTONS)) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_ALL_BUTTONS)) ) { - return NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); + return NWPaintGTKSpinBox(nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption, rControlCacheKey); } else if ( (nType == CTRL_COMBOBOX) && ( (nPart==PART_ENTIRE_CONTROL) @@ -1392,6 +1393,11 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, if( !NWRenderPixmapToScreen( _pixmap.get(), _mask.get(), aRect ) ) \ return false; +#define END_PIXMAP_RENDER_WITH_CONTROL_KEY(aRect, aControlKey) \ + } \ + if( !RenderAndCacheNativeControl( _pixmap.get(), _mask.get(), aRect.Left(), aRect.Top(), aControlKey ) ) \ + return false; + // same as above but with pixmaps that should be kept for caching #define BEGIN_CACHE_PIXMAP_RENDER(aRect, pixmap, mask, gdkPixmap) \ int _nPasses = 0; \ @@ -2478,12 +2484,13 @@ static void NWPaintOneEditBox( SalX11Screen nScreen, } -bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, - const Rectangle& rControlRectangle, - const clipList&, - ControlState nState, - const ImplControlValue& aValue, - const OUString& rCaption ) +bool GtkSalGraphics::NWPaintGTKSpinBox(ControlType nType, ControlPart nPart, + const Rectangle& rControlRectangle, + const clipList&, + ControlState nState, + const ImplControlValue& aValue, + const OUString& rCaption, + ControlCacheKey& rControlCacheKey) { Rectangle pixmapRect; GtkStateType stateType; @@ -2568,7 +2575,7 @@ bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, NWPaintOneSpinButton( m_nXScreen, gdkPixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption ); NWPaintOneSpinButton( m_nXScreen, gdkPixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption ); } - END_PIXMAP_RENDER( pixmapRect ); + END_PIXMAP_RENDER_WITH_CONTROL_KEY(pixmapRect, rControlCacheKey); return true; } commit 86186de42e13426305cf3dc8dfb076aff6a5e4ae Author: Tomaž Vajngerl <[email protected]> Date: Wed Sep 30 14:55:18 2015 +0200 create "disabled" image (icon) only if the original changes Currently we create a "disabled" version of bitmaps in "Image" class (used for toolbar icons for example) in every draw call. This is not really optimal. The solution is to calculate the checksum of the original and create a "disabled" version only if the checksum changes. Change-Id: I6ed2d08c64fee028b479fedb35e4384f112e98e2 diff --git a/vcl/inc/image.h b/vcl/inc/image.h index 5b8e92d6..0086167 100644 --- a/vcl/inc/image.h +++ b/vcl/inc/image.h @@ -39,6 +39,8 @@ public: private: BitmapEx maBmpEx; + BitmapChecksum maBitmapChecksum; + BitmapEx maDisabledBmpEx; BitmapEx* mpDisplayBmp; Size maSize; diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx index ef4410d..44720b1 100644 --- a/vcl/source/gdi/impimage.cxx +++ b/vcl/source/gdi/impimage.cxx @@ -182,7 +182,12 @@ void ImplImageBmp::Draw( OutputDevice* pOutDev, if( nStyle & DrawImageFlags::Disable ) { - ImplUpdateDisabledBmpEx(); + BitmapChecksum aChecksum = maBmpEx.GetChecksum(); + if (maBitmapChecksum != aChecksum) + { + maBitmapChecksum = aChecksum; + ImplUpdateDisabledBmpEx(); + } pOutDev->DrawBitmapEx( rPos, aOutSize, aSrcPos, maSize, maDisabledBmpEx ); } else
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
