diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index e8e1523f03..6a5d56e6a0 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -1251,6 +1251,7 @@ CAIRO_GAL::CAIRO_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent, m_mainBuffer = 0; m_overlayBuffer = 0; m_tempBuffer = 0; + m_savedBuffer = 0; m_validCompositor = false; SetTarget( TARGET_NONCACHED ); @@ -1324,7 +1325,6 @@ void CAIRO_GAL::endDrawing() // Now translate the raw context data from the format stored // by cairo into a format understood by wxImage. - pixman_image_t* dstImg = pixman_image_create_bits( wxPlatformInfo::Get().GetEndianness() == wxENDIAN_LITTLE ? PIXMAN_b8g8r8 : PIXMAN_r8g8b8, @@ -1644,7 +1644,6 @@ void CAIRO_GAL_BASE::DrawGrid() int gridEndY = KiROUND( ( worldEndPoint.y - m_gridOrigin.y ) / gridScreenSize.y ); // Ensure start coordinate > end coordinate - SWAP( gridStartX, >, gridEndX ); SWAP( gridStartY, >, gridEndY ); @@ -1691,6 +1690,7 @@ void CAIRO_GAL_BASE::DrawGrid() { m_lineWidthIsOdd = true; m_isStrokeEnabled = true; + for( int j = gridStartY; j <= gridEndY; j++ ) { bool tickY = ( j % m_gridTick == 0 ); diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 57c1b9a326..4feb7b2c55 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -435,9 +435,9 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem } } - if( zoneTree->QueryColliding( itemBBox, itemShape.get(), aLayer, - std::max( 0, clearance - m_drcEpsilon ), - &actual, &pos ) ) + if( zoneTree && zoneTree->QueryColliding( itemBBox, itemShape.get(), aLayer, + std::max( 0, clearance - m_drcEpsilon ), + &actual, &pos ) ) { std::shared_ptr drce = DRC_ITEM::Create( DRCE_CLEARANCE ); @@ -480,9 +480,9 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aItem aLayer ); clearance = constraint.GetValue().Min(); - if( zoneTree->QueryColliding( itemBBox, holeShape.get(), aLayer, - std::max( 0, clearance - m_drcEpsilon ), - &actual, &pos ) ) + if( zoneTree && zoneTree->QueryColliding( itemBBox, holeShape.get(), aLayer, + std::max( 0, clearance - m_drcEpsilon ), + &actual, &pos ) ) { std::shared_ptr drce = DRC_ITEM::Create( DRCE_HOLE_CLEARANCE ); @@ -740,8 +740,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa otherShape.reset( new SHAPE_SEGMENT( pos, pos, otherVia->GetDrill() ) ); if( clearance > 0 && padShape->Collide( otherShape.get(), - std::max( 0, clearance - m_drcEpsilon ), - &actual, &pos ) ) + std::max( 0, clearance - m_drcEpsilon ), + &actual, &pos ) ) { std::shared_ptr drce = DRC_ITEM::Create( DRCE_HOLE_CLEARANCE ); @@ -874,7 +874,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones() continue; // Test for same net - if( zoneRef->GetNetCode() == zoneToTest->GetNetCode() && zoneRef->GetNetCode() >= 0 ) + if( zoneRef->GetNetCode() == zoneToTest->GetNetCode() + && zoneRef->GetNetCode() >= 0 ) continue; // test for different priorities diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 8b363e090f..ce1075e45e 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -995,7 +995,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer ) textpos.y = -textpos.y; // approximate the size of the pad number text: - double tsize = 1.5 * padsize.x / PrintableCharCount( padNumber ); + double tsize = 1.5 * padsize.x / std::max( PrintableCharCount( padNumber ), 1 ); tsize = std::min( tsize, size ); // Use a smaller text size to handle interline, pen size...