ruffle icon indicating copy to clipboard operation
ruffle copied to clipboard

render,core: Improve EditText's border and background rendering

Open kjarosh opened this issue 8 months ago • 1 comments

This PR removes the drawing used for rendering the border and the background and renders them using primitives instead.

It provides two methods for drawing the border and the background:

  • draw_device_text_box -- when device fonts are used,
  • draw_text_box -- when fonts are embedded.

In order to draw the border properly new methods have been added:

  • draw_line -- for drawing a single line (always 1px thick),
  • draw_line_rect -- for drawing a rectangle using lines (always 1px thick).

These primitives have been implemented for wgpu, WebGL, and canvas.

Before After

Additional notes:

  • draw_line added in this PR may also be used for rendering the selection caret in the future.

Related to https://github.com/ruffle-rs/ruffle/issues/15003, https://github.com/ruffle-rs/ruffle/issues/1881 (the border is not being transformed anymore).

kjarosh avatar Jun 06 '24 16:06 kjarosh