1*25ea7f45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*25ea7f45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*25ea7f45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*25ea7f45SAndrew Rist * distributed with this work for additional information 6*25ea7f45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*25ea7f45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*25ea7f45SAndrew Rist * "License"); you may not use this file except in compliance 9*25ea7f45SAndrew Rist * with the License. You may obtain a copy of the License at 10*25ea7f45SAndrew Rist * 11*25ea7f45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*25ea7f45SAndrew Rist * 13*25ea7f45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*25ea7f45SAndrew Rist * software distributed under the License is distributed on an 15*25ea7f45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*25ea7f45SAndrew Rist * KIND, either express or implied. See the License for the 17*25ea7f45SAndrew Rist * specific language governing permissions and limitations 18*25ea7f45SAndrew Rist * under the License. 19*25ea7f45SAndrew Rist * 20*25ea7f45SAndrew Rist *************************************************************/ 21*25ea7f45SAndrew Rist 22*25ea7f45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_canvas.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <canvas/rendering/isurfaceproxymanager.hxx> 28cdf0e10cSrcweir #include <canvas/rendering/isurfaceproxy.hxx> 29cdf0e10cSrcweir #include "surfaceproxy.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir namespace canvas 32cdf0e10cSrcweir { 33cdf0e10cSrcweir 34cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////// 35cdf0e10cSrcweir // SurfaceProxyManager 36cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////// 37cdf0e10cSrcweir 38cdf0e10cSrcweir class SurfaceProxyManager : public ISurfaceProxyManager 39cdf0e10cSrcweir { 40cdf0e10cSrcweir public: 41cdf0e10cSrcweir SurfaceProxyManager(const IRenderModuleSharedPtr pRenderModule)42cdf0e10cSrcweir SurfaceProxyManager( const IRenderModuleSharedPtr pRenderModule ) : 43cdf0e10cSrcweir mpPageManager( new PageManager(pRenderModule) ) 44cdf0e10cSrcweir { 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir /** the whole idea is build around the concept that you create 48cdf0e10cSrcweir some arbitrary buffer which contains the image data and 49cdf0e10cSrcweir tell the texture manager about it. from there on you can 50cdf0e10cSrcweir draw this image using any kind of graphics api you want. 51cdf0e10cSrcweir in the technical sense we allocate some space in local 52cdf0e10cSrcweir videomemory or AGP memory which will be filled on demand, 53cdf0e10cSrcweir which means if there exists any rendering operation that 54cdf0e10cSrcweir needs to read from this memory location. this method 55cdf0e10cSrcweir creates a logical hardware surface object which uses the 56cdf0e10cSrcweir given color buffer as the image source. internally this 57cdf0e10cSrcweir texture may be distributed to several real hardware 58cdf0e10cSrcweir surfaces. 59cdf0e10cSrcweir */ createSurfaceProxy(const IColorBufferSharedPtr & pBuffer) const60cdf0e10cSrcweir virtual ISurfaceProxySharedPtr createSurfaceProxy( const IColorBufferSharedPtr& pBuffer ) const 61cdf0e10cSrcweir { 62cdf0e10cSrcweir // not much to do for now, simply allocate a new surface 63cdf0e10cSrcweir // proxy from our internal pool and initialize this thing 64cdf0e10cSrcweir // properly. we *don't* create a hardware surface for now. 65cdf0e10cSrcweir return SurfaceProxySharedPtr(new SurfaceProxy(pBuffer,mpPageManager)); 66cdf0e10cSrcweir } 67cdf0e10cSrcweir 68cdf0e10cSrcweir private: 69cdf0e10cSrcweir PageManagerSharedPtr mpPageManager; 70cdf0e10cSrcweir }; 71cdf0e10cSrcweir 72cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////// 73cdf0e10cSrcweir // createSurfaceProxyManager 74cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////// 75cdf0e10cSrcweir createSurfaceProxyManager(const IRenderModuleSharedPtr & rRenderModule)76cdf0e10cSrcweir ISurfaceProxyManagerSharedPtr createSurfaceProxyManager( const IRenderModuleSharedPtr& rRenderModule ) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir return ISurfaceProxyManagerSharedPtr( 79cdf0e10cSrcweir new SurfaceProxyManager( 80cdf0e10cSrcweir rRenderModule)); 81cdf0e10cSrcweir } 82cdf0e10cSrcweir } 83