mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 02:09:35 +02:00
refactoring (compute hilites one time per page)
This commit is contained in:
parent
7f71050027
commit
6ffcaa246b
1 changed files with 19 additions and 16 deletions
|
@ -508,16 +508,19 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
previousInfo = info;
|
previousInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = getLeftMargin();
|
final List<ZLTextHighlighting> hilites = findHilites(page);
|
||||||
y = getTopMargin();
|
if (!hilites.isEmpty()) {
|
||||||
index = 0;
|
x = getLeftMargin();
|
||||||
for (ZLTextLineInfo info : lineInfos) {
|
y = getTopMargin();
|
||||||
drawHighlightings(page, info, labels[index], labels[index + 1], x, y);
|
index = 0;
|
||||||
y += info.Height + info.Descent + info.VSpaceAfter;
|
for (ZLTextLineInfo info : lineInfos) {
|
||||||
++index;
|
drawHighlightings(page, hilites, info, labels[index], labels[index + 1], x, y);
|
||||||
if (index == page.Column0Height) {
|
y += info.Height + info.Descent + info.VSpaceAfter;
|
||||||
y = getTopMargin();
|
++index;
|
||||||
x += page.getTextWidth() + getSpaceBetweenColumns();
|
if (index == page.Column0Height) {
|
||||||
|
y = getTopMargin();
|
||||||
|
x += page.getTextWidth() + getSpaceBetweenColumns();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,11 +826,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
preparePaintInfo();
|
preparePaintInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawHighlightings(ZLTextPage page, ZLTextLineInfo info, int from, int to, int x, int y) {
|
private List<ZLTextHighlighting> findHilites(ZLTextPage page) {
|
||||||
if (from == to) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final LinkedList<ZLTextHighlighting> hilites = new LinkedList<ZLTextHighlighting>();
|
final LinkedList<ZLTextHighlighting> hilites = new LinkedList<ZLTextHighlighting>();
|
||||||
if (mySelection.intersects(page)) {
|
if (mySelection.intersects(page)) {
|
||||||
hilites.add(mySelection);
|
hilites.add(mySelection);
|
||||||
|
@ -839,7 +838,11 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hilites.isEmpty()) {
|
return hilites;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawHighlightings(ZLTextPage page, List<ZLTextHighlighting> hilites, ZLTextLineInfo info, int from, int to, int x, int y) {
|
||||||
|
if (from == to) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue