mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-16 11:25:46 +00:00
sw_engine: tint effect optimization++
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
skip interpolation when intensity is 1.0. since intensity adjustment is optional and computationally expensive, avoiding it in this case is worthwhile.
This commit is contained in:
parent
d2b2fb02f0
commit
4a0d17ba83
1 changed files with 4 additions and 2 deletions
|
@ -485,7 +485,8 @@ bool effectTint(SwCompositor* cmp, const RenderEffectTint* params, bool direct)
|
|||
auto dst = dbuffer;
|
||||
auto src = sbuffer;
|
||||
for (size_t x = 0; x < w; ++x, ++dst, ++src) {
|
||||
auto val = INTERPOLATE(INTERPOLATE(white, black, luma((uint8_t*)src)), *src, params->intensity);
|
||||
auto val = INTERPOLATE(white, black, luma((uint8_t*)src));
|
||||
if (params->intensity < 255) val = INTERPOLATE(val, *src, params->intensity);
|
||||
*dst = INTERPOLATE(val, *dst, MULTIPLY(opacity, A(*src)));
|
||||
}
|
||||
dbuffer += cmp->image.stride;
|
||||
|
@ -497,7 +498,8 @@ bool effectTint(SwCompositor* cmp, const RenderEffectTint* params, bool direct)
|
|||
for (size_t y = 0; y < h; ++y) {
|
||||
auto dst = dbuffer;
|
||||
for (size_t x = 0; x < w; ++x, ++dst) {
|
||||
auto val = INTERPOLATE(INTERPOLATE(white, black, luma((uint8_t*)&dst)), *dst, params->intensity);
|
||||
auto val = INTERPOLATE(white, black, luma((uint8_t*)&dst));
|
||||
if (params->intensity < 255) val = INTERPOLATE(val, *dst, params->intensity);
|
||||
*dst = ALPHA_BLEND(val, MULTIPLY(opacity, A(*dst)));
|
||||
}
|
||||
dbuffer += cmp->image.stride;
|
||||
|
|
Loading…
Add table
Reference in a new issue