diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-02-05 15:58:56 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-02-05 16:36:19 -0600 |
commit | 352ff66347d3e71e7091522a73c24a4bc65b9975 (patch) | |
tree | a54de2e508525ea8570affa8f36624b7772f5ce6 /vcl/source | |
parent | 3d11e86363d28f44259760dae41487d45deefef1 (diff) |
Revert "hidpi: Blind fix - avoid double scaling by updating GetItemImage()."
The GetItemImage change causes some controls to draw wrongly and have
hit-testing problems. The change is broken because we want them to
think the bitmap is big. One day LibreOffice will use large bitmaps.
Some places call SetItemImage repeatedly, such as the font color dropdown
control and so it needs a sanity check in SetItemImage.
This reverts commit 0459682b4186b7522783e33cca3791420559817a.
Change-Id: If208543def6467ad7d19e21edf0ab11e9a32f0f4
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 90278a723d18..c29a4a679071 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -622,17 +622,9 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::InsertItem(): ItemId already exists" ); - Image aImage(rImage); - if (GetDPIScaleFactor() > 1) - { - BitmapEx aBitmap(aImage.GetBitmapEx()); - aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); - aImage = Image(aBitmap); - } - - mpData->m_aItems.insert((nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), - ImplToolItem(nItemId, aImage, nBits)); - + // Item anlegen und in die Liste einfuegen + mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, nBits ) ); + SetItemImage(nItemId, rImage); mpData->ImplClearLayoutData(); ImplInvalidate( sal_True ); @@ -652,17 +644,9 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::InsertItem(): ItemId already exists" ); - Image aImage(rImage); - if (GetDPIScaleFactor() > 1) - { - BitmapEx aBitmap(aImage.GetBitmapEx()); - aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); - aImage = Image(aBitmap); - } - - mpData->m_aItems.insert((nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), - ImplToolItem(nItemId, aImage, ImplConvertMenuString(rText), nBits)); - + // Item anlegen und in die Liste einfuegen + mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) ); + SetItemImage(nItemId, rImage); mpData->ImplClearLayoutData(); ImplInvalidate( sal_True ); @@ -1369,11 +1353,17 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) { Image aImage(rImage); - if (GetDPIScaleFactor() > 1) + if ( GetDPIScaleFactor() > 1) { BitmapEx aBitmap(aImage.GetBitmapEx()); - aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); - aImage = Image(aBitmap); + + // Some code calls this twice, so add a sanity check + // FIXME find out what that code is & fix accordingly + if (aBitmap.GetSizePixel().Width() < 32) + { + aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); + aImage = Image(aBitmap); + } } ImplToolItem* pItem = &mpData->m_aItems[nPos]; @@ -1497,20 +1487,7 @@ Image ToolBox::GetItemImage( sal_uInt16 nItemId ) const ImplToolItem* pItem = ImplGetItem( nItemId ); if ( pItem ) - { - Image aImage(pItem->maImage); - - if (GetDPIScaleFactor() > 1) - { - // we have scaled everything we have inserted, so scale it back to - // the original size - BitmapEx aBitmap(aImage.GetBitmapEx()); - aBitmap.Scale(1.0/GetDPIScaleFactor(), 1.0/GetDPIScaleFactor(), BMP_SCALE_FAST); - aImage = Image(aBitmap); - } - - return aImage; - } + return pItem->maImage; else return Image(); } |