1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: surfaceproxymanager.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_canvas.hxx"
34 #include <canvas/rendering/isurfaceproxymanager.hxx>
35 #include <canvas/rendering/isurfaceproxy.hxx>
36 #include "surfaceproxy.hxx"
41 //////////////////////////////////////////////////////////////////////////////////
42 // SurfaceProxyManager
43 //////////////////////////////////////////////////////////////////////////////////
45 class SurfaceProxyManager
: public ISurfaceProxyManager
49 SurfaceProxyManager( const IRenderModuleSharedPtr pRenderModule
) :
50 mpPageManager( new PageManager(pRenderModule
) )
54 /** the whole idea is build around the concept that you create
55 some arbitrary buffer which contains the image data and
56 tell the texture manager about it. from there on you can
57 draw this image using any kind of graphics api you want.
58 in the technical sense we allocate some space in local
59 videomemory or AGP memory which will be filled on demand,
60 which means if there exists any rendering operation that
61 needs to read from this memory location. this method
62 creates a logical hardware surface object which uses the
63 given color buffer as the image source. internally this
64 texture may be distributed to several real hardware
67 virtual ISurfaceProxySharedPtr
createSurfaceProxy( const IColorBufferSharedPtr
& pBuffer
) const
69 // not much to do for now, simply allocate a new surface
70 // proxy from our internal pool and initialize this thing
71 // properly. we *don't* create a hardware surface for now.
72 return SurfaceProxySharedPtr(new SurfaceProxy(pBuffer
,mpPageManager
));
76 PageManagerSharedPtr mpPageManager
;
79 //////////////////////////////////////////////////////////////////////////////////
80 // createSurfaceProxyManager
81 //////////////////////////////////////////////////////////////////////////////////
83 ISurfaceProxyManagerSharedPtr
createSurfaceProxyManager( const IRenderModuleSharedPtr
& rRenderModule
)
85 return ISurfaceProxyManagerSharedPtr(
86 new SurfaceProxyManager(