Changeset 1130 for cpp/frams/canvas


Ignore:
Timestamp:
04/16/21 15:55:34 (4 years ago)
Author:
Maciej Komosinski
Message:

Used std::min(), std::max() explicitly to avoid compiler confusion. Used std::size() explicitly instead of the equivalent macro

Location:
cpp/frams/canvas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/canvas/neurodiagram.cpp

    r973 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1313#include <frams/simul/simul.h>
    1414#include "common/nonstd_time.h"
     15#include <algorithm>
    1516
    1617#define FIELDSTRUCT NeuroDiagram
     
    231232        NeuroProbe *probe = new NeuroProbe(getNS(i));
    232233        Pixel s = getSize();
    233         s.x = s.y = max(probe->getSize().x, min(s.x / 3, s.y / 3));
     234        s.x = s.y = std::max(probe->getSize().x, std::min(s.x / 3, s.y / 3));
    234235        probes += (void*)probe;
    235236        add(probe);
     
    503504                                int *dr = drawing;
    504505                                int w = size.x - 2, h = size.y - clienttop - clientbottom;
    505                                 int scale = min(w, h);
     506                                int scale = std::min(w, h);
    506507                                int x0 = clienttop + leftborder + ((w > h) ? (w - h) / 2 : 0);
    507508                                int y0 = clientleft + topborder + ((h > w) ? (h - w) / 2 : 0);
  • cpp/frams/canvas/nn_smart_layout.cpp

    r492 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "nn_layout.h"
    66#include <vector>
    7 #include "common/nonstd_stl.h"
     7#include <algorithm>
    88#ifdef __BORLANDC__
    99 #include <alloc.h> //borland needs for alloc/free
     
    131131           */
    132132        int x1, y1, x2, y2; // union rectangle
    133         x1 = max(0, b2->minx - b->minx + dx);
    134         x2 = min(b->maxx - b->minx, -b->minx + dx + b2->maxx);
     133        x1 = std::max(0, b2->minx - b->minx + dx);
     134        x2 = std::min(b->maxx - b->minx, -b->minx + dx + b2->maxx);
    135135        if (x1 > x2) return 1;
    136         y1 = max(0, b2->miny - b->miny + dy);
    137         y2 = min(b->maxy - b->miny, -b->miny + dy + b2->maxy);
     136        y1 = std::max(0, b2->miny - b->miny + dy);
     137        y2 = std::min(b->maxy - b->miny, -b->miny + dy + b2->maxy);
    138138        if (y1 > y2) return 1;
    139139        int x, y;
     
    162162                b->dodajelement(e, einfo[e].x + dx, einfo[e].y + dy);
    163163        }
    164         b->minx = min(b->minx, dx + b2->minx);
    165         b->miny = min(b->miny, dy + b2->miny);
    166         b->maxx = max(b->maxx, dx + b2->maxx);
    167         b->maxy = max(b->maxy, dy + b2->maxy);
     164        b->minx = std::min(b->minx, dx + b2->minx);
     165        b->miny = std::min(b->miny, dy + b2->miny);
     166        b->maxx = std::max(b->maxx, dx + b2->maxx);
     167        b->maxy = std::max(b->maxy, dy + b2->maxy);
    168168
    169169        DB(
Note: See TracChangeset for help on using the changeset viewer.