Thread Previous • Date Previous • Date Next • Thread Next |
common/drawpanel_gal.cpp:119 (onPaint()) - OnPaint event handlercommon/view/view.cpp:766 (Redraw()) - Chooses the area that has to be redrawn common/view/view.cpp:591 (redrawRect()) - Iterates through layers sorted by their renderingOrder and checks if a layer should be redrawn. If it is the case, then there is a visitor (drawItem) that collects VIEW_ITEMs from R-Tree associated with the given layer and then performs actual drawing. If a VIEW_ITEM was cached - then it simply redraws a group, otherwise it creates a group and caches it. Groups are handled by rendering backends and are identified only by their number (think of it as a handle) and there is a 1-to-1 relation between group id and VIEW_ITEM/layer combination.
On 11/01/2013 05:06 PM, Lorenzo Marcantonio wrote:
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...)
The draw() routine you are asking about is only used when drawing a VIEW_GROUP object. Its purpose is to hold a bunch of VIEW_ITEMs together (do not mix it with group identifiers used by rendering backends). Probably I should find another name for that to avoid confusion. VIEW_GROUPs are particularly useful when drawing on the overlay layer (destined for drawing temporary objects) and in that case you may need to draw a single item layer by layer rather than drawing layer by layer, but using all items. For usual drawing of items, you should have a look at draw():607 - this is where caching VIEW_ITEMs/redrawing groups happen.
Regards, Orson
Thread Previous • Date Previous • Date Next • Thread Next |