DrawSelection.java
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.text;
import com.adobe.xfa.gfx.GFXColour;
import com.adobe.xfa.ut.Storage;
class DrawSelection {
private final Storage<Clip> moClips = new Storage();
DrawSelection() {
}
void addClip(float oLeft, float oRight, GFXColour oFG, GFXColour oBG, boolean bTransparent) {
Clip oPrev;
float oSelStart = oLeft;
float oSelEnd = oRight;
if (oSelStart == oSelEnd) {
return;
}
if (oSelStart > oSelEnd) {
float oSwap = oSelStart;
oSelStart = oSelEnd;
oSelEnd = oSwap;
}
boolean bReplace = false;
if (this.moClips.size() > 0) {
oPrev = this.getLastClip();
if (oPrev.moFG == oFG && oPrev.moBG == oBG && oPrev.moRight >= oSelStart) {
bReplace = true;
}
}
if (bReplace) {
oPrev = this.getLastClip();
if (oSelEnd > oPrev.moRight) {
oPrev.moRight = oSelEnd;
}
} else {
Clip oClip = new Clip();
oClip.moLeft = oSelStart;
oClip.moRight = oSelEnd;
oClip.moFG = oFG;
oClip.moBG = oBG;
oClip.mbTransparent = bTransparent;
this.moClips.add(oClip);
}
}
int getClipCount() {
return this.moClips.size();
}
Clip getClip(int nIndex) {
return this.moClips.get(nIndex);
}
Clip getLastClip() {
if (this.moClips.size() == 0) {
return null;
}
return this.getClip(this.moClips.size() - 1);
}
static class Clip {
float moLeft;
float moRight;
GFXColour moFG;
GFXColour moBG;
boolean mbTransparent;
Clip() {
}
}
}