Lines Matching full:d
243 typedef uint8_t(*SwMask)(uint8_t s, uint8_t d, uint8_t a); //src, dst, alpha
244 typedef uint32_t(*SwBlender)(uint32_t s, uint32_t d, uint8_t a); //src, dst, alpha
311 static inline uint32_t INTERPOLATE(uint32_t s, uint32_t d, uint8_t a) in INTERPOLATE() argument
313 …8) & 0xff00ff) - ((d >> 8) & 0xff00ff)) * a) + (d & 0xff00ff00)) & 0xff00ff00) + ((((((s & 0xff00f… in INTERPOLATE()
316 static inline uint8_t INTERPOLATE8(uint8_t s, uint8_t d, uint8_t a) in INTERPOLATE8() argument
318 return (((s) * (a) + 0xff) >> 8) + (((d) * ~(a) + 0xff) >> 8); in INTERPOLATE8()
351 static inline uint32_t opBlendInterp(uint32_t s, uint32_t d, uint8_t a) in opBlendInterp() argument
353 return INTERPOLATE(s, d, a); in opBlendInterp()
356 static inline uint32_t opBlendNormal(uint32_t s, uint32_t d, uint8_t a) in opBlendNormal() argument
359 return t + ALPHA_BLEND(d, IA(t)); in opBlendNormal()
362 static inline uint32_t opBlendPreNormal(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendPreNormal() argument
364 return s + ALPHA_BLEND(d, IA(s)); in opBlendPreNormal()
367 static inline uint32_t opBlendSrcOver(uint32_t s, TVG_UNUSED uint32_t d, TVG_UNUSED uint8_t a) in opBlendSrcOver() argument
373 static inline uint32_t opBlendDifference(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendDifference() argument
375 //if (s > d) => s - d in opBlendDifference()
376 //else => d - s in opBlendDifference()
377 auto c1 = (C1(s) > C1(d)) ? (C1(s) - C1(d)) : (C1(d) - C1(s)); in opBlendDifference()
378 auto c2 = (C2(s) > C2(d)) ? (C2(s) - C2(d)) : (C2(d) - C2(s)); in opBlendDifference()
379 auto c3 = (C3(s) > C3(d)) ? (C3(s) - C3(d)) : (C3(d) - C3(s)); in opBlendDifference()
383 static inline uint32_t opBlendExclusion(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendExclusion() argument
386 auto c1 = std::min(255, C1(s) + C1(d) - std::min(255, (C1(s) * C1(d)) << 1)); in opBlendExclusion()
387 auto c2 = std::min(255, C2(s) + C2(d) - std::min(255, (C2(s) * C2(d)) << 1)); in opBlendExclusion()
388 auto c3 = std::min(255, C3(s) + C3(d) - std::min(255, (C3(s) * C3(d)) << 1)); in opBlendExclusion()
392 static inline uint32_t opBlendAdd(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendAdd() argument
394 // s + d in opBlendAdd()
395 auto c1 = std::min(C1(s) + C1(d), 255); in opBlendAdd()
396 auto c2 = std::min(C2(s) + C2(d), 255); in opBlendAdd()
397 auto c3 = std::min(C3(s) + C3(d), 255); in opBlendAdd()
401 static inline uint32_t opBlendScreen(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendScreen() argument
403 // s + d - s * d in opBlendScreen()
404 auto c1 = C1(s) + C1(d) - MULTIPLY(C1(s), C1(d)); in opBlendScreen()
405 auto c2 = C2(s) + C2(d) - MULTIPLY(C2(s), C2(d)); in opBlendScreen()
406 auto c3 = C3(s) + C3(d) - MULTIPLY(C3(s), C3(d)); in opBlendScreen()
410 static inline uint32_t opBlendMultiply(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendMultiply() argument
412 // s * d in opBlendMultiply()
413 auto c1 = MULTIPLY(C1(s), C1(d)); in opBlendMultiply()
414 auto c2 = MULTIPLY(C2(s), C2(d)); in opBlendMultiply()
415 auto c3 = MULTIPLY(C3(s), C3(d)); in opBlendMultiply()
419 static inline uint32_t opBlendOverlay(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendOverlay() argument
421 // if (2 * d < da) => 2 * s * d, in opBlendOverlay()
422 // else => 1 - 2 * (1 - s) * (1 - d) in opBlendOverlay()
423 …auto c1 = (C1(d) < 128) ? std::min(255, 2 * MULTIPLY(C1(s), C1(d))) : (255 - std::min(255, 2 * MUL… in opBlendOverlay()
424 …auto c2 = (C2(d) < 128) ? std::min(255, 2 * MULTIPLY(C2(s), C2(d))) : (255 - std::min(255, 2 * MUL… in opBlendOverlay()
425 …auto c3 = (C3(d) < 128) ? std::min(255, 2 * MULTIPLY(C3(s), C3(d))) : (255 - std::min(255, 2 * MUL… in opBlendOverlay()
429 static inline uint32_t opBlendDarken(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendDarken() argument
431 // min(s, d) in opBlendDarken()
432 auto c1 = std::min(C1(s), C1(d)); in opBlendDarken()
433 auto c2 = std::min(C2(s), C2(d)); in opBlendDarken()
434 auto c3 = std::min(C3(s), C3(d)); in opBlendDarken()
438 static inline uint32_t opBlendLighten(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendLighten() argument
440 // max(s, d) in opBlendLighten()
441 auto c1 = std::max(C1(s), C1(d)); in opBlendLighten()
442 auto c2 = std::max(C2(s), C2(d)); in opBlendLighten()
443 auto c3 = std::max(C3(s), C3(d)); in opBlendLighten()
447 static inline uint32_t opBlendColorDodge(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendColorDodge() argument
449 // d / (1 - s) in opBlendColorDodge()
451 auto c1 = (C1(is) > 0) ? (C1(d) / C1(is)) : C1(d); in opBlendColorDodge()
452 auto c2 = (C2(is) > 0) ? (C2(d) / C2(is)) : C2(d); in opBlendColorDodge()
453 auto c3 = (C3(is) > 0) ? (C3(d) / C3(is)) : C3(d); in opBlendColorDodge()
457 static inline uint32_t opBlendColorBurn(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendColorBurn() argument
459 // 1 - (1 - d) / s in opBlendColorBurn()
460 auto id = 0xffffffff - d; in opBlendColorBurn()
467 static inline uint32_t opBlendHardLight(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendHardLight() argument
469 …128) ? std::min(255, 2 * MULTIPLY(C1(s), C1(d))) : (255 - std::min(255, 2 * MULTIPLY(255 - C1(s), … in opBlendHardLight()
470 …128) ? std::min(255, 2 * MULTIPLY(C2(s), C2(d))) : (255 - std::min(255, 2 * MULTIPLY(255 - C2(s), … in opBlendHardLight()
471 …128) ? std::min(255, 2 * MULTIPLY(C3(s), C3(d))) : (255 - std::min(255, 2 * MULTIPLY(255 - C3(s), … in opBlendHardLight()
475 static inline uint32_t opBlendSoftLight(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a) in opBlendSoftLight() argument
477 //(255 - 2 * s) * (d * d) + (2 * s * b) in opBlendSoftLight()
478 …55, MULTIPLY(255 - std::min(255, 2 * C1(s)), MULTIPLY(C1(d), C1(d))) + 2 * MULTIPLY(C1(s), C1(d))); in opBlendSoftLight()
479 …55, MULTIPLY(255 - std::min(255, 2 * C2(s)), MULTIPLY(C2(d), C2(d))) + 2 * MULTIPLY(C2(s), C2(d))); in opBlendSoftLight()
480 …55, MULTIPLY(255 - std::min(255, 2 * C3(s)), MULTIPLY(C3(d), C3(d))) + 2 * MULTIPLY(C3(s), C3(d))); in opBlendSoftLight()