drawing highlighting
"corvid" <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <20130108035317.GA27863@local> |
I was looking at draw() calls for the view, and I saw how there was a call for every time that the mouse moved when highlighting even though the text highlighted didn't necessarily change. Here's quick code to demonstrate that there are plenty of redundant ones. I don't know the iterator code well enough to know whether that's the right place to do anything about it, though... _______________________________________________ Dillo-dev mailing list [email protected] http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
highlight_draw.diff
(text/plain, 1.2 KB)
diff -r 7750054f37e5 dw/textblock_iterator.cc
--- a/dw/textblock_iterator.cc Mon Jan 07 21:39:19 2013 +0100
+++ b/dw/textblock_iterator.cc Tue Jan 08 03:45:06 2013 +0000
@@ -106,6 +106,11 @@
Textblock *textblock = (Textblock*)getWidget();
int index1 = index, index2 = index;
+ int oldStartIndex = textblock->hlStart[layer].index;
+ int oldStartChar = textblock->hlStart[layer].nChar;
+ int oldEndIndex = textblock->hlEnd[layer].index;
+ int oldEndChar = textblock->hlEnd[layer].nChar;
+
if (textblock->hlStart[layer].index > textblock->hlEnd[layer].index) {
/* nothing is highlighted */
textblock->hlStart[layer].index = index;
@@ -124,7 +129,14 @@
textblock->hlEnd[layer].nChar = end;
}
- textblock->queueDrawRange (index1, index2);
+ if (oldStartIndex == textblock->hlStart[layer].index &&
+ oldStartChar == textblock->hlStart[layer].nChar &&
+ oldEndIndex == textblock->hlEnd[layer].index &&
+ oldEndChar == textblock->hlEnd[layer].nChar) {
+ MSG("I'm not going to bother to redraw!\n");
+ } else {
+ textblock->queueDrawRange (index1, index2);
+ }
}
void Textblock::TextblockIterator::unhighlight (int direction,