summaryrefslogtreecommitdiffstats
path: root/tests/arthur/data/qps/clipping.qps
blob: 09a7e776f0ead1079bef15f23b91b35059a46717 (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
region_addRect clip 50 0 90 190
region_addRect clip 0 50 180 90

region_addRect clip2 30 30 60 60

region_addRect clip3 10 10 60 60

path_cubicTo path 90 0 50 50 90 90
path_cubicTo path 0 90 50 50 0 0

path_addRect path2 0 0 90 90
path_moveTo path2 90 45
path_arcTo path2 0 0 90 90 0 -360

path_addRect emptypath 0 0 0 0
region_addRect emptyregion 0 0 0 0

# Normal clip rect
setClipRect 0 0 50 150
begin_block repaint
save
setBrush red
setPen nopen
resetMatrix
region_getClipRegion tmpclip
path_getClipPath tmpclippath
drawRect 0 0 width height
setBrush #3f0000ff
setClipRegion tmpclip
drawRect 0 0 width height
setClipPath tmpclippath
setBrush #3f00ff00
drawRect 0 0 width height
restore
end_block

# Rotated clip rect
translate 100 0
rotate 10
setClipRect 0 0 50 150
repeat_block repaint

# simple clip region
resetMatrix
translate 0 200
setClipRegion clip
repeat_block repaint

# simle rotated clip region
translate 250 -10
rotate 10
setClipRegion clip
repeat_block repaint

# verify that clip is not xformed with painter
resetMatrix
translate 200 0
setClipRegion clip
rotate 30
setBrush red
setPen nopen
drawRect 0 0 width height

resetMatrix
translate 0 400
save
setClipRegion clip
setClipRegion clip2 IntersectClip
repeat_block repaint
translate 0 100
rotate 10
setClipRegion clip
setClipRegion clip2 IntersectClip
restore

translate 100 0
save
setClipRegion clip3
setClipRegion clip2 UniteClip
repeat_block repaint
translate 0 100
rotate 10
setClipRegion clip3
setClipRegion clip2 UniteClip
repeat_block repaint
restore

translate 100 0
save
setClipPath path
repeat_block repaint
translate 50 100
rotate 45
setClipPath path
repeat_block repaint
restore

translate 100 0
save
setClipPath path
setClipPath path2 IntersectClip
repeat_block repaint
translate 0 100
rotate 10
setClipPath path
setClipPath path2 IntersectClip
repeat_block repaint
restore

translate 100 0
save
setClipPath path
setClipPath path2 UniteClip
repeat_block repaint
translate 0 100
rotate 10
setClipPath path
setClipPath path2 UniteClip
repeat_block repaint
restore

translate 100 0
save
setClipPath path
setClipRegion clip3 IntersectClip
repeat_block repaint
translate 0 100
rotate 10
setClipRegion clip3
setClipPath path IntersectClip
repeat_block repaint
restore

translate 100 0
save
setClipPath path
setClipRegion clip3 UniteClip
repeat_block repaint
translate 0 100
rotate 10
setClipRegion clip3
setClipPath path UniteClip
repeat_block repaint
restore

# test that an empty region is not drawn.
resetMatrix
setClipRegion emptyregion
setBrush #3f00ff00
drawRect 0 0 300 300
drawText 50 50 "Text should be clipped away by region"
setClipping false

setClipPath emptypath
setBrush #3fffff00
drawRect 50 50 300 300
drawText 70 80 "Text should be clipped away by path"

# Test that we can extract a clipregion when a matrix is set too
resetMatrix
translate 500 10
scale 2 1
setBrush blue
setClipping false
rotate 5
drawRect 0 0 100 100
setClipRect 0 0 100 100
resetMatrix
rotate 10
region_getClipRegion xclip
setClipRegion xclip
resetMatrix
setBrush #7f00ff00
drawRect 0 0 width height

# the below used to assert in debug mode
setClipRect 10 10 20 20
setClipping false
setClipping true