summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-04-12 18:21:11 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-06-25 05:41:08 +0200
commitde61b526192cf99f6753eff4bf9ce2ab60da69bf (patch)
tree8c9d2dd6b4dd14f957f844da8a2916e388d9b2d3 /sd
parent0036ced049d56557570b808f4c03df1127ca679e (diff)
slidesorter - cleanup redundant caches and notifications.
Change-Id: Ibe8106a77899f141d1e3722bcae615ab905b2568
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx25
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx2
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx52
3 files changed, 41 insertions, 38 deletions
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
index bb91270309fa..d47ef2152a06 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
@@ -46,8 +46,6 @@ public:
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor);
- void NotifyResize (const bool bForce = false);
-
/** Called when the theme changes, either because it is replaced with
another or because the system colors have changed. So, even when
the given theme is the same object as the one already in use by this
@@ -72,7 +70,6 @@ public:
private:
const Layouter& mrLayouter;
- ::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter;
::boost::shared_ptr<cache::PageCache> mpCache;
::boost::shared_ptr<controller::Properties> mpProperties;
::boost::shared_ptr<view::Theme> mpTheme;
@@ -90,15 +87,19 @@ private:
Size maSize;
void PaintBackground (
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor);
+ const model::SharedPageDescriptor& rpDescriptor) const;
void PaintPreview (
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor) const;
void PaintPageNumber (
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor) const;
void PaintTransitionEffect (
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor) const;
void PaintCustomAnimationEffect (
@@ -109,22 +110,10 @@ private:
const Theme::GradientColorType eColorType,
const Rectangle& rBox) const;
void PaintBackgroundDetail(
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor);
+ const model::SharedPageDescriptor& rpDescriptor) const;
-#if 0
- Bitmap& GetBackgroundForState (
- const OutputDevice& rTemplateDevice);
- Bitmap& GetBackground(
- Bitmap& rBackground,
- Theme::GradientColorType eType,
- const OutputDevice& rTemplateDevice,
- const bool bHasFocusBorder);
- Bitmap CreateBackgroundBitmap(
- const OutputDevice& rReferenceDevice,
- const Theme::GradientColorType eType,
- const bool bHasFocusBorder) const;
-#endif
Bitmap CreateMarkedPreview(
const Size& rSize,
const Bitmap& rPreview,
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index dd139f856c81..e823e900a568 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -494,8 +494,6 @@ void SlideSorterView::Layout ()
model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
pDescriptor->SetBoundingBox(mpLayouter->GetPageObjectBox(pDescriptor->GetPageIndex()));
}
-
- GetPageObjectPainter()->NotifyResize();
}
InvalidatePageObjectVisibilities ();
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index 6a7515c525ac..bd6c509bf68d 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include "view/SlsPageObjectPainter.hxx"
#include "model/SlsPageDescriptor.hxx"
@@ -47,7 +46,6 @@ namespace sd { namespace slidesorter { namespace view {
PageObjectPainter::PageObjectPainter (
const SlideSorter& rSlideSorter)
: mrLayouter(rSlideSorter.GetView().GetLayouter()),
- mpPageObjectLayouter(),
mpCache(rSlideSorter.GetView().GetPreviewCache()),
mpProperties(rSlideSorter.GetProperties()),
mpTheme(rSlideSorter.GetTheme()),
@@ -101,14 +99,26 @@ bool PageObjectPainter::UpdatePageObjectLayouter (void)
{
// The page object layouter is quite volatile. It may have been replaced
// since the last call. Update it now.
- mpPageObjectLayouter = mrLayouter.GetPageObjectLayouter();
- if ( ! mpPageObjectLayouter)
+ PageObjectLayouter *pPageObjectLayouter = mrLayouter.GetPageObjectLayouter().get();
+ if ( ! pPageObjectLayouter)
{
- OSL_ASSERT(mpPageObjectLayouter);
+ OSL_FAIL("no page object layouter");
return false;
}
- else
- return true;
+
+ // Turn off antialiasing to avoid the bitmaps from being shifted by
+ // fractions of a pixel and thus show blurry edges.
+ const sal_uInt16 nSavedAntialiasingMode (rDevice.GetAntialiasing());
+ rDevice.SetAntialiasing(nSavedAntialiasingMode & ~ANTIALIASING_ENABLE_B2DDRAW);
+
+ PaintBackground(pPageObjectLayouter, rDevice, rpDescriptor);
+ PaintPreview(pPageObjectLayouter, rDevice, rpDescriptor);
+ PaintPageNumber(pPageObjectLayouter, rDevice, rpDescriptor);
+ PaintTransitionEffect(pPageObjectLayouter, rDevice, rpDescriptor);
+
+ rDevice.SetAntialiasing(nSavedAntialiasingMode);
+
+ return true;
}
@@ -146,17 +156,18 @@ void PageObjectPainter::InvalidateBitmaps (void)
maMouseOverSelectedAndFocusedBackground.SetEmpty();
}
+>>>>>>> slidesorter - cleanup redundant caches and notifications.
void PageObjectPainter::SetTheme (const ::boost::shared_ptr<view::Theme>& rpTheme)
{
mpTheme = rpTheme;
- NotifyResize(true);
}
void PageObjectPainter::PaintBackground (
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
- const model::SharedPageDescriptor& rpDescriptor)
+ const model::SharedPageDescriptor& rpDescriptor) const
{
- PaintBackgroundDetail(rDevice, rpDescriptor);
+ PaintBackgroundDetail(pPageObjectLayouter, rDevice, rpDescriptor);
// Fill the interior of the preview area with the default background
// color of the page.
@@ -165,7 +176,7 @@ void PageObjectPainter::PaintBackground (
{
rDevice.SetFillColor(pPage->GetPageBackgroundColor(NULL));
rDevice.SetLineColor(pPage->GetPageBackgroundColor(NULL));
- const Rectangle aPreviewBox (mpPageObjectLayouter->GetBoundingBox(
+ const Rectangle aPreviewBox (pPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::Preview,
PageObjectLayouter::ModelCoordinateSystem));
@@ -177,10 +188,11 @@ void PageObjectPainter::PaintBackground (
void PageObjectPainter::PaintPreview (
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor) const
{
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ const Rectangle aBox (pPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::Preview,
PageObjectLayouter::ModelCoordinateSystem));
@@ -243,8 +255,10 @@ Bitmap PageObjectPainter::GetPreviewBitmap (
if (bIsExcluded)
{
+ PageObjectLayouter *pPageObjectLayouter = mrLayouter.GetPageObjectLayouter().get();
+
Bitmap aMarkedPreview (mpCache->GetMarkedPreviewBitmap(pPage,false));
- const Rectangle aPreviewBox (mpPageObjectLayouter->GetBoundingBox(
+ const Rectangle aPreviewBox (pPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::Preview,
PageObjectLayouter::ModelCoordinateSystem));
@@ -269,10 +283,11 @@ Bitmap PageObjectPainter::GetPreviewBitmap (
void PageObjectPainter::PaintPageNumber (
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor) const
{
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ const Rectangle aBox (pPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::PageNumber,
PageObjectLayouter::ModelCoordinateSystem));
@@ -324,13 +339,14 @@ void PageObjectPainter::PaintPageNumber (
void PageObjectPainter::PaintTransitionEffect (
+ PageObjectLayouter *pPageObjectLayouter,
OutputDevice& rDevice,
const model::SharedPageDescriptor& rpDescriptor) const
{
const SdPage* pPage = rpDescriptor->GetPage();
if (pPage!=NULL && pPage->getTransitionType() > 0)
{
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ const Rectangle aBox (pPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::TransitionEffectIndicator,
PageObjectLayouter::ModelCoordinateSystem));
@@ -420,12 +436,12 @@ Bitmap& PageObjectPainter::GetBackgroundForState (
break;
}
- const Rectangle aFocusSize (mpPageObjectLayouter->GetBoundingBox(
+ const Rectangle aFocusSize (pPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::FocusIndicator,
PageObjectLayouter::ModelCoordinateSystem));
- const Rectangle aPageObjectBox (mpPageObjectLayouter->GetBoundingBox(
+ const Rectangle aPageObjectBox (pPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::PageObject,
PageObjectLayouter::ModelCoordinateSystem));
@@ -484,7 +500,7 @@ Bitmap& PageObjectPainter::GetBackgroundForState (
// Get bounding box of the preview around which a shadow is painted.
// Compensate for the border around the preview.
- const Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
+ const Rectangle aBox (pPageObjectLayouter->GetBoundingBox(
rpDescriptor,
PageObjectLayouter::Preview,
PageObjectLayouter::ModelCoordinateSystem));