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