diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2012-02-19 15:45:43 -0800 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2012-03-15 11:54:23 +0000 |
commit | 7339c0fb494ea67e14fa7c0642fab38086f30db6 (patch) | |
tree | 477d30eadb3e47d4afa2060b5c2169c15bc4621f | |
parent | 6d5bd5530183a9dc01a61897a8b091f6a80ddd5d (diff) |
Improve image performance by rotating Width 1 images to Height 1.
The image code makes a call to 'image_render' for each line of the Height. This defeats the joining
of any same color pixels into a larger rectangle and also creates extra overhead. Problem analyzed
with profiles from cust 532 file "PWTTQ1CC.pdf". Regression testing shows some single pixel differences
presumably due to rounding, but no obvious problems.
-rw-r--r-- | gs/psi/zimage.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gs/psi/zimage.c b/gs/psi/zimage.c index 60ac46c48..c2b3e7f53 100644 --- a/gs/psi/zimage.c +++ b/gs/psi/zimage.c @@ -217,6 +217,26 @@ image1_setup(i_ctx_t * i_ctx_p, bool has_alpha) return code; image.Alpha = (has_alpha ? gs_image_alpha_last : gs_image_alpha_none); + /* swap Width, Height, and ImageMatrix so that it comes out the same */ + /* This is only for performance, so only do it for non-skew cases */ + if (image.Width == 1 && image.Height > 1 && image.BitsPerComponent == 8 && + image.ImageMatrix.xy == 0.0 && image.ImageMatrix.yx == 0.0 && + image.ImageMatrix.tx == 0.0) { + float ftmp; + int itemp; + + itemp = image.Width; + image.Width = image.Height; + image.Height = itemp; + + image.ImageMatrix.xy = image.ImageMatrix.xx; + image.ImageMatrix.yx = image.ImageMatrix.yy; + image.ImageMatrix.xx = 0.0; + image.ImageMatrix.yy = 0.0; + ftmp = image.ImageMatrix.tx; + image.ImageMatrix.tx = image.ImageMatrix.ty; + image.ImageMatrix.ty = ftmp; + } return zimage_setup( i_ctx_p, (gs_pixel_image_t *)&image, &ip.DataSource[0], |