LibreOffice Module canvas (master) 1
pagemanager.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
24#include <utility>
25
26#include "page.hxx"
27
28namespace canvas
29{
30 // PageManager
32 {
33 public:
34 explicit PageManager(std::shared_ptr<canvas::IRenderModule> xRenderModule)
35 : mpRenderModule(std::move(xRenderModule))
36 {
37 }
38
39 // returns the maximum size of a hardware
40 // accelerated page, e.g. OpenGL texture.
42
43 const std::shared_ptr<canvas::IRenderModule>& getRenderModule() const { return mpRenderModule; }
44
45 FragmentSharedPtr allocateSpace( const ::basegfx::B2ISize& rSize );
46 void free( const FragmentSharedPtr& pFragment );
47
48 void nakedFragment( const FragmentSharedPtr& pFragment );
49
50 void validatePages();
51
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;
56
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;
61
62 // this is the container holding all created pages,
63 // behind the scenes these are real hardware surfaces.
64 std::vector<PageSharedPtr> maPages;
65
66 bool relocate( const FragmentSharedPtr& pFragment );
67 };
68
69
70 // PageManagerSharedPtr
71
72
73 typedef std::shared_ptr< PageManager > PageManagerSharedPtr;
74}
75
76/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void nakedFragment(const FragmentSharedPtr &pFragment)
Definition: pagemanager.cxx:80
bool relocate(const FragmentSharedPtr &pFragment)
FragmentSharedPtr allocateSpace(const ::basegfx::B2ISize &rSize)
Definition: pagemanager.cxx:26
FragmentContainer_t maFragments
Definition: pagemanager.hxx:60
::basegfx::B2ISize getPageSize() const
std::vector< PageSharedPtr > maPages
Definition: pagemanager.hxx:64
const std::shared_ptr< canvas::IRenderModule > & getRenderModule() const
Definition: pagemanager.hxx:43
std::shared_ptr< canvas::IRenderModule > mpRenderModule
Definition: pagemanager.hxx:55
std::vector< FragmentSharedPtr > FragmentContainer_t
Definition: pagemanager.hxx:59
PageManager(std::shared_ptr< canvas::IRenderModule > xRenderModule)
Definition: pagemanager.hxx:34
void free(const FragmentSharedPtr &pFragment)
Definition: pagemanager.cxx:64
std::shared_ptr< PageFragment > FragmentSharedPtr
Definition: page.hxx:35
std::shared_ptr< PageManager > PageManagerSharedPtr
Definition: pagemanager.hxx:73