Kaydet (Commit) 0bdad2b3 authored tarafından Luboš Luňák's avatar Luboš Luňák

use supersampling in Impress if fast opengl scaling is available

So far it's been always disabled, with the exception of the slide preview
extension.

Change-Id: Iaee6fe2d5267c9dfdc31cbf4fb90a9ac0e08e781
üst ab65925b
...@@ -560,6 +560,15 @@ public: ...@@ -560,6 +560,15 @@ public:
*/ */
bool Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag = BMP_SCALE_DEFAULT ); bool Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nScaleFlag = BMP_SCALE_DEFAULT );
/**
Returns true if bitmap scaling is considered to be fast.
Currently this returns true if OpenGL is used for scaling, otherwise false (CPU scaling is slower).
@since 4.5
*/
static bool HasFastScale();
// Adapt the BitCount of rNew to BitCount of lolal, including grey or color paltette // Adapt the BitCount of rNew to BitCount of lolal, including grey or color paltette
// Can be used to create alpha/mask bitmaps after their processing in 24bit // Can be used to create alpha/mask bitmaps after their processing in 24bit
void AdaptBitCount(Bitmap& rNew) const; void AdaptBitCount(Bitmap& rNew) const;
......
...@@ -96,7 +96,7 @@ PresenterPreviewCache::PresenterPreviewCache (const Reference<XComponentContext> ...@@ -96,7 +96,7 @@ PresenterPreviewCache::PresenterPreviewCache (const Reference<XComponentContext>
: PresenterPreviewCacheInterfaceBase(m_aMutex), : PresenterPreviewCacheInterfaceBase(m_aMutex),
maPreviewSize(Size(200,200)), maPreviewSize(Size(200,200)),
mpCacheContext(new PresenterCacheContext()), mpCacheContext(new PresenterCacheContext()),
mpCache(new PageCache(maPreviewSize, false, mpCacheContext)) mpCache(new PageCache(maPreviewSize, Bitmap::HasFastScale(), mpCacheContext))
{ {
(void)rxContext; (void)rxContext;
} }
...@@ -146,7 +146,7 @@ void SAL_CALL PresenterPreviewCache::setPreviewSize ( ...@@ -146,7 +146,7 @@ void SAL_CALL PresenterPreviewCache::setPreviewSize (
OSL_ASSERT(mpCache.get()!=NULL); OSL_ASSERT(mpCache.get()!=NULL);
maPreviewSize = Size(rSize.Width, rSize.Height); maPreviewSize = Size(rSize.Width, rSize.Height);
mpCache->ChangeSize(maPreviewSize, false); mpCache->ChangeSize(maPreviewSize, Bitmap::HasFastScale());
} }
Reference<rendering::XBitmap> SAL_CALL PresenterPreviewCache::getSlidePreview ( Reference<rendering::XBitmap> SAL_CALL PresenterPreviewCache::getSlidePreview (
......
...@@ -424,7 +424,7 @@ void SlideSorterView::Layout () ...@@ -424,7 +424,7 @@ void SlideSorterView::Layout ()
const Size aNewPreviewSize (mpLayouter->GetPageObjectLayouter()->GetPreviewSize(PageObjectLayouter::WindowCoordinateSystem)); const Size aNewPreviewSize (mpLayouter->GetPageObjectLayouter()->GetPreviewSize(PageObjectLayouter::WindowCoordinateSystem));
if (maPreviewSize != aNewPreviewSize && GetPreviewCache()) if (maPreviewSize != aNewPreviewSize && GetPreviewCache())
{ {
mpPreviewCache->ChangeSize(aNewPreviewSize, false); mpPreviewCache->ChangeSize(aNewPreviewSize, Bitmap::HasFastScale());
maPreviewSize = aNewPreviewSize; maPreviewSize = aNewPreviewSize;
} }
} }
...@@ -706,7 +706,7 @@ void SlideSorterView::ConfigurationChanged ( ...@@ -706,7 +706,7 @@ void SlideSorterView::ConfigurationChanged (
mpPreviewCache.reset( mpPreviewCache.reset(
new cache::PageCache( new cache::PageCache(
mpLayouter->GetPageObjectSize(), mpLayouter->GetPageObjectSize(),
false, Bitmap::HasFastScale(),
cache::SharedCacheContext(new ViewCacheContext(mrSlideSorter)))); cache::SharedCacheContext(new ViewCacheContext(mrSlideSorter))));
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <vcl/bitmapex.hxx> #include <vcl/bitmapex.hxx>
#include <vcl/bitmap.hxx> #include <vcl/bitmap.hxx>
#include <vcl/bitmapscalesuper.hxx> #include <vcl/bitmapscalesuper.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
...@@ -993,6 +994,11 @@ bool Bitmap::Scale( const Size& rNewSize, sal_uInt32 nScaleFlag ) ...@@ -993,6 +994,11 @@ bool Bitmap::Scale( const Size& rNewSize, sal_uInt32 nScaleFlag )
return bRet; return bRet;
} }
bool Bitmap::HasFastScale()
{
return OpenGLHelper::isVCLOpenGLEnabled();
}
void Bitmap::AdaptBitCount(Bitmap& rNew) const void Bitmap::AdaptBitCount(Bitmap& rNew) const
{ {
ImplAdaptBitCount(rNew); ImplAdaptBitCount(rNew);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment