[ 
https://issues.apache.org/jira/browse/PDFBOX-2117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14081993#comment-14081993
 ] 

Andreas Lehmkühler commented on PDFBOX-2117:
--------------------------------------------

[~tilman] I'm not sure if I agree with your last change. I guess it's correct 
to use 0/1 for the range check (good catch by the way), but IMHO if the 
intermediate value is out of range we have to set it to the Domain values and 
not 0/1.

copied from the PDF-spec (8.7.4.5.3 Type 2 Axial shadings):

{quote}
The value of the parametric variable t is then determined from x¢ as follows:
- For 0£ x¢ £ 1, t = t0 + (t1 - t0) ¥ x¢.
- For x¢ < 0, if the first element of the Extend array is true, then t = t0; 
otherwise, t is undefined and the point shall be left unpainted.
- For x¢ > 1, if the second element of the Extend array is true, then t = t1; 
otherwise, t is undefined and the point shall be left 
unpainted.
{/quote}

Where t0/t1 are the domian values. 

Am I missing something (I didn't run any tests so these are just some 
theoretical thoughts)?


> AxialShadingContext is slow
> ---------------------------
>
>                 Key: PDFBOX-2117
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2117
>             Project: PDFBox
>          Issue Type: Sub-task
>          Components: Rendering
>    Affects Versions: 1.8.6, 1.8.7, 2.0.0
>            Reporter: Petr Slaby
>            Assignee: Shaola Ren
>              Labels: shading, shadingpattern
>             Fix For: 2.0.0
>
>         Attachments: 000001_MTEXT_CS6.pdf, AxialShading.patch, 
> AxialShading1.patch, AxialShadingContext.java.getrgbimage, 
> GWG061_Shading_x1a.pdf, GWG061_Shading_x1a.pdf-1.png, 
> GWG061_Shading_x1a.pdf-1.png-diff.png, PDFBOX-2117-068519-ShadingType3.pdf, 
> PDFBOX-2117-068519.pdf, PDFBOX-2117-068519.pdf-2-bad.png, 
> PDFBOX-2117-068519.pdf-2-good.png, Shading2Function2.pdf, 
> Shading2Function2.ps, Shading2Function2domain3.pdf, 
> Shading2Function2text.pdf, asy-shade.pdf, 
> bad_pdfbox-2117-068519-shadingtype3.pdf-1.png, color_gradient.pdf, 
> good_pdfbox-2117-068519-shadingtype3.pdf-1.png, shading_pattern.pdf
>
>
> AxialShadingContext#getRaster() is on top of profiler hot spots in documents 
> that use an axial shading. Inside it, the slowest part is calling 
> PDColorSpaceRGB#toRGB() and PDFunctionType3#eval() (in this order).
>   



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to