summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2012-07-20 05:52:50 +0800
committerroot <root@fc17.bj.intel.com>2012-07-23 11:43:26 +0800
commit1f50d3f368c9e7135576ecb376fbaef34fd22132 (patch)
treee9bd99139a5cec90f1ed8e40c1254443d968e60e
parent1315ff92e2e19811cfb9a8bddab8e40bca5cd4e5 (diff)
Just use the shader to generate trapezoid if PolyMode == Imprecise
The precise mode of trapezoid rendering need to sample the trapezoid on the centre points of an (2*n+1)x(2*n-1) subpixel grid. It is computationally expensive in shader, and we use inside area ratio to replace it. The result has some difference, and we just use it if the polymode == Imprecise. Signed-off-by: Junyan He <junyan.he@linux.intel.com>
-rw-r--r--src/glamor_trapezoid.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/glamor_trapezoid.c b/src/glamor_trapezoid.c
index d7bba66..5c02a8c 100644
--- a/src/glamor_trapezoid.c
+++ b/src/glamor_trapezoid.c
@@ -1664,15 +1664,20 @@ _glamor_trapezoids(CARD8 op,
if(ret)
return TRUE;
} else {
- picture = glamor_create_mask_picture(screen, dst, mask_format,
- width, height, 1);
- if (!picture)
- return TRUE;
-
- ret = _glamor_generate_trapezoid_with_shader(screen, picture, traps, ntrap, &bounds);
-
- if (!ret)
- FreePicture(picture, 0);
+ /* The precise mode is that we sample the trapezoid on the centre points of
+ an (2*n+1)x(2*n-1) subpixel grid. It is computationally expensive in shader
+ and we use inside area ratio to replace it if the polymode == Imprecise. */
+ if(dst->polyMode == PolyModeImprecise) {
+ picture = glamor_create_mask_picture(screen, dst, mask_format,
+ width, height, 1);
+ if (!picture)
+ return TRUE;
+
+ ret = _glamor_generate_trapezoid_with_shader(screen, picture, traps, ntrap, &bounds);
+
+ if (!ret)
+ FreePicture(picture, 0);
+ }
}
#endif