summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2015-01-27 10:23:26 +0100
committerSebastian Geerken <devnull@localhost>2015-01-27 10:23:26 +0100
commit014a83d2f53cd49bd2540c53ee56f26d880fe2f5 (patch)
treee805e55bd3a72085ee1d583a31e9c52438fc82c4
parentcf52a2aee0600d4a568a3d68c6691280545bd11f (diff)
Some debugging code.
-rw-r--r--dw/fltkimgbuf.cc38
-rw-r--r--lout/misc.cc6
-rw-r--r--lout/misc.hh2
3 files changed, 44 insertions, 2 deletions
diff --git a/dw/fltkimgbuf.cc b/dw/fltkimgbuf.cc
index 01bce455..df387dfb 100644
--- a/dw/fltkimgbuf.cc
+++ b/dw/fltkimgbuf.cc
@@ -145,6 +145,12 @@ void FltkImgbuf::init (Type type, int width, int height, double gamma,
deleteOnUnref = true;
copiedRows = new lout::misc::BitSet (height);
+ DBG_IF_RTFL {
+ lout::misc::StringBuffer sb;
+ copiedRows->intoStringBuffer (&sb);
+ DBG_OBJ_SET_SYM ("copiedRows", sb.getChars ());
+ }
+
// The list is only used for root buffers.
if (isRoot())
scaledBuffers = new lout::container::typed::List <FltkImgbuf> (true);
@@ -219,6 +225,13 @@ inline void FltkImgbuf::scaleRowSimple (int row, const core::byte *data)
if (copiedRows->get(sr)) continue;
copiedRows->set (sr, true);
+
+ DBG_IF_RTFL {
+ lout::misc::StringBuffer sb;
+ copiedRows->intoStringBuffer (&sb);
+ DBG_OBJ_SET_SYM ("copiedRows", sb.getChars ());
+ }
+
if (sr == sr1) {
for (int px = 0; px < root->width; px++) {
int px1 = px * width / root->width;
@@ -249,6 +262,12 @@ inline void FltkImgbuf::scaleRowBeautiful (int row, const core::byte *data)
// Mark scaled rows done
for (int sr = sr1; sr < sr2 || sr == sr1; sr++)
copiedRows->set (sr, true);
+
+ DBG_IF_RTFL {
+ lout::misc::StringBuffer sb;
+ copiedRows->intoStringBuffer (&sb);
+ DBG_OBJ_SET_SYM ("copiedRows", sb.getChars ());
+ }
} else {
assert (sr1 == sr2 || sr1 + 1 == sr2);
int row1 = backscaledY(sr1), row2 = backscaledY(sr1 + 1);
@@ -263,6 +282,12 @@ inline void FltkImgbuf::scaleRowBeautiful (int row, const core::byte *data)
bpp, gamma);
// Mark scaled row done
copiedRows->set (sr1, true);
+
+ DBG_IF_RTFL {
+ lout::misc::StringBuffer sb;
+ copiedRows->intoStringBuffer (&sb);
+ DBG_OBJ_SET_SYM ("copiedRows", sb.getChars ());
+ }
}
}
}
@@ -333,6 +358,13 @@ void FltkImgbuf::copyRow (int row, const core::byte *data)
if (row < height) {
// Flag the row done and copy its data.
copiedRows->set (row, true);
+
+ DBG_IF_RTFL {
+ lout::misc::StringBuffer sb;
+ copiedRows->intoStringBuffer (&sb);
+ DBG_OBJ_SET_SYM ("copiedRows", sb.getChars ());
+ }
+
memcpy(rawdata + row * width * bpp, data, width * bpp);
// Update all the scaled buffers of this root image.
@@ -350,6 +382,12 @@ void FltkImgbuf::newScan ()
for (Iterator<FltkImgbuf> it = scaledBuffers->iterator(); it.hasNext();){
FltkImgbuf *sb = it.getNext ();
sb->copiedRows->clear();
+
+ DBG_IF_RTFL {
+ lout::misc::StringBuffer sb;
+ copiedRows->intoStringBuffer (&sb);
+ DBG_OBJ_SET_SYM ("copiedRows", sb.getChars ());
+ }
}
}
}
diff --git a/lout/misc.cc b/lout/misc.cc
index 8d630efc..9b333c93 100644
--- a/lout/misc.cc
+++ b/lout/misc.cc
@@ -133,6 +133,7 @@ void StringBuffer::clear ()
BitSet::BitSet(int initBits)
{
+ numBits = initBits;
numBytes = bytesForBits(initBits);
bits = (unsigned char*)malloc(numBytes * sizeof(unsigned char));
clear();
@@ -146,7 +147,7 @@ BitSet::~BitSet()
void BitSet::intoStringBuffer(misc::StringBuffer *sb)
{
sb->append("[");
- for (int i = 0; i < numBytes; i++)
+ for (int i = 0; i < numBits; i++)
sb->append(get(i) ? "1" : "0");
sb->append("]");
}
@@ -161,6 +162,9 @@ bool BitSet::get(int i) const
void BitSet::set(int i, bool val)
{
+ if (i > numBits)
+ numBits = i;
+
if (8 * i >= numBytes) {
int newNumBytes = numBytes;
while (8 * i >= newNumBytes)
diff --git a/lout/misc.hh b/lout/misc.hh
index a0beb1b6..50c655eb 100644
--- a/lout/misc.hh
+++ b/lout/misc.hh
@@ -579,7 +579,7 @@ class BitSet
{
private:
unsigned char *bits;
- int numBytes;
+ int numBits, numBytes;
inline int bytesForBits(int bits) { return bits == 0 ? 1 : (bits + 7) / 8; }