primitives: Add API to ShaderNode to override texture filtering

  • primitives: Use pre-multiplied blending in ShadowedRectangle shader

The entire shader assumes we are using pre-multiplied colors, because Qt generally wants pre-multiplied. For blending the texture on top of the rectangle color, we also need to account for the source texture to be premultiplied. Since the sdf_render() function uses mix() internally, it cannot do this by itself, instead we first need to render the rectangle with the texture as color, and then blend that on top of the background.

  • primitives: Use nearest texture filtering if ShadowedTexture::smooth is false

In certain cases, most prominently when using ShadowedTexture as layer effect, it may be desirable to use nearest filtering as linear causes blurring. Since the smooth property is intended to indicate such a preference, make use of it to override the texture filtering mode.

CCBUG: 445759

  • primitives: Add API to ShaderNode to override texture filtering

Rather than always using linear, allow the node user to set a filtering mode, as in some cases nearest may be desirable.

Merge request reports

Loading