


















I think I'm going to have to back out that clipping change set, at least until Scintilla gets all floating point rectangles. It looks like the mixing and matching is where the problem is.















EditView.cxx line 2131
// Does not take margin into account but not significant
const XYPOSITION xStartVisible = static_cast<XYPOSITION>(subLineStart-xStart);
// Foreground drawing loop
const BreakFinder::BreakFor breakFor = (((phasesDraw == PhasesDraw::One) && selBackDrawn) || vsDraw.SelectionTextDrawn())
(gdb) print xStartVisible
$42 = -52
(gdb) print subLineStart
$43 = 0
(gdb) print xStart
$44 = 52
(gdb) print phasesDraw
$45 = Scintilla::PhasesDraw::Multiple
(gdb) print vsDraw.SelectionTextDrawn()
$46 = false
(gdb) print selBackDrawn
$47 = true
(gdb)
(gdb) print breakFor
$49 = Scintilla::Internal::BreakFinder::BreakFor::Foreground
(gdb) print i
$51 = 63
(gdb)
(gdb) print ts
$50 = {start = 0, length = 64, representation = 0x0}
the rcSegment.Intersects(rcLine) returns true. i == 63 and ll->styles[i] comes back 0
(gdb) p/x textFore
$54 = {co = 0xfff8f8f8} #F8F8F8 which is an almost white color
Can someone confirm the "Intersects" logic plase? I have been chasing my tail here thinking something was walking on the background color of the style. That is completely wrong.
What appears to happen
That "not significant" margin comment causes a negative value and once we get down to tis rcSegment.Intersects(rcLine) test, drawing of the background is skipped. The "default" printPreview widget background color is white.
Are we supposed to skip drawing the background when the Intersects() test returns true?
The "hack" test for me to prove this is what is happening will be to set the palette property for the QPrintPreviewWidget
https://www.copperspice.com/docs/cs_api/class_qwidget.html#a3d57b947664f73f09abcf9a3721e2f0c
so the background color matches the style. If that "fixes" the problem then it is the Intersects() test that is failing somewhere and this should impact every editor that has non-white background __and__ print preview.





===========
=========== First line of First page
===========
DrawTextNoClip()
(gdb) print/x fore
$1 = {co = 0xffa9a9a9}
(gdb) print text
$2 = "1 "
(gdb) print/x back
$3 = {co = 0xff000000}
(gdb)
FillRectangleAligned()
(gdb) print/x fill
$4 = {colour = {co = 0xff3f2209}}
(gdb) print rc
$5 = {left = 52, top = 0, right = 541.09375, bottom = 15}
(gdb)
FillRectagle()
(gdb) print rc
$6 = {left = 52, top = 0, right = 541, bottom = 15}
(gdb) print/x fill
$7 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangleAligned()
(gdb) print rc
$8 = {left = 541.09375, top = 0, right = 547.71875, bottom = 15}
(gdb) print/x fill
$9 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangle()
(gdb) print rc
$10 = {left = 541, top = 0, right = 548, bottom = 15}
(gdb) print/x fill
$11 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangleAligned()
(gdb) print rc
$12 = {left = 547.71875, top = 0, right = 782, bottom = 15}
(gdb) print/x fill
$13 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangle()
(gdb) print rc
$14 = {left = 548, top = 0, right = 782, bottom = 15}
(gdb) print/x fill
$15 = {colour = {co = 0xff3f2209}}
(gdb)
then we hit 2151 Intersects() break
DrawTextTransparent()
(gdb) print rc
$16 = {left = 52, top = 0, right = 541.09375, bottom = 15}
(gdb) print/x fore
$17 = {co = 0xfff8f8f8}
(gdb) print text
$18 = "/", '*' <repeats 73 times>
(gdb)
===========
=========== First line second page
===========
DrawTextNoClip() -- line number 69
(gdb) print rc
$21 = {left = 18.953125, top = 0, right = 52, bottom = 15}
(gdb) print/x fore
$22 = {co = 0xffa9a9a9}
(gdb) print/x back
$23 = {co = 0xff000000}
(gdb) print text
$24 = "69 "
(gdb)
FillRectangleAligned()
gdb) print rc
$25 = {left = 52, top = 0, right = 475, bottom = 15}
(gdb) print/x fill
$26 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangle()
(gdb) print rc
$27 = {left = 52, top = 0, right = 475, bottom = 15}
(gdb) print/x fill
$28 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangleAligned()
(gdb) print rc
$29 = {left = 475, top = 0, right = 481.625, bottom = 15}
(gdb) print/x fill
$30 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangle()
(gdb) print rc
$31 = {left = 475, top = 0, right = 482, bottom = 15}
(gdb) print/x fill
$32 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangleAligned()
(gdb) print rc
$33 = {left = 481.625, top = 0, right = 782, bottom = 15}
(gdb) print/x fill
$34 = {colour = {co = 0xff3f2209}}
(gdb)
FillRectangle()
(gdb) print rc
$35 = {left = 482, top = 0, right = 782, bottom = 15}
(gdb) print/x fill
$36 = {colour = {co = 0xff3f2209}}
(gdb)
hit 2151 Intersects() break
DrawTextTransparent()
(gdb) print rc
$38 = {left = 52, top = 0, right = 475, bottom = 15}
(gdb) print/x fore
$39 = {co = 0xfff8f8f8}
(gdb) print text
$40 = " // remaining methods must be done after json_Read for config"
(gdb)
Am I missing something obvious???
I even went through and changed how the brush was cleared because I didn't like that code. I even forceably clear the brush now in DrawTextTransparent()
Thanks, I needed to rant.
Hopefully someone see something in the values from the debugger.
DrawTextNoClip()
(gdb) print/x fore
$1 = {co = 0xffa9a9a9}
(gdb) print text
$2 = "1 "
(gdb) print/x back
$3 = {co = 0xff000000}
static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer,
int x, int y, quint32 color,
const uchar *map,
int mapWidth, int mapHeight, int mapStride,
const QClipData *clip)
{
const quint32 c = color;
You will note clip is const. Then at line 6302 (in the CopperSpice version, different for Qt)
const_cast<QClipData *>(clip)->initialize();
They cast away const and call the initialize() method.
void QClipData::initialize()
{
if (m_spans) {
return;
}
if (!m_clipLines) {
m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight);
}
Q_CHECK_PTR(m_clipLines);
And that will generate a segmentation fault in malloc_consolidate, not all of the time, just some of the time, mainly if something in the clip really was in a PSECT tagged NOWRT, or RONLY because it just can't be consolidated with newly allocated memory. Yes, I've reported the bug, but any time you deal with clipping you can trigger it. This is especially true if you add page header/footer to your print preview.