Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
5a0869f2
Commit
5a0869f2
authored
Jul 08, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added 'required layers' option for drawn items.
parent
d51b8a87
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
4 deletions
+44
-4
view.cpp
common/view/view.cpp
+24
-4
view_item.cpp
common/view/view_item.cpp
+7
-0
view.h
include/view/view.h
+3
-0
view_item.h
include/view/view_item.h
+10
-0
No files found.
common/view/view.cpp
View file @
5a0869f2
...
...
@@ -454,13 +454,21 @@ struct VIEW::drawItem
{
GAL
*
gal
=
view
->
GetGAL
();
aItem
->
ViewGetRequiredLayers
(
layers
,
layersCount
);
// Conditions that have te be fulfilled for an item to be drawn
bool
drawCondition
=
aItem
->
ViewIsVisible
()
&&
aItem
->
ViewGetLOD
(
currentLayer
->
id
)
<
view
->
m_scale
&&
view
->
isEveryLayerEnabled
(
layers
,
layersCount
);
if
(
!
drawCondition
)
return
;
if
(
currentLayer
->
cached
)
{
// Draw using cached information or create one
int
group
=
aItem
->
getGroup
(
currentLayer
->
id
);
if
(
group
>=
0
&&
aItem
->
ViewIsVisible
()
&&
aItem
->
ViewGetLOD
(
currentLayer
->
id
)
<
view
->
m_scale
)
if
(
group
>=
0
)
{
gal
->
DrawGroup
(
group
);
}
...
...
@@ -472,8 +480,7 @@ struct VIEW::drawItem
gal
->
EndGroup
();
}
}
else
if
(
aItem
->
ViewIsVisible
()
&&
aItem
->
ViewGetLOD
(
currentLayer
->
id
)
<
view
->
m_scale
)
else
{
// Immediate mode
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
);
...
...
@@ -482,6 +489,7 @@ struct VIEW::drawItem
const
VIEW_LAYER
*
currentLayer
;
VIEW
*
view
;
int
layersCount
,
layers
[
VIEW_MAX_LAYERS
];
};
...
...
@@ -652,6 +660,18 @@ void VIEW::clearGroupCache()
}
bool
VIEW
::
isEveryLayerEnabled
(
const
int
aLayers
[],
int
aCount
)
const
{
for
(
int
i
=
0
;
i
<
aCount
;
++
i
)
{
if
(
!
m_layers
.
at
(
aLayers
[
i
]
).
enabled
)
return
false
;
}
return
true
;
}
void
VIEW
::
RecacheAllItems
(
bool
aImmediately
)
{
BOX2I
r
;
...
...
common/view/view_item.cpp
View file @
5a0869f2
...
...
@@ -48,6 +48,13 @@ void VIEW_ITEM::ViewSetVisible( bool aIsVisible )
}
void
VIEW_ITEM
::
ViewGetRequiredLayers
(
int
aLayers
[],
int
&
aCount
)
const
{
// By default there is no layer required
aCount
=
0
;
}
void
VIEW_ITEM
::
ViewUpdate
(
int
aUpdateFlags
,
bool
aForceImmediateRedraw
)
{
m_view
->
invalidateItem
(
this
,
aUpdateFlags
);
...
...
include/view/view.h
View file @
5a0869f2
...
...
@@ -403,6 +403,9 @@ private:
return
i
->
renderingOrder
>
j
->
renderingOrder
;
}
/// Checks if every layer stored in aLayers array is enabled.
bool
isEveryLayerEnabled
(
const
int
aLayers
[],
int
aCount
)
const
;
/// Contains set of possible displayed layers and its properties
LayerMap
m_layers
;
...
...
include/view/view_item.h
View file @
5a0869f2
...
...
@@ -207,6 +207,16 @@ public:
*/
virtual
void
ViewGetLayers
(
int
aLayers
[],
int
&
aCount
)
const
=
0
;
/**
* Function ViewGetRequiredLayers()
* Returns the all the layers that are required for an item to be drawn. Eg. there is no point
* to draw netnames, when the track is not visible - so track layer should be marked as
* required.
* @param aLayers[]: output layer index array
* @param aCount: number of layer indices in aLayers[]
*/
virtual
void
ViewGetRequiredLayers
(
int
aLayers
[],
int
&
aCount
)
const
;
/**
* Function ViewSetVisible()
* Sets the item visibility.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment