view_layers: Initialize variables

Fixes a couple spots where uninitialized variables cause unknown results.
This commit is contained in:
Seth Hillbrand 2018-10-10 20:14:47 -07:00
parent bfa7f16b44
commit a16e21665a
1 changed files with 8 additions and 12 deletions

View File

@ -92,22 +92,17 @@ VIEW_ITEM *VIEW_GROUP::GetItem( unsigned int idx ) const
const BOX2I VIEW_GROUP::ViewBBox() const const BOX2I VIEW_GROUP::ViewBBox() const
{ {
BOX2I bb; BOX2I bb;
bool first;
if( !m_groupItems.size() ) if( !m_groupItems.size() )
{ {
bb.SetMaximum(); bb.SetMaximum();
} else { }
else
{
bb = m_groupItems[0]->ViewBBox();
for( auto item : m_groupItems ) for( auto item : m_groupItems )
{ bb.Merge( item->ViewBBox() );
if( first )
{
bb = item->ViewBBox();
first = false;
} else {
bb.Merge( item->ViewBBox() );
}
}
} }
return bb; return bb;
@ -141,7 +136,8 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
} }
} }
int layers[VIEW::VIEW_MAX_LAYERS], layers_count = 0; int layers[VIEW::VIEW_MAX_LAYERS] = { 0 };
int layers_count = 0;
for( const auto& entry : layer_item_map ) for( const auto& entry : layer_item_map )
{ {