BitmapEx->Bitmap in ThumbnailViewItem
now that Bitmap can handle transparency Change-Id: Ibe7f96247253a3fe9ca38fd09224ce85d0802d84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188955 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
This commit is contained in:
@@ -84,10 +84,10 @@ void OApplicationIconControl::Fill()
|
||||
// E_TABLE is 0, but 0 means void so use id of enum + 1
|
||||
std::unique_ptr<ThumbnailViewItem> xItem(new ThumbnailViewItem(*this, aCategory.eType + 1));
|
||||
xItem->mbBorder = false;
|
||||
xItem->maPreview1 = BitmapEx(aCategory.aImageResId);
|
||||
const Size& rSize = xItem->maPreview1.GetSizePixel();
|
||||
m_nMaxWidth = std::max(m_nMaxWidth, rSize.Width());
|
||||
m_nMaxHeight = std::max(m_nMaxHeight, rSize.Height());
|
||||
xItem->maPreview = Bitmap(BitmapEx(aCategory.aImageResId));
|
||||
const Size aSize = xItem->maPreview.GetSizePixel();
|
||||
m_nMaxWidth = std::max(m_nMaxWidth, aSize.Width());
|
||||
m_nMaxHeight = std::max(m_nMaxHeight, aSize.Height());
|
||||
xItem->maTitle = DBA_RES(aCategory.pLabelResId);
|
||||
m_nMaxWidth = std::max<tools::Long>(m_nMaxWidth, GetTextWidth(xItem->maTitle));
|
||||
AppendItem(std::move(xItem));
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
|
||||
static Bitmap scaleImg (const Bitmap &rImg, tools::Long width, tools::Long height);
|
||||
|
||||
static BitmapEx getDefaultThumbnail( std::u16string_view rPath );
|
||||
static Bitmap getDefaultThumbnail( std::u16string_view rPath );
|
||||
|
||||
static Bitmap fetchThumbnail (const OUString &msURL, tools::Long width, tools::Long height);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ struct TemplateItemProperties
|
||||
OUString aName;
|
||||
OUString aPath;
|
||||
OUString aRegionName;
|
||||
BitmapEx aThumbnail;
|
||||
Bitmap aThumbnail;
|
||||
};
|
||||
|
||||
#endif // INCLUDED_SFX2_TEMPLATEPROPERTIES_HXX
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
bool mbBorder;
|
||||
bool mbSelected;
|
||||
bool mbHover;
|
||||
BitmapEx maPreview1;
|
||||
Bitmap maPreview;
|
||||
OUString maTitle;
|
||||
OUString maHelpText;
|
||||
rtl::Reference< ThumbnailViewItemAcc > mxAcc;
|
||||
|
||||
@@ -232,7 +232,7 @@ RecentDocsViewItem::RecentDocsViewItem(sfx2::RecentDocsView &rView, const OUStri
|
||||
}
|
||||
|
||||
maTitle = aTitle;
|
||||
maPreview1 = aThumbnail;
|
||||
maPreview = aThumbnail;
|
||||
}
|
||||
|
||||
::tools::Rectangle RecentDocsViewItem::updateHighlight(bool bVisible, const Point& rPoint)
|
||||
|
||||
@@ -491,7 +491,7 @@ void TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
|
||||
aTemplateItem.aName = pViewItem->maTitle;
|
||||
aTemplateItem.aPath = mpDocTemplates->GetPath(nTargetRegion,nTargetIdx);
|
||||
aTemplateItem.aRegionName = pViewItem->maHelpText;
|
||||
aTemplateItem.aThumbnail = pViewItem->maPreview1;
|
||||
aTemplateItem.aThumbnail = pViewItem->maPreview;
|
||||
|
||||
pTarget->maTemplates.push_back(aTemplateItem);
|
||||
|
||||
@@ -672,7 +672,7 @@ void TemplateLocalView::insertItems(const std::vector<TemplateItemProperties> &r
|
||||
pChild->setHelpText(sHelpText);
|
||||
}
|
||||
|
||||
pChild->maPreview1 = pCur->aThumbnail;
|
||||
pChild->maPreview = pCur->aThumbnail;
|
||||
|
||||
if(IsDefaultTemplate(pCur->aPath))
|
||||
pChild->showDefaultIcon(true);
|
||||
@@ -680,7 +680,7 @@ void TemplateLocalView::insertItems(const std::vector<TemplateItemProperties> &r
|
||||
if ( pCur->aThumbnail.IsEmpty() )
|
||||
{
|
||||
// Use the default thumbnail if we have nothing else
|
||||
pChild->maPreview1 = TemplateLocalView::getDefaultThumbnail(pCur->aPath);
|
||||
pChild->maPreview = TemplateLocalView::getDefaultThumbnail(pCur->aPath);
|
||||
}
|
||||
|
||||
aItems[i] = std::move(pChild);
|
||||
@@ -865,20 +865,20 @@ void TemplateLocalView::RemoveDefaultTemplateIcon(std::u16string_view rPath)
|
||||
}
|
||||
}
|
||||
|
||||
BitmapEx TemplateLocalView::getDefaultThumbnail( std::u16string_view rPath )
|
||||
Bitmap TemplateLocalView::getDefaultThumbnail( std::u16string_view rPath )
|
||||
{
|
||||
BitmapEx aImg;
|
||||
Bitmap aImg;
|
||||
INetURLObject aUrl(rPath);
|
||||
OUString aExt = aUrl.getExtension();
|
||||
|
||||
if ( ViewFilter_Application::isFilteredExtension( FILTER_APPLICATION::WRITER, aExt) )
|
||||
aImg = BitmapEx(SFX_THUMBNAIL_TEXT);
|
||||
aImg = Bitmap(BitmapEx(SFX_THUMBNAIL_TEXT));
|
||||
else if ( ViewFilter_Application::isFilteredExtension( FILTER_APPLICATION::CALC, aExt) )
|
||||
aImg = BitmapEx(SFX_THUMBNAIL_SHEET);
|
||||
aImg = Bitmap(BitmapEx(SFX_THUMBNAIL_SHEET));
|
||||
else if ( ViewFilter_Application::isFilteredExtension( FILTER_APPLICATION::IMPRESS, aExt) )
|
||||
aImg = BitmapEx(SFX_THUMBNAIL_PRESENTATION);
|
||||
aImg = Bitmap(BitmapEx(SFX_THUMBNAIL_PRESENTATION));
|
||||
else if ( ViewFilter_Application::isFilteredExtension( FILTER_APPLICATION::DRAW, aExt) )
|
||||
aImg = BitmapEx(SFX_THUMBNAIL_DRAWING);
|
||||
aImg = Bitmap(BitmapEx(SFX_THUMBNAIL_DRAWING));
|
||||
|
||||
return aImg;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces
|
||||
true);
|
||||
|
||||
// Draw thumbnail
|
||||
Size aImageSize = maPreview1.GetSizePixel();
|
||||
Size aImageSize = maPreview.GetSizePixel();
|
||||
|
||||
float fWidth = aImageSize.Width();
|
||||
float fHeight = aImageSize.Height();
|
||||
@@ -96,7 +96,7 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces
|
||||
|
||||
aSeq[2] = new FillGraphicPrimitive2D(
|
||||
createTranslateB2DHomMatrix(maPrev1Pos.X(),maPrev1Pos.Y()),
|
||||
FillGraphicAttribute(Graphic(maPreview1),
|
||||
FillGraphicAttribute(Graphic(maPreview),
|
||||
B2DRange(
|
||||
B2DPoint(0,0),
|
||||
B2DPoint(aImageSize.Width(),aImageSize.Height())),
|
||||
|
||||
@@ -133,7 +133,7 @@ void ThumbnailViewItem::calculateItemsPosition (const tools::Long nThumbnailHeig
|
||||
pAttrs->aFontSize.getX(), pAttrs->aFontSize.getY(),
|
||||
css::lang::Locale() );
|
||||
|
||||
Size aImageSize = maPreview1.GetSizePixel();
|
||||
Size aImageSize = maPreview.GetSizePixel();
|
||||
|
||||
// Calculate thumbnail position
|
||||
const Point aPos = maDrawArea.TopCenter();
|
||||
@@ -173,11 +173,11 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc
|
||||
|
||||
// Draw thumbnail
|
||||
Point aPos = maPrev1Pos;
|
||||
Size aImageSize = maPreview1.GetSizePixel();
|
||||
Size aImageSize = maPreview.GetSizePixel();
|
||||
|
||||
aSeq[nPrimitive++] = new FillGraphicPrimitive2D(
|
||||
createTranslateB2DHomMatrix(aPos.X(),aPos.Y()),
|
||||
FillGraphicAttribute(Graphic(maPreview1),
|
||||
FillGraphicAttribute(Graphic(maPreview),
|
||||
B2DRange(
|
||||
B2DPoint(0,0),
|
||||
B2DPoint(aImageSize.Width(),aImageSize.Height())),
|
||||
|
||||
Reference in New Issue
Block a user