… | |
… | |
28 | |
28 | |
29 | #if XRENDER |
29 | #if XRENDER |
30 | # include <X11/extensions/Xrender.h> |
30 | # include <X11/extensions/Xrender.h> |
31 | #endif |
31 | #endif |
32 | |
32 | |
|
|
33 | #ifndef FilterConvolution |
|
|
34 | #define FilterConvolution "convolution" |
|
|
35 | #endif |
|
|
36 | |
33 | #define DO_TIMING_TEST 0 |
37 | #define DO_TIMING_TEST 0 |
34 | |
38 | |
35 | #if DO_TIMING_TEST |
39 | #if DO_TIMING_TEST |
36 | # include <sys/time.h> |
40 | # include <sys/time.h> |
37 | #define TIMING_TEST_START(id) \ |
41 | #define TIMING_TEST_START(id) \ |
… | |
… | |
62 | * |
66 | * |
63 | * WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. |
67 | * WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. |
64 | * W and H are percentages of the terminal window size. |
68 | * W and H are percentages of the terminal window size. |
65 | * X and Y are also percentages; e.g., +50+50 centers |
69 | * X and Y are also percentages; e.g., +50+50 centers |
66 | * the image in the window. |
70 | * the image in the window. |
67 | * WxH+X Assumes Y == X |
|
|
68 | * WxH Assumes Y == X == 50 (centers the image) |
|
|
69 | * W+X+Y Assumes H == W |
|
|
70 | * W+X Assumes H == W and Y == X |
|
|
71 | * W Assumes H == W and Y == X == 50 |
|
|
72 | * |
|
|
73 | * Adjusting position only : |
|
|
74 | * =+X+Y Set position to X% by Y% (absolute). |
|
|
75 | * =+X Set position to X% by X%. |
|
|
76 | * +X+Y Adjust position horizontally X% and vertically Y% |
|
|
77 | * from current position (relative). |
|
|
78 | * +X Adjust position horizontally X% and vertically X% |
|
|
79 | * from current position. |
|
|
80 | * |
|
|
81 | * Adjusting scale only : |
|
|
82 | * Wx0 Multiply horizontal scaling factor by W% |
|
|
83 | * 0xH Multiply vertical scaling factor by H% |
|
|
84 | * 0x0 No scaling (show image at normal size). |
|
|
85 | * |
71 | * |
86 | * Pixmap Operations : (should be prepended by a colon) |
72 | * Pixmap Operations : (should be prepended by a colon) |
87 | * tile Tile image. Scaling/position modifiers above will affect |
73 | * tile Tile image. Scaling/position modifiers above will affect |
88 | * the tile size and origin. |
74 | * the tile size and origin. |
89 | * propscale When scaling, scale proportionally. That is, maintain the |
75 | * propscale When scaling, scale proportionally. That is, maintain the |
… | |
… | |
172 | return true; |
158 | return true; |
173 | } |
159 | } |
174 | # endif |
160 | # endif |
175 | |
161 | |
176 | return false; |
162 | return false; |
177 | }; |
163 | } |
178 | |
164 | |
179 | bool bgPixmap_t::need_client_side_rendering () |
165 | bool bgPixmap_t::need_client_side_rendering () |
180 | { |
166 | { |
181 | # ifdef HAVE_AFTERIMAGE |
167 | # ifdef HAVE_AFTERIMAGE |
182 | if (original_asim) |
168 | if (original_asim) |
… | |
… | |
252 | dst_size = target_size - dst_pos; |
238 | dst_size = target_size - dst_pos; |
253 | return src_pos; |
239 | return src_pos; |
254 | } |
240 | } |
255 | |
241 | |
256 | bool |
242 | bool |
257 | bgPixmap_t::set_geometry (const char *geom) |
243 | bgPixmap_t::set_geometry (const char *geom, bool update) |
258 | { |
244 | { |
259 | bool changed = false; |
245 | bool changed = false; |
260 | int geom_flags = 0; |
246 | int geom_flags = 0; |
261 | int x = 0, y = 0; |
247 | int x = 0, y = 0; |
262 | unsigned int w = 0, h = 0; |
248 | unsigned int w = 0, h = 0; |
… | |
… | |
276 | |
262 | |
277 | n = (p - geom); |
263 | n = (p - geom); |
278 | if (n < MAXLEN_GEOM) |
264 | if (n < MAXLEN_GEOM) |
279 | { |
265 | { |
280 | char *ops; |
266 | char *ops; |
281 | new_flags |= geometrySet; |
|
|
282 | |
267 | |
283 | memcpy (str, geom, n); |
268 | memcpy (str, geom, n); |
284 | str[n] = '\0'; |
269 | str[n] = '\0'; |
285 | if (str[0] == ':') |
270 | if (str[0] == ':') |
286 | ops = &str[0]; |
271 | ops = &str[0]; |
… | |
… | |
301 | if (ops > str || ops == NULL) |
286 | if (ops > str || ops == NULL) |
302 | { |
287 | { |
303 | /* we have geometry string - let's handle it prior to applying ops */ |
288 | /* we have geometry string - let's handle it prior to applying ops */ |
304 | geom_flags = XParseGeometry (str, &x, &y, &w, &h); |
289 | geom_flags = XParseGeometry (str, &x, &y, &w, &h); |
305 | |
290 | |
306 | if ((geom_flags & XValue) && !(geom_flags & YValue)) |
|
|
307 | { |
|
|
308 | y = x; |
|
|
309 | geom_flags |= YValue; |
|
|
310 | } |
|
|
311 | |
|
|
312 | if (flags & geometrySet) |
|
|
313 | { |
|
|
314 | /* new geometry is an adjustment to the old one ! */ |
|
|
315 | if ((geom_flags & WidthValue) && (geom_flags & HeightValue)) |
|
|
316 | { |
|
|
317 | if (w == 0 && h != 0) |
|
|
318 | { |
|
|
319 | w = h_scale; |
|
|
320 | h = (v_scale * h) / 100; |
|
|
321 | } |
|
|
322 | else if (h == 0 && w != 0) |
|
|
323 | { |
|
|
324 | w = (h_scale * w) / 100; |
|
|
325 | h = v_scale; |
|
|
326 | } |
|
|
327 | } |
|
|
328 | if (geom_flags & XValue) |
|
|
329 | { |
|
|
330 | if (str[0] != '=') |
|
|
331 | { |
|
|
332 | y += v_align; |
|
|
333 | x += h_align; |
|
|
334 | } |
|
|
335 | } |
|
|
336 | } |
|
|
337 | else /* setting up geometry from scratch */ |
291 | if (!update) /* setting up geometry from scratch */ |
338 | { |
292 | { |
339 | if (!(geom_flags & XValue)) |
293 | if (!(geom_flags & XValue)) |
340 | { |
294 | { |
341 | /* use default geometry - centered */ |
295 | /* use default geometry - centered */ |
342 | x = y = defaultAlign; |
296 | x = y = defaultAlign; |
… | |
… | |
356 | } |
310 | } |
357 | else |
311 | else |
358 | w = h; |
312 | w = h; |
359 | } |
313 | } |
360 | } /* done parsing geometry string */ |
314 | } /* done parsing geometry string */ |
361 | else if (!(flags & geometrySet)) |
315 | else if (!update) |
362 | { |
316 | { |
363 | /* default geometry - scaled and centered */ |
317 | /* default geometry - scaled and centered */ |
364 | x = y = defaultAlign; |
318 | x = y = defaultAlign; |
365 | w = h = defaultScale; |
319 | w = h = defaultScale; |
366 | } |
320 | } |
367 | |
321 | |
368 | if (!(flags & geometrySet)) |
322 | if (!update) |
369 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
323 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
370 | |
324 | |
371 | if (ops) |
325 | if (ops) |
372 | { |
326 | { |
373 | while (*ops) |
327 | while (*ops) |