[Spice-devel] Weird code
Uri Lublin
uril at redhat.com
Thu May 7 06:29:26 PDT 2015
On 05/06/2015 05:21 PM, Frediano Ziglio wrote:
> Hi,
> I was looking at spice-server code and I came into this piece of code
>
> /* drawable was already rendered, we may not be able to retrieve the lossless data
> for the lossy areas */
> sync_rendered = TRUE;
>
> // checking if the drawable itself or one of the other commands
> // that were rendered, affected the areas that need to be resent
> if (!drawable_intersects_with_areas(item, deps_surfaces_ids,
> deps_areas, num_deps)) {
> if (pipe_rendered_drawables_intersect_with_areas(worker, dcc,
> deps_surfaces_ids,
> deps_areas,
> num_deps)) {
> sync_rendered = TRUE;
> }
> } else {
> sync_rendered = TRUE;
> }
>
> (in red_add_lossless_drawable_dependencies function, red_worker.c)
>
> Now sync_rendered after this code is always TRUE from first assignment (no pointer taken between all assignments), also the 2 functions (drawable_intersects_with_areas and pipe_rendered_drawables_intersect_with_areas) does only some checks on the parameters without changing them. So... This code is not equivalent (and faster) ?
>
> /* drawable was already rendered, we may not be able to retrieve the lossless data
> for the lossy areas */
> sync_rendered = TRUE;
Indeed, that seems like a simpler equivalent code.
Perhaps one of the above "sync_rendered = TRUE" should be " = FALSE" ...
More information about the Spice-devel
mailing list