Kaydet (Commit) 6d0273b7 authored tarafından Chris Sherlock's avatar Chris Sherlock

fdo#74702 New abstract function UsePolyPolygonForComplexGradient()

A new protected abstract function has been introduced only for
complex gradients. As it stands, we currently need to work out if
we should use a PolyPolygon or a Polygon because, as the comments
say:

    // Determine if we output via Polygon or PolyPolygon
    // For all rasteroperations other then Overpaint always use
    // PolyPolygon, as we will get wrong results if we output multiple
    // times on top of each other.
    // Also for printers always use PolyPolygon, as not all printers
    // can print polygons on top of each other.

Interestingly, the next line is either wrong or expressed badly,
because the check uses PolyPolygons when a VirtualDevice is in use:

    // Also virtual devices are excluded, as some drivers are too slow.

Therefore, I've removed that comment as it seems rather misleading.

Change-Id: Ic496284cb2be8e7e2d348eae76aeeec994e1029c
Reviewed-on: https://gerrit.libreoffice.org/8802Reviewed-by: 's avatarChris Sherlock <chris.sherlock79@gmail.com>
Tested-by: 's avatarChris Sherlock <chris.sherlock79@gmail.com>
üst e65141e9
...@@ -805,6 +805,7 @@ protected: ...@@ -805,6 +805,7 @@ protected:
const Point& rSrcPtPixel, const Size& rSrcSizePixel ); const Point& rSrcPtPixel, const Size& rSrcSizePixel );
virtual long ImplGetGradientStepCount( long nMinRect ); virtual long ImplGetGradientStepCount( long nMinRect );
virtual bool UsePolyPolygonForComplexGradient() = 0;
/** Transform and draw a bitmap directly /** Transform and draw a bitmap directly
......
...@@ -274,6 +274,7 @@ public: ...@@ -274,6 +274,7 @@ public:
protected: protected:
long ImplGetGradientStepCount( long nMinRect ) SAL_OVERRIDE; long ImplGetGradientStepCount( long nMinRect ) SAL_OVERRIDE;
virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE;
void ScaleBitmap ( Bitmap&, SalTwoRect& ) SAL_OVERRIDE { }; void ScaleBitmap ( Bitmap&, SalTwoRect& ) SAL_OVERRIDE { };
public: public:
......
...@@ -140,6 +140,9 @@ public: ...@@ -140,6 +140,9 @@ public:
private: private:
SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
protected:
virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE;
}; };
#endif // INCLUDED_VCL_VIRDEV_HXX #endif // INCLUDED_VCL_VIRDEV_HXX
......
...@@ -579,8 +579,9 @@ protected: ...@@ -579,8 +579,9 @@ protected:
virtual sal_uInt16 getDefaultAccessibleRole() const; virtual sal_uInt16 getDefaultAccessibleRole() const;
virtual OUString getDefaultAccessibleName() const; virtual OUString getDefaultAccessibleName() const;
virtual void CopyAreaFinal( SalTwoRect& aPosAry, sal_uInt32 nFlags) SAL_OVERRIDE; virtual void CopyAreaFinal( SalTwoRect& aPosAry, sal_uInt32 nFlags) SAL_OVERRIDE;
virtual void ClipToPaintRegion( Rectangle& rDstRect ) SAL_OVERRIDE; virtual void ClipToPaintRegion( Rectangle& rDstRect ) SAL_OVERRIDE;
virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE;
public: public:
bool HasMirroredGraphics() const SAL_OVERRIDE; bool HasMirroredGraphics() const SAL_OVERRIDE;
......
...@@ -372,7 +372,6 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, ...@@ -372,7 +372,6 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect,
// as we will get wrong results if we output multiple times on top of each other. // as we will get wrong results if we output multiple times on top of each other.
// Also for printers always use PolyPolygon, as not all printers // Also for printers always use PolyPolygon, as not all printers
// can print polygons on top of each other. // can print polygons on top of each other.
// Also virtual devices are excluded, as some drivers are too slow.
boost::scoped_ptr<PolyPolygon> pPolyPoly; boost::scoped_ptr<PolyPolygon> pPolyPoly;
Rectangle aRect; Rectangle aRect;
...@@ -393,7 +392,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, ...@@ -393,7 +392,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect,
rGradient.GetBoundRect( rRect, aRect, aCenter ); rGradient.GetBoundRect( rRect, aRect, aCenter );
if( (meRasterOp != ROP_OVERPAINT) || (meOutDevType != OUTDEV_WINDOW) || bMtf ) if ( UsePolyPolygonForComplexGradient() || bMtf )
pPolyPoly.reset(new PolyPolygon( 2 )); pPolyPoly.reset(new PolyPolygon( 2 ));
long nMinRect = std::min( aRect.GetWidth(), aRect.GetHeight() ); long nMinRect = std::min( aRect.GetWidth(), aRect.GetHeight() );
......
...@@ -1863,4 +1863,9 @@ void Printer::updatePrinters() ...@@ -1863,4 +1863,9 @@ void Printer::updatePrinters()
} }
} }
bool Printer::UsePolyPolygonForComplexGradient()
{
return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -543,6 +543,11 @@ sal_uInt16 VirtualDevice::GetAlphaBitCount() const ...@@ -543,6 +543,11 @@ sal_uInt16 VirtualDevice::GetAlphaBitCount() const
return 0; return 0;
} }
bool VirtualDevice::UsePolyPolygonForComplexGradient()
{
return true;
}
void VirtualDevice::Compat_ZeroExtleadBug() void VirtualDevice::Compat_ZeroExtleadBug()
{ {
meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD; meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD;
......
...@@ -9840,4 +9840,12 @@ Selection Window::GetSurroundingTextSelection() const ...@@ -9840,4 +9840,12 @@ Selection Window::GetSurroundingTextSelection() const
return Selection( 0, 0 ); return Selection( 0, 0 );
} }
bool Window::UsePolyPolygonForComplexGradient()
{
if ( meRasterOp != ROP_OVERPAINT )
return true;
return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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