Move setting of LD_LIBRARY_PATH closer to invocation of cppunittester
[LibreOffice.git] / canvas / source / tools / pagemanager.hxx
blob57de912a12ba2ab2bd39d2ebd0c66f293a1efb67
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <basegfx/vector/b2isize.hxx>
23 #include <rendering/irendermodule.hxx>
24 #include <utility>
26 #include "page.hxx"
28 namespace canvas
30 // PageManager
31 class PageManager
33 public:
34 explicit PageManager(std::shared_ptr<canvas::IRenderModule> xRenderModule)
35 : mpRenderModule(std::move(xRenderModule))
39 // returns the maximum size of a hardware
40 // accelerated page, e.g. OpenGL texture.
41 ::basegfx::B2ISize getPageSize() const;
43 const std::shared_ptr<canvas::IRenderModule>& getRenderModule() const { return mpRenderModule; }
45 FragmentSharedPtr allocateSpace( const ::basegfx::B2ISize& rSize );
46 void free( const FragmentSharedPtr& pFragment );
48 void nakedFragment( const FragmentSharedPtr& pFragment );
50 void validatePages();
52 private:
53 // the pagemanager needs access to the rendermodule
54 // since we query for system resources from it.
55 std::shared_ptr<canvas::IRenderModule> mpRenderModule;
57 // here we collect all fragments that will be created
58 // since we need them for relocation purposes.
59 typedef std::vector<FragmentSharedPtr> FragmentContainer_t;
60 FragmentContainer_t maFragments;
62 // this is the container holding all created pages,
63 // behind the scenes these are real hardware surfaces.
64 std::vector<PageSharedPtr> maPages;
66 bool relocate( const FragmentSharedPtr& pFragment );
70 // PageManagerSharedPtr
73 typedef std::shared_ptr< PageManager > PageManagerSharedPtr;
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */