1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_canvas.hxx"
26 
27 #include <canvas/debug.hxx>
28 #include <tools/diagnose_ex.h>
29 #include <canvas/canvastools.hxx>
30 
31 #include "null_canvasbitmap.hxx"
32 
33 
34 using namespace ::com::sun::star;
35 
36 namespace nullcanvas
37 {
CanvasBitmap(const::basegfx::B2ISize & rSize,const DeviceRef & rDevice,bool bHasAlpha)38     CanvasBitmap::CanvasBitmap( const ::basegfx::B2ISize& rSize,
39                                 const DeviceRef&          rDevice,
40                                 bool                      bHasAlpha ) :
41         mpDevice( rDevice )
42     {
43         ENSURE_OR_THROW( mpDevice.is(),
44                           "CanvasBitmap::CanvasBitmap(): Invalid surface or device" );
45 
46         maCanvasHelper.init( rSize,
47                              *mpDevice.get(),
48                              bHasAlpha );
49     }
50 
disposing()51     void SAL_CALL CanvasBitmap::disposing()
52     {
53         mpDevice.clear();
54 
55         // forward to parent
56         CanvasBitmap_Base::disposing();
57     }
58 
59 #define IMPLEMENTATION_NAME "NullCanvas.CanvasBitmap"
60 #define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
61 
getImplementationName()62     ::rtl::OUString SAL_CALL CanvasBitmap::getImplementationName(  ) throw (uno::RuntimeException)
63     {
64         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
65     }
66 
supportsService(const::rtl::OUString & ServiceName)67     sal_Bool SAL_CALL CanvasBitmap::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
68     {
69         return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
70     }
71 
getSupportedServiceNames()72     uno::Sequence< ::rtl::OUString > SAL_CALL CanvasBitmap::getSupportedServiceNames(  ) throw (uno::RuntimeException)
73     {
74         uno::Sequence< ::rtl::OUString > aRet(1);
75         aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
76 
77         return aRet;
78     }
79 
80 }
81