KiCad PCB EDA Suite
cached_container_ram.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright 2013-2017 CERN
5 * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef CACHED_CONTAINER_RAM_H_
28#define CACHED_CONTAINER_RAM_H_
29
31#include <map>
32#include <set>
33
34namespace KIGFX
35{
36class VERTEX_ITEM;
37class SHADER;
38
46{
47public:
48 CACHED_CONTAINER_RAM( unsigned int aSize = DEFAULT_SIZE );
50
52 void Map() override {}
53
55 void Unmap() override;
56
57 bool IsMapped() const override
58 {
59 return true;
60 }
61
67 unsigned int GetBufferHandle() const override
68 {
69 return m_verticesBuffer; // make common with CACHED_CONTAINER_RAM
70 }
71
72protected:
79 bool defragmentResize( unsigned int aNewSize ) override;
80
83};
84} // namespace KIGFX
85
86#endif /* CACHED_CONTAINER_RAM_H_ */
Specialization of CACHED_CONTAINER that stores data in RAM.
~CACHED_CONTAINER_RAM()
Finish the vertices updates stage.
bool IsMapped() const override
Return true if vertex buffer is currently mapped.
void Map() override
Finish the vertices updates stage.
void Unmap() override
Finish the vertices updates stage.
bool defragmentResize(unsigned int aNewSize) override
Defragment the currently stored data and resizes the buffer.
unsigned int GetBufferHandle() const override
Return handle to the vertex buffer.
CACHED_CONTAINER_RAM(unsigned int aSize=DEFAULT_SIZE)
Class to store VERTEX instances with caching.
static constexpr unsigned int DEFAULT_SIZE
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:243