diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2018-04-03 10:21:15 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2018-04-03 10:21:15 +0000 |
| commit | 715b5f5b45e6bb81651ecc4e5cffdd0d7b484f5a (patch) | |
| tree | a9ff806045b2ae5c2012797fbd444c4bd6a003e9 /src | |
| parent | Add new directory for 'manipulations' with README. (diff) | |
| download | inkscape-715b5f5b45e6bb81651ecc4e5cffdd0d7b484f5a.tar.gz inkscape-715b5f5b45e6bb81651ecc4e5cffdd0d7b484f5a.zip | |
Code cleanup: remove unneeded file.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/color-rgba.h | 17 | ||||
| -rw-r--r-- | src/decimal-round.h | 41 |
3 files changed, 7 insertions, 52 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 44f64c56c..5db3faed4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -120,7 +120,6 @@ set(inkscape_SRC conn-avoid-ref.h console-output-undo-observer.h context-fns.h - decimal-round.h desktop-events.h desktop-style.h desktop.h diff --git a/src/color-rgba.h b/src/color-rgba.h index 55cf68877..b5db486f7 100644 --- a/src/color-rgba.h +++ b/src/color-rgba.h @@ -10,8 +10,7 @@ #define SEEN_COLOR_RGBA_H #include <cassert> -#include "decimal-round.h" -typedef unsigned int guint32; +#include <cmath> /** * A class to contain a floating point RGBA color as one unit. @@ -47,12 +46,9 @@ public: * A constructor to create the color from an unsigned int, as found everywhere when dealing with colors. * * Separate the values and load them into the array of floats in this object. - * TODO : maybe get rid of the NR_RGBA32_x C-style functions and replace - * the calls with the bitshifting they do - * * @param intcolor rgba32 "unsigned int representation (0xRRGGBBAA) */ - ColorRGBA(guint32 intcolor) + ColorRGBA(unsigned int intcolor) { _c[0] = ((intcolor & 0xff000000) >> 24) / 255.0; _c[1] = ((intcolor & 0x00ff0000) >> 16) / 255.0; @@ -151,10 +147,11 @@ public: */ unsigned int getIntValue() const { - return (int(Inkscape::decimal_round(_c[0]*255, 0)) << 24) | - (int(Inkscape::decimal_round(_c[1]*255, 0)) << 16) | - (int(Inkscape::decimal_round(_c[2]*255, 0)) << 8) | - (int(Inkscape::decimal_round(_c[3]*255, 0))); + return + (int(round(_c[0]*255)) << 24) | + (int(round(_c[1]*255)) << 16) | + (int(round(_c[2]*255)) << 8) | + (int(round(_c[3]*255))); } private: diff --git a/src/decimal-round.h b/src/decimal-round.h deleted file mode 100644 index b90958cae..000000000 --- a/src/decimal-round.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef SEEN_DECIMAL_ROUND_H -#define SEEN_DECIMAL_ROUND_H - -#include <cmath> - -namespace Inkscape { - -/** Returns x rounded to the nearest \a nplaces decimal places. - - Implemented in terms of std::round, i.e. we make no guarantees as to what happens if x is - half way between two rounded numbers. Add a note to the documentation if you care which - candidate is chosen for such case (round towards -infinity, +infinity, 0, or "even"). - - Note: nplaces is the number of decimal places without using scientific (e) notation, not the - number of significant figures. This function may not be suitable for values of x whose - magnitude is so far from 1 that one would want to use scientific (e) notation. - - The current implementation happens to allow nplaces to be negative: e.g. nplaces=-2 means - rounding to a multiple of 100. May or may not be useful. -**/ -inline double -decimal_round(double const x, int const nplaces) -{ - double const multiplier = std::pow(10.0, nplaces); - return round( x * multiplier ) / multiplier; -} - -} - -#endif /* !SEEN_DECIMAL_ROUND_H */ - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : |
