本文整理汇总了C++中kigfx::GAL::PushDepth方法的典型用法代码示例。如果您正苦于以下问题:C++ GAL::PushDepth方法的具体用法?C++ GAL::PushDepth怎么用?C++ GAL::PushDepth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kigfx::GAL
的用法示例。
在下文中一共展示了GAL::PushDepth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ViewDraw
void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
{
KIGFX::GAL* gal = aView->GetGAL();
PAINTER* painter = aView->GetPainter();
bool isSelection = m_layer == LAYER_SELECT_OVERLAY;
const auto drawList = updateDrawList();
std::unordered_map<int, std::vector<VIEW_ITEM*>> layer_item_map;
// Build a list of layers used by the items in the group
for( auto item : drawList )
{
int item_layers[VIEW::VIEW_MAX_LAYERS], item_layers_count;
item->ViewGetLayers( item_layers, item_layers_count );
for( int i = 0; i < item_layers_count; i++ )
{
if( layer_item_map.count( item_layers[i] ) == 0 )
{
layer_item_map.emplace( std::make_pair( item_layers[i],
std::vector<VIEW_ITEM*>() ) );
}
layer_item_map[ item_layers[i] ].push_back( item );
}
}
int layers[VIEW::VIEW_MAX_LAYERS] = { 0 };
int layers_count = 0;
for( const auto& entry : layer_item_map )
{
layers[ layers_count++ ] = entry.first;
}
aView->SortLayers( layers, layers_count );
// Now draw the layers in sorted order
gal->PushDepth();
for( int i = 0; i < layers_count; i++ )
{
int layer = layers[i];
bool draw = aView->IsLayerVisible( layer );
if( isSelection )
{
switch( layer )
{
case LAYER_PADS_TH:
case LAYER_PADS_PLATEDHOLES:
case LAYER_PAD_FR:
case LAYER_PAD_BK:
draw = true;
break;
default:
break;
}
}
if( draw )
{
gal->AdvanceDepth();
for( auto item : layer_item_map[ layers[i] ] )
{
if( !painter->Draw( item, layers[i] ) )
item->ViewDraw( layers[i], aView ); // Alternative drawing method
}
}
}
gal->PopDepth();
}