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 #ifndef INCLUDED_CANVAS_PAGEMANAGER_HXX 25 #define INCLUDED_CANVAS_PAGEMANAGER_HXX 26 27 #include <basegfx/vector/b2isize.hxx> 28 #include <canvas/rendering/irendermodule.hxx> 29 #include <canvas/rendering/isurface.hxx> 30 31 #include "page.hxx" 32 33 namespace canvas 34 { 35 36 ////////////////////////////////////////////////////////////////////////////////// 37 // PageManager 38 ////////////////////////////////////////////////////////////////////////////////// 39 40 class PageManager 41 { 42 public: PageManager(const canvas::IRenderModuleSharedPtr pRenderModule)43 PageManager( const canvas::IRenderModuleSharedPtr pRenderModule ) : 44 mpRenderModule(pRenderModule) 45 { 46 } 47 48 // returns the maximum size of a hardware 49 // accelerated page, e.g. OpenGL texture. 50 ::basegfx::B2ISize getPageSize() const; 51 52 canvas::IRenderModuleSharedPtr getRenderModule() const; 53 54 FragmentSharedPtr allocateSpace( const ::basegfx::B2ISize& rSize ); 55 void free( const FragmentSharedPtr& pFragment ); 56 57 void nakedFragment( const FragmentSharedPtr& pFragment ); 58 59 void validatePages(); 60 61 private: 62 // the pagemanager needs access to the rendermodule 63 // since we query for system resources from it. 64 canvas::IRenderModuleSharedPtr mpRenderModule; 65 66 // here we collect all fragments that will be created 67 // since we need them for relocation purposes. 68 typedef std::list<FragmentSharedPtr> FragmentContainer_t; 69 FragmentContainer_t maFragments; 70 71 // this is the container holding all created pages, 72 // behind the scenes these are real hardware surfaces. 73 typedef std::list<PageSharedPtr> PageContainer_t; 74 PageContainer_t maPages; 75 76 bool relocate( const FragmentSharedPtr& pFragment ); 77 }; 78 79 ////////////////////////////////////////////////////////////////////////////////// 80 // PageManagerSharedPtr 81 ////////////////////////////////////////////////////////////////////////////////// 82 83 typedef ::boost::shared_ptr< PageManager > PageManagerSharedPtr; 84 85 ////////////////////////////////////////////////////////////////////////////////// 86 // End of file 87 ////////////////////////////////////////////////////////////////////////////////// 88 } 89 90 #endif 91