summaryrefslogtreecommitdiff
path: root/dviware/dvisvgm/src/Bitmap.cpp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-29 03:00:39 +0000
committerNorbert Preining <norbert@preining.info>2019-10-29 03:00:39 +0000
commit97f5151099967e6c823d640a90d87bca92c44035 (patch)
tree685caa49488599f87d0caa4e972833b2263d8567 /dviware/dvisvgm/src/Bitmap.cpp
parent25a647b97ef526aefcc75269dd19c46dbe3ae4c1 (diff)
CTAN sync 201910290300
Diffstat (limited to 'dviware/dvisvgm/src/Bitmap.cpp')
-rw-r--r--dviware/dvisvgm/src/Bitmap.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/dviware/dvisvgm/src/Bitmap.cpp b/dviware/dvisvgm/src/Bitmap.cpp
index e39ad79c47..3fa554eed4 100644
--- a/dviware/dvisvgm/src/Bitmap.cpp
+++ b/dviware/dvisvgm/src/Bitmap.cpp
@@ -25,10 +25,6 @@
using namespace std;
-Bitmap::Bitmap () : _rows(0), _cols(0), _xshift(0), _yshift(0), _bpr(0), _bytes(0)
-{
-}
-
/** Constructs a Bitmap */
Bitmap::Bitmap (int minx, int maxx, int miny , int maxy) {
@@ -48,8 +44,7 @@ void Bitmap::resize (int minx, int maxx, int miny , int maxy) {
_yshift = miny;
_bpr = _cols/8 + (_cols % 8 ? 1 : 0); // bytes per row
_bytes.resize(_rows*_bpr);
- for (uint8_t &byte : _bytes)
- byte = 0;
+ std::fill(_bytes.begin(), _bytes.end(), 0);
}
@@ -69,7 +64,7 @@ void Bitmap::setBits (int row, int col, int n) {
int m = min(n, b+1); // number of bits to be set in current byte
int bitseq = (1 << m)-1; // sequence of n set bits (bits 0..n-1 are set)
bitseq <<= b-m+1; // move bit sequence so that bit b is the leftmost set bit
- *byte |= uint8_t(bitseq); // apply bit sequence to current byte
+ *byte |= uint8_t(bitseq); // apply bit sequence to current byte
byte++;
n -= m;
col += m;
@@ -90,10 +85,8 @@ void Bitmap::forAllPixels (Callback &data) const {
}
-class BBoxCallback : public Bitmap::Callback
-{
+class BBoxCallback : public Bitmap::Callback {
public:
- BBoxCallback () : _changed(false), _minx(numeric_limits<int>::max()), _miny(_minx), _maxx(0), _maxy(0) {}
int minx () const {return _minx;}
int miny () const {return _miny;}
int maxx () const {return _maxx;}
@@ -116,8 +109,9 @@ class BBoxCallback : public Bitmap::Callback
}
private:
- bool _changed;
- int _minx, _miny, _maxx, _maxy;
+ bool _changed = false;
+ int _minx = numeric_limits<int>::max(), _miny=_minx;
+ int _maxx = 0, _maxy = 0;
};