Commit 7d788109 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Merged upstream

parents 07a5774a ab36d235
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -459,11 +459,6 @@ add_custom_target( uninstall
# Installation
#================================================

add_custom_target( install_user_configuration_files
    "${CMAKE_COMMAND}" -E copy "${PROJECT_SOURCE_DIR}/template/fp-lib-table" ${KICAD_USER_CONFIG_DIR}/
    COMMENT "Install template fp-lib-table into your home directory."
    )

install( FILES INSTALL.txt
    DESTINATION ${KICAD_DOCS}
    COMPONENT resources )
@@ -534,10 +529,6 @@ if( UNIX AND NOT APPLE )
    #set( CPACK_PACKAGE_CONTACT Firstname Lastname <email@company.com> )
    set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "KiCad built by CMake build system." )

    # Tell debian CPack about all files which are configuration files
    add_conffiles()         # clear file
    add_conffiles( ${KICAD_USER_CONFIG_DIR}/fp-lib-table )  # append to it

    include( CPack )

endif()
+3 −2
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
 * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
@@ -201,9 +202,9 @@ void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList,
    {
        wxASSERT( (int) itemList[row].GetCount() == m_listBox->GetColumnCount() );

        long itemIndex = 0;
        for( unsigned col = 0; col < itemList[row].GetCount(); col++ )
        {
            long itemIndex = 0;

            if( col == 0 )
            {
+49 −36
Original line number Diff line number Diff line
@@ -265,8 +265,38 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
{
    if( m_MultilineAllowed )
    {
        std::vector<wxPoint> positions;
        wxArrayString* list = wxStringSplit( m_Text, '\n' );
        positions.reserve( list->Count() );

        GetPositionsOfLinesOfMultilineText(positions, list->Count() );

        for( unsigned ii = 0; ii < list->Count(); ii++ )
        {
            wxString& txt = list->Item( ii );
            drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
                               aDrawMode, aFillMode, txt, positions[ii] );
        }

        delete (list);
    }
    else
        drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
                           aDrawMode, aFillMode, m_Text, m_Pos );

    // Draw text anchor, if requested
    if( aAnchor_color != UNSPECIFIED_COLOR )
    {
        GRDrawAnchor( aClipBox, aDC,
                      m_Pos.x + aOffset.x, m_Pos.y + aOffset.y,
                      DIM_ANCRE_TEXTE, aAnchor_color );
    }
}


void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
        std::vector<wxPoint>& aPositions, int aLineCount )
{
    wxPoint        pos  = m_Pos;  // Position of first line of the
                                  // multiline text according to
                                  // the center of the multiline text block
@@ -276,7 +306,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
    offset.y = GetInterline();

#ifdef FIX_MULTILINE_VERT_JUSTIF
        if( list->Count() > 1 )
    if( aLineCount > 1 )
    {
        switch( m_VJustify )
        {
@@ -284,11 +314,11 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
            break;

        case GR_TEXT_VJUSTIFY_CENTER:
                pos.y -= ( list->Count() - 1 ) * offset.y / 2;
            pos.y -= ( aLineCount - 1 ) * offset.y / 2;
            break;

        case GR_TEXT_VJUSTIFY_BOTTOM:
                pos.y -= ( list->Count() - 1 ) * offset.y;
            pos.y -= ( aLineCount - 1 ) * offset.y;
            break;
        }
    }
@@ -300,29 +330,12 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
    // Rotate the offset lines to increase happened in the right direction
    RotatePoint( &offset, m_Orient );

        for( unsigned i = 0; i<list->Count(); i++ )
    for( int ii = 0; ii < aLineCount; ii++ )
    {
            wxString txt = list->Item( i );
            drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
                               aDrawMode, aFillMode, txt, pos );
        aPositions.push_back( pos );
        pos += offset;
    }

        delete (list);
}
    else
        drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
                           aDrawMode, aFillMode, m_Text, m_Pos );

    // Draw text anchor, if requested
    if( aAnchor_color != UNSPECIFIED_COLOR )
    {
        GRDrawAnchor( aClipBox, aDC,
                      m_Pos.x + aOffset.x, m_Pos.y + aOffset.y,
                      DIM_ANCRE_TEXTE, aAnchor_color );
    }
}


