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