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

Shaola Ren commented on PDFBOX-2117:
------------------------------------

Sorry, I thought it a little bit more, if I make the decision, I will take int 
key = (int) ((inputValue - domain[0]) * longestDistance / d1d0); and int key = 
(int) ((inputValue - domain[0]) * axialLength / d1d0); as they are just 
solutions of t = domain[0] + d1d0 * i / (float)longestDistance and t = 
domain[0] + d1d0 * i / (float)axialLength respectively, those two are used in 
the calcColorTable, key is corresponding to i. When the domain is 0 to 1, the 
above key is correct, and when the domain is not 0 to 1, the above key is still 
correct, no matter what is changed, the above form of key is the original and 
always correct one. In my first version, I just forgot to consider the case 
that t may not start with 0 and end with 1, it's a fault, and it just passed 
all the previous test cases as they all happened to have 0 to 1 domain, then 
the form of key simplified to inputValue * length.

> 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.pdf, 
> PDFBOX-2117-068519.pdf-2-bad.png, PDFBOX-2117-068519.pdf-2-good.png, 
> Shading2Function2.pdf, Shading2Function2.ps, Shading2Function2text.pdf, 
> asy-shade.pdf, color_gradient.pdf, 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