Kaydet (Commit) 21ec9bea authored tarafından Thorsten Behrens's avatar Thorsten Behrens

XCanvas does no longer imply XBitmapCanvas

Remove the implication that XCanvas IS-A XBitmapCanvas, i.e. one can
access underlying pixels. That's a preparation for display-list based
canvas implementations, and was a rather silly assumption in the first
place.

Also fixes up all client sites.

Change-Id: I7a3d6f68ef46fe94b23cce7759cc0b8b6ca4dae9
üst 3e2dba1a
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define _CAIROCANVAS_CANVASHELPER_HXX_ #define _CAIROCANVAS_CANVASHELPER_HXX_
#include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/rendering/XCanvas.hpp>
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <com/sun/star/rendering/XIntegerBitmap.hpp> #include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <basegfx/vector/b2isize.hxx> #include <basegfx/vector/b2isize.hxx>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define _DXCANVAS_BITMAPCANVASHELPER_HXX_ #define _DXCANVAS_BITMAPCANVASHELPER_HXX_
#include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/rendering/XCanvas.hpp>
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <basegfx/vector/b2isize.hxx> #include <basegfx/vector/b2isize.hxx>
#include <basegfx/vector/b2dsize.hxx> #include <basegfx/vector/b2dsize.hxx>
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#define _DXCANVAS_CANVASHELPER_HXX_ #define _DXCANVAS_CANVASHELPER_HXX_
#include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/rendering/XCanvas.hpp>
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <basegfx/vector/b2isize.hxx> #include <basegfx/vector/b2isize.hxx>
#include <basegfx/vector/b2dsize.hxx> #include <basegfx/vector/b2dsize.hxx>
......
...@@ -387,7 +387,7 @@ namespace canvas ...@@ -387,7 +387,7 @@ namespace canvas
*pOut++ = vcl::unotools::toDoubleColor(*pIn++); *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
*pOut++ = vcl::unotools::toDoubleColor(*pIn++); *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
*pOut++ = vcl::unotools::toDoubleColor(*pIn++); *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
*pOut++ = vcl::unotools::toDoubleColor(255-*pIn++); *pOut++ = vcl::unotools::toDoubleColor(*pIn++);
} }
return aRes; return aRes;
} }
...@@ -452,7 +452,7 @@ namespace canvas ...@@ -452,7 +452,7 @@ namespace canvas
for( sal_Size i=0; i<nLen; i+=4 ) for( sal_Size i=0; i<nLen; i+=4 )
{ {
*pOut++ = rendering::ARGBColor( *pOut++ = rendering::ARGBColor(
vcl::unotools::toDoubleColor(255-pIn[3]), vcl::unotools::toDoubleColor(pIn[3]),
vcl::unotools::toDoubleColor(pIn[0]), vcl::unotools::toDoubleColor(pIn[0]),
vcl::unotools::toDoubleColor(pIn[1]), vcl::unotools::toDoubleColor(pIn[1]),
vcl::unotools::toDoubleColor(pIn[2])); vcl::unotools::toDoubleColor(pIn[2]));
...@@ -473,7 +473,7 @@ namespace canvas ...@@ -473,7 +473,7 @@ namespace canvas
rendering::ARGBColor* pOut( aRes.getArray() ); rendering::ARGBColor* pOut( aRes.getArray() );
for( sal_Size i=0; i<nLen; i+=4 ) for( sal_Size i=0; i<nLen; i+=4 )
{ {
const sal_Int8 nAlpha( 255-pIn[3] ); const sal_Int8 nAlpha( pIn[3] );
*pOut++ = rendering::ARGBColor( *pOut++ = rendering::ARGBColor(
vcl::unotools::toDoubleColor(nAlpha), vcl::unotools::toDoubleColor(nAlpha),
vcl::unotools::toDoubleColor(nAlpha*pIn[0]), vcl::unotools::toDoubleColor(nAlpha*pIn[0]),
...@@ -514,7 +514,7 @@ namespace canvas ...@@ -514,7 +514,7 @@ namespace canvas
*pColors++ = vcl::unotools::toByteColor(pIn->Red); *pColors++ = vcl::unotools::toByteColor(pIn->Red);
*pColors++ = vcl::unotools::toByteColor(pIn->Green); *pColors++ = vcl::unotools::toByteColor(pIn->Green);
*pColors++ = vcl::unotools::toByteColor(pIn->Blue); *pColors++ = vcl::unotools::toByteColor(pIn->Blue);
*pColors++ = 255-vcl::unotools::toByteColor(pIn->Alpha); *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
++pIn; ++pIn;
} }
return aRes; return aRes;
...@@ -532,7 +532,7 @@ namespace canvas ...@@ -532,7 +532,7 @@ namespace canvas
*pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha); *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha);
*pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha); *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha);
*pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha); *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha);
*pColors++ = 255-vcl::unotools::toByteColor(pIn->Alpha); *pColors++ = vcl::unotools::toByteColor(pIn->Alpha);
++pIn; ++pIn;
} }
return aRes; return aRes;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define _VCLCANVAS_CANVASHELPER_HXX_ #define _VCLCANVAS_CANVASHELPER_HXX_
#include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/rendering/XCanvas.hpp>
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <com/sun/star/rendering/XIntegerBitmap.hpp> #include <com/sun/star/rendering/XIntegerBitmap.hpp>
#include <vcl/outdev.hxx> #include <vcl/outdev.hxx>
......
...@@ -51,8 +51,6 @@ namespace cppcanvas ...@@ -51,8 +51,6 @@ namespace cppcanvas
ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) : ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) :
ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas, ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
uno::UNO_QUERY) ), uno::UNO_QUERY) ),
ImplBitmapCanvas( uno::Reference< rendering::XBitmapCanvas >(rCanvas,
uno::UNO_QUERY) ),
mxSpriteCanvas( rCanvas ), mxSpriteCanvas( rCanvas ),
mpTransformArbiter( new TransformationArbiter() ) mpTransformArbiter( new TransformationArbiter() )
{ {
...@@ -61,10 +59,8 @@ namespace cppcanvas ...@@ -61,10 +59,8 @@ namespace cppcanvas
ImplSpriteCanvas::ImplSpriteCanvas(const ImplSpriteCanvas& rOrig) : ImplSpriteCanvas::ImplSpriteCanvas(const ImplSpriteCanvas& rOrig) :
Canvas(), Canvas(),
BitmapCanvas(),
SpriteCanvas(), SpriteCanvas(),
ImplCanvas( rOrig ), ImplCanvas( rOrig ),
ImplBitmapCanvas( rOrig ),
mxSpriteCanvas( rOrig.getUNOSpriteCanvas() ), mxSpriteCanvas( rOrig.getUNOSpriteCanvas() ),
mpTransformArbiter( new TransformationArbiter() ) mpTransformArbiter( new TransformationArbiter() )
{ {
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
#include <cppcanvas/spritecanvas.hxx> #include <cppcanvas/spritecanvas.hxx>
#include <implbitmapcanvas.hxx> #include <implcanvas.hxx>
namespace cppcanvas namespace cppcanvas
{ {
namespace internal namespace internal
{ {
class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplBitmapCanvas class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplCanvas
{ {
public: public:
ImplSpriteCanvas( const ::com::sun::star::uno::Reference< ImplSpriteCanvas( const ::com::sun::star::uno::Reference<
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <cppcanvas/bitmapcanvas.hxx> #include <cppcanvas/canvas.hxx>
#include <cppcanvas/sprite.hxx> #include <cppcanvas/sprite.hxx>
#include <cppcanvas/customsprite.hxx> #include <cppcanvas/customsprite.hxx>
...@@ -49,7 +49,7 @@ namespace cppcanvas ...@@ -49,7 +49,7 @@ namespace cppcanvas
/** SpriteCanvas interface /** SpriteCanvas interface
*/ */
class SpriteCanvas : public virtual BitmapCanvas, private boost::noncopyable class SpriteCanvas : public virtual Canvas, private boost::noncopyable
{ {
public: public:
virtual bool updateScreen( bool bUpdateAll ) const = 0; virtual bool updateScreen( bool bUpdateAll ) const = 0;
......
...@@ -30,7 +30,7 @@ interface XSprite; ...@@ -30,7 +30,7 @@ interface XSprite;
interface XAnimatedSprite; interface XAnimatedSprite;
interface XCustomSprite; interface XCustomSprite;
/** Specialization of a XBitmapCanvas, where moving, animated objects /** Specialization of a XCanvas, where moving, animated objects
(called sprites) are supported.<p> (called sprites) are supported.<p>
@attention The screen output of canvas drawing operations is @attention The screen output of canvas drawing operations is
...@@ -44,9 +44,9 @@ interface XCustomSprite; ...@@ -44,9 +44,9 @@ interface XCustomSprite;
(because there's a defined moment in time where content display (because there's a defined moment in time where content display
can happen, namely the XBufferController::showBuffer()) call. If can happen, namely the XBufferController::showBuffer()) call. If
you don't need sprite functionality, and don't want the you don't need sprite functionality, and don't want the
updateScreen hassle, simply use the XBitmapCanvas. updateScreen hassle, simply use the XCanvas.
*/ */
interface XSpriteCanvas : XBitmapCanvas interface XSpriteCanvas : XCanvas
{ {
/** Create a sprite object from the specified animation /** Create a sprite object from the specified animation
sequence. A sprite is a back-buffered object with its own, sequence. A sprite is a back-buffered object with its own,
...@@ -98,9 +98,8 @@ interface XSpriteCanvas : XBitmapCanvas ...@@ -98,9 +98,8 @@ interface XSpriteCanvas : XBitmapCanvas
object. object.
The cloned sprite always shows the same content as its The cloned sprite always shows the same content as its
original. Furthermore, cloned copies of a hidden original are original, but of course the sprite position, visibility, alpha
never visible, although cloned copies of a visible original etc. can be modified independently.
can of course be invisible.
@param original @param original
The original sprite to copy the content from. This sprite must The original sprite to copy the content from. This sprite must
......
...@@ -790,17 +790,6 @@ sal_Bool SAL_CALL PresenterCanvas::hasAlpha (void) ...@@ -790,17 +790,6 @@ sal_Bool SAL_CALL PresenterCanvas::hasAlpha (void)
Reference<rendering::XBitmapCanvas> SAL_CALL PresenterCanvas::queryBitmapCanvas (void)
throw (RuntimeException)
{
ThrowIfDisposed();
return this;
}
Reference<rendering::XBitmap> SAL_CALL PresenterCanvas::getScaledBitmap( Reference<rendering::XBitmap> SAL_CALL PresenterCanvas::getScaledBitmap(
const css::geometry::RealSize2D& rNewSize, const css::geometry::RealSize2D& rNewSize,
sal_Bool bFast) sal_Bool bFast)
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/rendering/XSpriteCanvas.hpp> #include <com/sun/star/rendering/XSpriteCanvas.hpp>
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <com/sun/star/rendering/VolatileContentDestroyedException.hpp> #include <com/sun/star/rendering/VolatileContentDestroyedException.hpp>
#include <cppuhelper/basemutex.hxx> #include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase4.hxx> #include <cppuhelper/compbase4.hxx>
...@@ -373,9 +374,6 @@ public: ...@@ -373,9 +374,6 @@ public:
virtual sal_Bool SAL_CALL hasAlpha (void) virtual sal_Bool SAL_CALL hasAlpha (void)
throw (css::uno::RuntimeException); throw (css::uno::RuntimeException);
virtual css::uno::Reference<css::rendering::XBitmapCanvas> SAL_CALL queryBitmapCanvas (void)
throw (css::uno::RuntimeException);
virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL getScaledBitmap( virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL getScaledBitmap(
const css::geometry::RealSize2D& rNewSize, const css::geometry::RealSize2D& rNewSize,
sal_Bool bFast) sal_Bool bFast)
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/Size.hpp> #include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/rendering/XSpriteCanvas.hpp> #include <com/sun/star/rendering/XSpriteCanvas.hpp>
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <com/sun/star/util/Color.hpp> #include <com/sun/star/util/Color.hpp>
#include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/i18n/ScriptType.hpp>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "SlideRenderer.hxx" #include "SlideRenderer.hxx"
#include "sdpage.hxx" #include "sdpage.hxx"
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <cppcanvas/vclfactory.hxx> #include <cppcanvas/vclfactory.hxx>
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <com/sun/star/drawing/XSlideSorterBase.hpp> #include <com/sun/star/drawing/XSlideSorterBase.hpp>
#include <com/sun/star/drawing/framework/XConfigurationController.hpp> #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
#include <com/sun/star/drawing/framework/XControllerManager.hpp> #include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <com/sun/star/rendering/CompositeOperation.hpp> #include <com/sun/star/rendering/CompositeOperation.hpp>
#include <com/sun/star/rendering/TextDirection.hpp> #include <com/sun/star/rendering/TextDirection.hpp>
#include <com/sun/star/rendering/XPolyPolygon2D.hpp> #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
......
...@@ -909,6 +909,11 @@ void SlideView::clearAll() const ...@@ -909,6 +909,11 @@ void SlideView::clearAll() const
if( !mxView.is() || !mpCanvas ) if( !mxView.is() || !mpCanvas )
return; return;
mpCanvas->clear(); // this is unnecessary, strictly speaking. but
// it makes the SlideView behave exactly like a
// sprite-based SlideViewLayer, because those
// are created from scratch after a resize
// clear whole view // clear whole view
mxView->clear(); mxView->clear();
} }
...@@ -1126,10 +1131,6 @@ void SlideView::updateCanvas() ...@@ -1126,10 +1131,6 @@ void SlideView::updateCanvas()
if( !mpCanvas || !mxView.is()) if( !mpCanvas || !mxView.is())
return; return;
mpCanvas->clear(); // this is unnecessary, strictly speaking. but
// it makes the SlideView behave exactly like a
// sprite-based SlideViewLayer, because those
// are created from scratch after a resize
clearAll(); clearAll();
mpCanvas->setTransformation( getTransformation() ); mpCanvas->setTransformation( getTransformation() );
mpCanvas->setClip( mpCanvas->setClip(
......
...@@ -231,6 +231,7 @@ void SlideChangeBase::end() ...@@ -231,6 +231,7 @@ void SlideChangeBase::end()
const SlideBitmapSharedPtr pSlideBitmap( getEnteringBitmap( *aCurr )); const SlideBitmapSharedPtr pSlideBitmap( getEnteringBitmap( *aCurr ));
pSlideBitmap->clip( basegfx::B2DPolyPolygon() /* no clipping */ ); pSlideBitmap->clip( basegfx::B2DPolyPolygon() /* no clipping */ );
aCurr->mpView->clearAll();
renderBitmap( pSlideBitmap, renderBitmap( pSlideBitmap,
aCurr->mpView->getCanvas() ); aCurr->mpView->getCanvas() );
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <basegfx/vector/b2dvector.hxx> #include <basegfx/vector/b2dvector.hxx>
#include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/rendering/XCanvas.hpp>
#include <com/sun/star/presentation/XSlideShowView.hpp>
#include "waitsymbol.hxx" #include "waitsymbol.hxx"
#include "eventmultiplexer.hxx" #include "eventmultiplexer.hxx"
...@@ -103,13 +104,13 @@ void WaitSymbol::setVisible( const bool bVisible ) ...@@ -103,13 +104,13 @@ void WaitSymbol::setVisible( const bool bVisible )
basegfx::B2DPoint WaitSymbol::calcSpritePos( basegfx::B2DPoint WaitSymbol::calcSpritePos(
UnoViewSharedPtr const & rView ) const UnoViewSharedPtr const & rView ) const
{ {
const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(), const awt::Rectangle aViewArea( rView->getUnoView()->getCanvasArea() );
uno::UNO_QUERY_THROW );
const geometry::IntegerSize2D realSize( xBitmap->getSize() );
return basegfx::B2DPoint( return basegfx::B2DPoint(
std::min<sal_Int32>( realSize.Width, LEFT_BORDER_SPACE ), aViewArea.X + std::min<sal_Int32>( aViewArea.Width, LEFT_BORDER_SPACE ),
std::max<sal_Int32>( 0, realSize.Height - mxBitmap->getSize().Height aViewArea.X + std::max<sal_Int32>( 0,
- LOWER_BORDER_SPACE ) ); aViewArea.Height
- mxBitmap->getSize().Height
- LOWER_BORDER_SPACE ) );
} }
void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView ) void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView )
......
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