splash/Splash.cc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
New commits: commit e607d9c4a0057c390c59e306f6dc010aea2125ee Author: Stefan BrĂ¼ns <[email protected]> Date: Sun May 20 19:31:53 2018 +0200 Small optimization for AABGR8 pipes Skip some computations if both src and dest alpha are zero, or if src is fully opaque. Equivalent to Commit f47936af7508A ("Small optimization for AAXRGB8 pipes"). diff --git a/splash/Splash.cc b/splash/Splash.cc index 31896066..90cdf126 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -1191,25 +1191,35 @@ void Splash::pipeRunAABGR8(SplashPipe *pipe) { SplashColor cDest; Guchar cResult0, cResult1, cResult2; - //----- read destination pixel - cDest[0] = pipe->destColorPtr[2]; - cDest[1] = pipe->destColorPtr[1]; - cDest[2] = pipe->destColorPtr[0]; + //----- read destination alpha aDest = *pipe->destAlphaPtr; //----- source alpha aSrc = div255(pipe->aInput * pipe->shape); - //----- result alpha and non-isolated group element correction - aResult = aSrc + aDest - div255(aSrc * aDest); - alpha2 = aResult; - //----- result color - if (alpha2 == 0) { + if (aSrc == 255) { + cResult0 = state->rgbTransferR[pipe->cSrc[0]]; + cResult1 = state->rgbTransferG[pipe->cSrc[1]]; + cResult2 = state->rgbTransferB[pipe->cSrc[2]]; + aResult = 255; + + } else if (aSrc == 0 && aDest == 0) { cResult0 = 0; cResult1 = 0; cResult2 = 0; + aResult = 0; + } else { + //----- read destination color + cDest[0] = pipe->destColorPtr[2]; + cDest[1] = pipe->destColorPtr[1]; + cDest[2] = pipe->destColorPtr[0]; + + //----- result alpha and non-isolated group element correction + aResult = aSrc + aDest - div255(aSrc * aDest); + alpha2 = aResult; + cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] + aSrc * pipe->cSrc[0]) / alpha2)]; cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] + _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
