KiCad PCB EDA Suite
vertex_item.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 (C) 2013 CERN
5  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Maciej Suminski <maciej.suminski@cern.ch>
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 
32 #ifndef VERTEX_ITEM_H_
33 #define VERTEX_ITEM_H_
34 
36 #include <gal/color4d.h>
37 #include <cstddef>
38 
39 namespace KIGFX
40 {
41 class VERTEX_MANAGER;
42 
44 {
45 public:
46  friend class CACHED_CONTAINER;
47  friend class CACHED_CONTAINER_GPU;
48  friend class VERTEX_MANAGER;
49 
50  explicit VERTEX_ITEM( const VERTEX_MANAGER& aManager );
51  virtual ~VERTEX_ITEM();
52 
58  inline unsigned int GetSize() const
59  {
60  return m_size;
61  }
62 
68  inline unsigned int GetOffset() const
69  {
70  return m_offset;
71  }
72 
76  VERTEX* GetVertices() const;
77 
78 private:
84  inline void setOffset( unsigned int aOffset )
85  {
86  m_offset = aOffset;
87  }
88 
94  inline void setSize( unsigned int aSize )
95  {
96  m_size = aSize;
97  }
98 
100  unsigned int m_offset;
101  unsigned int m_size;
102 };
103 } // namespace KIGFX
104 
105 #endif /* VERTEX_ITEM_H_ */
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:191
unsigned int m_size
Definition: vertex_item.h:101
VERTEX_ITEM(const VERTEX_MANAGER &aManager)
Definition: vertex_item.cpp:38
unsigned int GetSize() const
Return information about number of vertices stored.
Definition: vertex_item.h:58
const VERTEX_MANAGER & m_manager
Definition: vertex_item.h:99
void setSize(unsigned int aSize)
Set data size in the container.
Definition: vertex_item.h:94
Class to store VERTEX instances with caching.
virtual ~VERTEX_ITEM()
Definition: vertex_item.cpp:48
VERTEX * GetVertices() const
Return pointer to the data used by the VERTEX_ITEM.
Definition: vertex_item.cpp:54
void setOffset(unsigned int aOffset)
Set data offset in the container.
Definition: vertex_item.h:84
Specialization of CACHED_CONTAINER that stores data in video memory via memory mapping.
unsigned int m_offset
Definition: vertex_item.h:100
Common defines and consts used in vertex related classes.
unsigned int GetOffset() const
Return data offset in the container.
Definition: vertex_item.h:68
Class to control vertex container and GPU with possibility of emulating old-style OpenGL 1....