void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
                                  const wxPoint& aOffset, EDA_COLOR_T aColor,
+2 −3
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ void GPU_CACHED_MANAGER::uploadToGpu()
{
#ifdef __WXDEBUG__
    prof_counter totalTime;
    prof_start( &totalTime, false );
    prof_start( &totalTime );
#endif /* __WXDEBUG__ */

    if( !m_buffersInitialized )
@@ -214,8 +214,7 @@ void GPU_CACHED_MANAGER::uploadToGpu()
#ifdef __WXDEBUG__
    prof_end( &totalTime );

    wxLogDebug( wxT( "Uploading %d vertices to GPU / %.1f ms" ),
                bufferSize, (double) totalTime.value / 1000.0 );
    wxLogDebug( wxT( "Uploading %d vertices to GPU / %.1f ms" ), bufferSize, totalTime.msecs() );
#endif /* __WXDEBUG__ */
}

common/profile.h

deleted100644 → 0
+0 −147
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2013 CERN
 * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

/**
 * @file profile.h:
 * @brief Simple profiling functions for measuring code execution time.
 */

#ifndef __TPROFILE_H
#define __TPROFILE_H

#include <sys/time.h>
#include <stdint.h>

/**
 * Function rdtsc
 * Returns processor's time-stamp counter. Main purpose is precise time measuring of code
 * execution time.
 * @return unsigned long long - Value of time-stamp counter.
 */
#if defined(__i386__)
static __inline__ unsigned long long rdtsc()
{
    unsigned long long int x;
    __asm__ volatile ( ".byte 0x0f, 0x31" : "=A" ( x ) );

    return x;
}


#elif defined(__x86_64__)
static __inline__ unsigned long long rdtsc()
{
    unsigned hi, lo;
    __asm__ __volatile__ ( "rdtsc" : "=a" ( lo ), "=d" ( hi ) );

    return ( (unsigned long long) lo ) | ( ( (unsigned long long) hi ) << 32 );
}


#elif defined(__powerpc__)
static __inline__ unsigned long long rdtsc()
{
    unsigned long long int  result = 0;
    unsigned long int       upper, lower, tmp;
    __asm__ volatile (
        "0:                  \n"
        "\tmftbu   %0           \n"
        "\tmftb    %1           \n"
        "\tmftbu   %2           \n"
        "\tcmpw    %2,%0        \n"
        "\tbne     0b         \n"
        : "=r" ( upper ), "=r" ( lower ), "=r" ( tmp )
        );

    result  = upper;
    result  = result << 32;
    result  = result | lower;

    return result;
}


#endif /* __powerpc__ */

// Fixme: OS X version
/**
 * Function get_tics
 * Returns the number of microseconds that have elapsed since the system was started.
 * @return uint64_t Number of microseconds.
 */
static inline uint64_t get_tics()
{
    struct timeval tv;
    gettimeofday( &tv, NULL );

    return (uint64_t) tv.tv_sec * 1000000ULL + (uint64_t) tv.tv_usec;
}


/**
 * Structure for storing data related to profiling counters.
 */
struct prof_counter
{
    uint64_t    value;          /// Stored timer value
    bool        use_rdtsc;      /// Method of time measuring (rdtsc or tics)
};

/**
 * Function prof_start
 * Begins code execution time counting for a given profiling counter.
 * @param cnt is the counter which should be started.
 * @param use_rdtsc tells if processor's time-stamp counter should be used for time counting.
 *      Otherwise is system tics method will be used. IMPORTANT: time-stamp counter should not
 *      be used on multicore machines executing threaded code.
 */
static inline void prof_start( prof_counter* cnt, bool use_rdtsc )
{
    cnt->use_rdtsc = use_rdtsc;

    if( use_rdtsc )
    {
        cnt->value = rdtsc();
    }
    else
    {
        cnt->value = get_tics();
    }
}


/**
 * Function prof_stop
 * Ends code execution time counting for a given profiling counter.
 * @param cnt is the counter which should be stopped.
 */
static inline void prof_end( prof_counter* cnt )
{
    if( cnt->use_rdtsc )
        cnt->value = rdtsc() - cnt->value;
    else
        cnt->value = get_tics() - cnt->value;
}

#endif
Loading