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