← Back to team overview

kicad-developers team mailing list archive

Drawing loop in VIEW::draw

 

Another thing that's not clear to me in the GAL mechanism. 
VIEW::draw, if I got correctly the algorithm should go like this:

- Ask the view for the needed GAL_LAYER_NUMs
- Depth sort them for cairo (and probably for correct GL blending)
- For each layer in sorted order
  - Set the Z depth
  - Draw the object in question

My question is this: the m_layers member is a set which is most probably
accessed by GAL_LAYER_NUM (example: VIEW::SetLayerVisible); the members
of the set are of the internal VIEW::VIEW_LAYER struct type (which
contains obviously useful stuff).

However, the call 

m_gal->SetLayerDepth( m_layers.at( i ).renderingOrder );

uses as index (i.e. as a GAL_LAYER_NUM, if I got it right) the i index,
which is simply the progressive index in the sorted array of
GAL_LAYER_NUM to be drawn. Wouldn't that be:

m_gal->SetLayerDepth( m_layers.at( layers[i] ).renderingOrder );

(layers is the sorted draw order)

? Otherwise I can't guess how should it work (especially the type of
m_layers...)

-- 
Lorenzo Marcantonio
Logos Srl


Follow ups