xref: /AOO41X/main/cppcanvas/source/wrapper/vclfactory.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_cppcanvas.hxx"
30*cdf0e10cSrcweir #include <rtl/instance.hxx>
31*cdf0e10cSrcweir #include <osl/getglobalmutex.hxx>
32*cdf0e10cSrcweir #include <osl/diagnose.h>
33*cdf0e10cSrcweir #include <com/sun/star/rendering/InterpolationMode.hpp>
34*cdf0e10cSrcweir #include <vcl/window.hxx>
35*cdf0e10cSrcweir #include <vcl/graph.hxx>
36*cdf0e10cSrcweir #include <vcl/canvastools.hxx>
37*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygon.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <cppcanvas/vclfactory.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include <implbitmapcanvas.hxx>
42*cdf0e10cSrcweir #include <implspritecanvas.hxx>
43*cdf0e10cSrcweir #include <implpolypolygon.hxx>
44*cdf0e10cSrcweir #include <implbitmap.hxx>
45*cdf0e10cSrcweir #include <implrenderer.hxx>
46*cdf0e10cSrcweir #include <impltext.hxx>
47*cdf0e10cSrcweir #include <implsprite.hxx>
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir using namespace ::com::sun::star;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir namespace cppcanvas
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir 	/* Singleton handling */
55*cdf0e10cSrcweir     struct InitInstance
56*cdf0e10cSrcweir     {
57*cdf0e10cSrcweir         VCLFactory* operator()()
58*cdf0e10cSrcweir         {
59*cdf0e10cSrcweir             return new VCLFactory();
60*cdf0e10cSrcweir         }
61*cdf0e10cSrcweir     };
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir     VCLFactory& VCLFactory::getInstance()
64*cdf0e10cSrcweir     {
65*cdf0e10cSrcweir         return *rtl_Instance< VCLFactory, InitInstance, ::osl::MutexGuard,
66*cdf0e10cSrcweir             ::osl::GetGlobalMutex >::create(
67*cdf0e10cSrcweir                 InitInstance(), ::osl::GetGlobalMutex());
68*cdf0e10cSrcweir     }
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     VCLFactory::VCLFactory()
71*cdf0e10cSrcweir     {
72*cdf0e10cSrcweir     }
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir     VCLFactory::~VCLFactory()
75*cdf0e10cSrcweir     {
76*cdf0e10cSrcweir     }
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir     BitmapCanvasSharedPtr VCLFactory::createCanvas( const ::Window& rVCLWindow )
79*cdf0e10cSrcweir     {
80*cdf0e10cSrcweir         return BitmapCanvasSharedPtr(
81*cdf0e10cSrcweir             new internal::ImplBitmapCanvas(
82*cdf0e10cSrcweir                 uno::Reference< rendering::XBitmapCanvas >(
83*cdf0e10cSrcweir                     rVCLWindow.GetCanvas(),
84*cdf0e10cSrcweir                     uno::UNO_QUERY) ) );
85*cdf0e10cSrcweir     }
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     BitmapCanvasSharedPtr VCLFactory::createCanvas( const uno::Reference< rendering::XBitmapCanvas >& xCanvas )
88*cdf0e10cSrcweir     {
89*cdf0e10cSrcweir         return BitmapCanvasSharedPtr(
90*cdf0e10cSrcweir             new internal::ImplBitmapCanvas( xCanvas ) );
91*cdf0e10cSrcweir     }
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir     SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const ::Window& rVCLWindow ) const
94*cdf0e10cSrcweir     {
95*cdf0e10cSrcweir         return SpriteCanvasSharedPtr(
96*cdf0e10cSrcweir             new internal::ImplSpriteCanvas(
97*cdf0e10cSrcweir                 uno::Reference< rendering::XSpriteCanvas >(
98*cdf0e10cSrcweir                     rVCLWindow.GetSpriteCanvas(),
99*cdf0e10cSrcweir                     uno::UNO_QUERY) ) );
100*cdf0e10cSrcweir     }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& xCanvas ) const
103*cdf0e10cSrcweir     {
104*cdf0e10cSrcweir         return SpriteCanvasSharedPtr(
105*cdf0e10cSrcweir             new internal::ImplSpriteCanvas( xCanvas ) );
106*cdf0e10cSrcweir     }
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir     SpriteCanvasSharedPtr VCLFactory::createFullscreenSpriteCanvas( const ::Window& rVCLWindow,
109*cdf0e10cSrcweir                                                                     const Size& 	rFullscreenSize ) const
110*cdf0e10cSrcweir     {
111*cdf0e10cSrcweir         return SpriteCanvasSharedPtr(
112*cdf0e10cSrcweir             new internal::ImplSpriteCanvas(
113*cdf0e10cSrcweir                 uno::Reference< rendering::XSpriteCanvas >(
114*cdf0e10cSrcweir                     rVCLWindow.GetFullscreenSpriteCanvas( rFullscreenSize ),
115*cdf0e10cSrcweir                     uno::UNO_QUERY) ) );
116*cdf0e10cSrcweir     }
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     PolyPolygonSharedPtr VCLFactory::createPolyPolygon( const CanvasSharedPtr& 	rCanvas,
119*cdf0e10cSrcweir                                                         const ::Polygon& 		rPoly ) const
120*cdf0e10cSrcweir     {
121*cdf0e10cSrcweir         OSL_ENSURE( rCanvas.get() != NULL &&
122*cdf0e10cSrcweir                     rCanvas->getUNOCanvas().is(),
123*cdf0e10cSrcweir                     "VCLFactory::createPolyPolygon(): Invalid canvas" );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir         if( rCanvas.get() == NULL )
126*cdf0e10cSrcweir             return PolyPolygonSharedPtr();
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
129*cdf0e10cSrcweir         if( !xCanvas.is() )
130*cdf0e10cSrcweir             return PolyPolygonSharedPtr();
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir         return PolyPolygonSharedPtr(
133*cdf0e10cSrcweir             new internal::ImplPolyPolygon( rCanvas,
134*cdf0e10cSrcweir                                            ::vcl::unotools::xPolyPolygonFromPolygon(
135*cdf0e10cSrcweir                                                xCanvas->getDevice(),
136*cdf0e10cSrcweir                                                rPoly) ) );
137*cdf0e10cSrcweir     }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     PolyPolygonSharedPtr VCLFactory::createPolyPolygon( const CanvasSharedPtr& 	rCanvas,
140*cdf0e10cSrcweir                                                         const ::PolyPolygon& 	rPolyPoly ) const
141*cdf0e10cSrcweir     {
142*cdf0e10cSrcweir         OSL_ENSURE( rCanvas.get() != NULL &&
143*cdf0e10cSrcweir                     rCanvas->getUNOCanvas().is(),
144*cdf0e10cSrcweir                     "VCLFactory::createPolyPolygon(): Invalid canvas" );
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir         if( rCanvas.get() == NULL )
147*cdf0e10cSrcweir             return PolyPolygonSharedPtr();
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
150*cdf0e10cSrcweir         if( !xCanvas.is() )
151*cdf0e10cSrcweir             return PolyPolygonSharedPtr();
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir         return PolyPolygonSharedPtr(
154*cdf0e10cSrcweir             new internal::ImplPolyPolygon( rCanvas,
155*cdf0e10cSrcweir                                            ::vcl::unotools::xPolyPolygonFromPolyPolygon(
156*cdf0e10cSrcweir                                                xCanvas->getDevice(),
157*cdf0e10cSrcweir                                                rPolyPoly) ) );
158*cdf0e10cSrcweir     }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr&	rCanvas,
161*cdf0e10cSrcweir                                               const ::Size& 			rSize ) const
162*cdf0e10cSrcweir     {
163*cdf0e10cSrcweir         OSL_ENSURE( rCanvas.get() != NULL &&
164*cdf0e10cSrcweir                     rCanvas->getUNOCanvas().is(),
165*cdf0e10cSrcweir                     "VCLFactory::createBitmap(): Invalid canvas" );
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir         if( rCanvas.get() == NULL )
168*cdf0e10cSrcweir             return BitmapSharedPtr();
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
171*cdf0e10cSrcweir         if( !xCanvas.is() )
172*cdf0e10cSrcweir             return BitmapSharedPtr();
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir         return BitmapSharedPtr(
175*cdf0e10cSrcweir             new internal::ImplBitmap( rCanvas,
176*cdf0e10cSrcweir                                       xCanvas->getDevice()->createCompatibleBitmap(
177*cdf0e10cSrcweir                                           ::vcl::unotools::integerSize2DFromSize(rSize) ) ) );
178*cdf0e10cSrcweir     }
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir     BitmapSharedPtr VCLFactory::createAlphaBitmap( const CanvasSharedPtr&	rCanvas,
181*cdf0e10cSrcweir                                                    const ::Size& 			rSize ) const
182*cdf0e10cSrcweir     {
183*cdf0e10cSrcweir         OSL_ENSURE( rCanvas.get() != NULL &&
184*cdf0e10cSrcweir                     rCanvas->getUNOCanvas().is(),
185*cdf0e10cSrcweir                     "VCLFactory::createBitmap(): Invalid canvas" );
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir         if( rCanvas.get() == NULL )
188*cdf0e10cSrcweir             return BitmapSharedPtr();
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
191*cdf0e10cSrcweir         if( !xCanvas.is() )
192*cdf0e10cSrcweir             return BitmapSharedPtr();
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir         return BitmapSharedPtr(
195*cdf0e10cSrcweir             new internal::ImplBitmap( rCanvas,
196*cdf0e10cSrcweir                                       xCanvas->getDevice()->createCompatibleAlphaBitmap(
197*cdf0e10cSrcweir                                           ::vcl::unotools::integerSize2DFromSize(rSize) ) ) );
198*cdf0e10cSrcweir     }
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr& 	rCanvas,
201*cdf0e10cSrcweir                                               const ::Bitmap& 			rBitmap ) const
202*cdf0e10cSrcweir     {
203*cdf0e10cSrcweir         OSL_ENSURE( rCanvas.get() != NULL &&
204*cdf0e10cSrcweir                     rCanvas->getUNOCanvas().is(),
205*cdf0e10cSrcweir                     "VCLFactory::createBitmap(): Invalid canvas" );
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir         if( rCanvas.get() == NULL )
208*cdf0e10cSrcweir             return BitmapSharedPtr();
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
211*cdf0e10cSrcweir         if( !xCanvas.is() )
212*cdf0e10cSrcweir             return BitmapSharedPtr();
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir         return BitmapSharedPtr( new internal::ImplBitmap( rCanvas,
215*cdf0e10cSrcweir                                                           ::vcl::unotools::xBitmapFromBitmap(
216*cdf0e10cSrcweir                                                               xCanvas->getDevice(),
217*cdf0e10cSrcweir                                                               rBitmap) ) );
218*cdf0e10cSrcweir     }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir     BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr& 	rCanvas,
221*cdf0e10cSrcweir                                               const ::BitmapEx& 		rBmpEx ) const
222*cdf0e10cSrcweir     {
223*cdf0e10cSrcweir         OSL_ENSURE( rCanvas.get() != NULL &&
224*cdf0e10cSrcweir                     rCanvas->getUNOCanvas().is(),
225*cdf0e10cSrcweir                     "VCLFactory::createBitmap(): Invalid canvas" );
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir         if( rCanvas.get() == NULL )
228*cdf0e10cSrcweir             return BitmapSharedPtr();
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
231*cdf0e10cSrcweir         if( !xCanvas.is() )
232*cdf0e10cSrcweir             return BitmapSharedPtr();
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir         return BitmapSharedPtr( new internal::ImplBitmap( rCanvas,
235*cdf0e10cSrcweir                                                           ::vcl::unotools::xBitmapFromBitmapEx(
236*cdf0e10cSrcweir                                                               xCanvas->getDevice(),
237*cdf0e10cSrcweir                                                               rBmpEx) ) );
238*cdf0e10cSrcweir     }
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir     RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr& 		rCanvas,
241*cdf0e10cSrcweir                                                   const ::Graphic& 				rGraphic,
242*cdf0e10cSrcweir                                                   const Renderer::Parameters& 	rParms ) const
243*cdf0e10cSrcweir     {
244*cdf0e10cSrcweir         OSL_ENSURE( rCanvas.get() != NULL &&
245*cdf0e10cSrcweir                     rCanvas->getUNOCanvas().is(),
246*cdf0e10cSrcweir                     "VCLFactory::createRenderer(): Invalid canvas" );
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir         if( rCanvas.get() == NULL )
249*cdf0e10cSrcweir             return RendererSharedPtr();
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
252*cdf0e10cSrcweir         if( !xCanvas.is() )
253*cdf0e10cSrcweir             return RendererSharedPtr();
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir         if( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
256*cdf0e10cSrcweir             return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
257*cdf0e10cSrcweir                                                                   rGraphic.GetGDIMetaFile(),
258*cdf0e10cSrcweir                                                                   rParms ) );
259*cdf0e10cSrcweir         else
260*cdf0e10cSrcweir             return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
261*cdf0e10cSrcweir                                                                   rGraphic.GetBitmapEx(),
262*cdf0e10cSrcweir                                                                   rParms ) );
263*cdf0e10cSrcweir     }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir     RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr& 		rCanvas,
266*cdf0e10cSrcweir                                                   const ::GDIMetaFile& 			rMtf,
267*cdf0e10cSrcweir                                                   const Renderer::Parameters& 	rParms ) const
268*cdf0e10cSrcweir     {
269*cdf0e10cSrcweir         return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
270*cdf0e10cSrcweir                                                               rMtf,
271*cdf0e10cSrcweir                                                               rParms ) );
272*cdf0e10cSrcweir     }
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir     SpriteSharedPtr VCLFactory::createAnimatedSprite( const SpriteCanvasSharedPtr& rCanvas, const ::Animation& rAnim ) const
275*cdf0e10cSrcweir     {
276*cdf0e10cSrcweir         OSL_ENSURE( rCanvas.get() != NULL &&
277*cdf0e10cSrcweir                     rCanvas->getUNOCanvas().is(),
278*cdf0e10cSrcweir                     "VCLFactory::createAnimatedSprite(): Invalid canvas" );
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir         if( rCanvas.get() == NULL )
281*cdf0e10cSrcweir             return SpriteSharedPtr();
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
284*cdf0e10cSrcweir         if( !xCanvas.is() )
285*cdf0e10cSrcweir             return SpriteSharedPtr();
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir         uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas( rCanvas->getUNOSpriteCanvas() );
288*cdf0e10cSrcweir         if( !xSpriteCanvas.is() )
289*cdf0e10cSrcweir             return SpriteSharedPtr();
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir         if( rAnim.IsEmpty() )
292*cdf0e10cSrcweir             return SpriteSharedPtr();
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir         internal::ImplSpriteCanvas* pSpriteCanvas = dynamic_cast< internal::ImplSpriteCanvas* >( rCanvas.get() );
295*cdf0e10cSrcweir         if( !pSpriteCanvas )
296*cdf0e10cSrcweir             return SpriteSharedPtr();
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir         const sal_uInt16 nBitmaps( rAnim.Count() );
299*cdf0e10cSrcweir         uno::Sequence< uno::Reference< rendering::XBitmap > > aBitmapSequence( nBitmaps );
300*cdf0e10cSrcweir         uno::Reference< rendering::XBitmap >* pBitmaps = aBitmapSequence.getArray();
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir         unsigned int i;
303*cdf0e10cSrcweir         BitmapEx aBmpEx;
304*cdf0e10cSrcweir         BitmapEx aRestoreBuffer;
305*cdf0e10cSrcweir         aBmpEx.SetSizePixel( rAnim.GetDisplaySizePixel() );
306*cdf0e10cSrcweir         aRestoreBuffer.SetSizePixel( rAnim.GetDisplaySizePixel() );
307*cdf0e10cSrcweir         aBmpEx.Erase( ::Color( 255, 0,0,0 ) ); // clear alpha channel
308*cdf0e10cSrcweir         aRestoreBuffer = aBmpEx;
309*cdf0e10cSrcweir         const Point aEmptyPoint;
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir         for( i=0; i<nBitmaps; ++i )
312*cdf0e10cSrcweir         {
313*cdf0e10cSrcweir             const AnimationBitmap& rAnimBmp( rAnim.Get((sal_uInt16)i) );
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir             // Handle dispose according to GIF spec: a
316*cdf0e10cSrcweir             // DISPOSE_PREVIOUS does _not_ mean to revert to the
317*cdf0e10cSrcweir             // previous frame, but to revert to the last frame with
318*cdf0e10cSrcweir             // DISPOSE_NOT
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir             // dispose previous
321*cdf0e10cSrcweir         	if( rAnimBmp.eDisposal == DISPOSE_BACK )
322*cdf0e10cSrcweir             {
323*cdf0e10cSrcweir                 // simply clear bitmap to transparent
324*cdf0e10cSrcweir                 aBmpEx.Erase( ::Color( 255, 0,0,0 ) );
325*cdf0e10cSrcweir             }
326*cdf0e10cSrcweir     		else if( rAnimBmp.eDisposal == DISPOSE_PREVIOUS )
327*cdf0e10cSrcweir             {
328*cdf0e10cSrcweir                 // copy in last known full frame
329*cdf0e10cSrcweir                 aBmpEx = aRestoreBuffer;
330*cdf0e10cSrcweir             }
331*cdf0e10cSrcweir             // I have exactly _no_ idea what DISPOSE_FULL is supposed
332*cdf0e10cSrcweir             // to do. It's apparently not set anywhere in our code
333*cdf0e10cSrcweir             OSL_ENSURE( rAnimBmp.eDisposal!=DISPOSE_FULL,
334*cdf0e10cSrcweir                         "VCLFactory::createAnimatedSprite(): Somebody set the deprecated DISPOSE_FULL at the Animation" );
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir             // update display
337*cdf0e10cSrcweir             aBmpEx.CopyPixel( Rectangle( rAnimBmp.aPosPix,
338*cdf0e10cSrcweir                                          rAnimBmp.aSizePix ),
339*cdf0e10cSrcweir                               Rectangle( aEmptyPoint,
340*cdf0e10cSrcweir                                          rAnimBmp.aSizePix ),
341*cdf0e10cSrcweir                               &rAnimBmp.aBmpEx );
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir             // store last DISPOSE_NOT frame, for later
344*cdf0e10cSrcweir             // DISPOSE_PREVIOUS updates
345*cdf0e10cSrcweir             if( rAnimBmp.eDisposal == DISPOSE_NOT )
346*cdf0e10cSrcweir                 aRestoreBuffer = aBmpEx;
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir             pBitmaps[i] = ::vcl::unotools::xBitmapFromBitmapEx(
349*cdf0e10cSrcweir                 xCanvas->getDevice(),
350*cdf0e10cSrcweir                 aBmpEx);
351*cdf0e10cSrcweir         }
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir         return pSpriteCanvas->createSpriteFromBitmaps( aBitmapSequence,
354*cdf0e10cSrcweir                                                        rendering::InterpolationMode::NEAREST_NEIGHBOR );
355*cdf0e10cSrcweir     }
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir     TextSharedPtr VCLFactory::createText( const CanvasSharedPtr& rCanvas, const ::rtl::OUString& rText ) const
358*cdf0e10cSrcweir     {
359*cdf0e10cSrcweir         return TextSharedPtr( new internal::ImplText( rCanvas,
360*cdf0e10cSrcweir                                                       rText ) );
361*cdf0e10cSrcweir     }
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir }
364