Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@prophetofxenu
Copy link

Fixes #9279

Previously the parameters of lv_canvas_copy_buf implied it copies data from a canvas to a second buffer. In reality, it copies from the second buffer to the canvas. I have updated these parameters to align with what is happening.

Also, the canvas widget main page mentioned this function, but the signature was out of date. I have updated this as well.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

Hi 👋, thank you for your PR!

We've run benchmarks in an emulated environment. Here are the results:

ARM Emulated 32b - lv_conf_perf32b

Scene Name Avg CPU (%) Avg FPS Avg Time (ms) Render Time (ms) Flush Time (ms)
All scenes avg. 28 37 7 7 0
Detailed Results Per Scene
Scene Name Avg CPU (%) Avg FPS Avg Time (ms) Render Time (ms) Flush Time (ms)
Empty screen 11 33 0 0 0
Moving wallpaper 2 33 1 1 0
Single rectangle 0 50 0 0 0
Multiple rectangles 0 33 0 0 0
Multiple RGB images 0 39 0 0 0
Multiple ARGB images 9 42 2 2 0
Rotated ARGB images 56 44 15 15 0
Multiple labels 6 35 0 0 0
Screen sized text 97 47 20 20 0
Multiple arcs 32 33 7 7 0
Containers 4 36 (-1) 0 0 0
Containers with overlay 88 21 44 44 0
Containers with opa 16 37 1 1 0
Containers with opa_layer 17 34 5 5 0
Containers with scrolling 45 46 (+1) 12 12 0
Widgets demo 70 40 (+1) 16 16 0
All scenes avg. 28 37 7 7 0

ARM Emulated 64b - lv_conf_perf64b

Scene Name Avg CPU (%) Avg FPS Avg Time (ms) Render Time (ms) Flush Time (ms)
All scenes avg. 24 (-1) 37 6 6 0
Detailed Results Per Scene
Scene Name Avg CPU (%) Avg FPS Avg Time (ms) Render Time (ms) Flush Time (ms)
Empty screen 11 33 0 0 0
Moving wallpaper 1 33 0 0 0
Single rectangle 0 50 0 0 0
Multiple rectangles 0 35 0 0 0
Multiple RGB images 0 39 0 0 0
Multiple ARGB images 6 (-3) 42 (+2) 0 0 0
Rotated ARGB images 30 (-2) 33 9 9 0
Multiple labels 1 35 (+2) 0 0 0
Screen sized text 84 (+1) 46 18 18 0
Multiple arcs 32 (-8) 33 7 (+1) 7 (+1) 0
Containers 1 (-3) 38 (+1) 0 0 0
Containers with overlay 98 (+10) 23 41 41 0
Containers with opa 6 (-9) 36 (-2) 1 1 0
Containers with opa_layer 9 (+1) 35 (-2) 2 (+1) 2 (+1) 0
Containers with scrolling 44 (-2) 46 (-1) 11 (-1) 11 (-1) 0
Widgets demo 66 41 15 15 0
All scenes avg. 24 (-1) 37 6 6 0

Disclaimer: These benchmarks were run in an emulated environment using QEMU with instruction counting mode.
The timing values represent relative performance metrics within this specific virtualized setup and should
not be interpreted as absolute real-world performance measurements. Values are deterministic and useful for
comparing different LVGL features and configurations, but may not correlate directly with performance on
physical hardware. The measurements are intended for comparative analysis only.


🤖 This comment was automatically generated by a bot.

@prophetofxenu prophetofxenu marked this pull request as ready for review December 16, 2025 01:11
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

Prompt for AI agents (all 2 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="docs/src/widgets/canvas.rst">

<violation number="1" location="docs/src/widgets/canvas.rst:76">
P2: Documentation inaccuracy: the assertion in `lv_canvas_copy_buf` requires `canvas_area` to be non-NULL. Only `src_area` can be omitted with NULL, not both areas. Consider clarifying to: &quot;If the buffers are the same size, `src_area` can be omitted with NULL.&quot;</violation>
</file>

<file name="src/widgets/canvas/lv_canvas.h">

<violation number="1" location="src/widgets/canvas/lv_canvas.h:139">
P2: Documentation inconsistency: `src_area` description says &quot;destination buffer&quot; but should say &quot;source buffer&quot; to match the renamed parameter.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@FASTSHIFT FASTSHIFT changed the title Clarify parameter names for lv_canvas_copy_buf fix(canvas): clarify parameter names for lv_canvas_copy_buf Dec 16, 2025
Copy link
Member

@uLipe uLipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except from the bot comments LGTM.

@prophetofxenu
Copy link
Author

@uLipe not sure why the build failed? I dont see any messages besides a general failure.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR clarifies the parameter names of lv_canvas_copy_buf to accurately reflect its behavior: copying data FROM a source buffer TO the canvas, rather than the misleading previous naming that suggested the opposite direction.

Key Changes:

  • Renamed function parameters from dest_buf/dest_area to src_buf/src_area to correctly indicate the copy direction
  • Updated function documentation to clearly describe that data is copied from the source buffer to the canvas
  • Synchronized the documentation example with the updated function signature

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/widgets/canvas/lv_canvas.h Updated function signature and documentation comments to rename parameters from dest_buf/dest_area to src_buf/src_area, clarifying the copy direction
src/widgets/canvas/lv_canvas.c Updated function implementation to use renamed parameters consistently throughout the function body including assertions and the lv_draw_buf_copy call
docs/src/widgets/canvas.rst Updated documentation example to reflect the corrected function signature with proper parameter names

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +75 to +76
color format of the buffer and Canvas need to match. If the canvas area and source buffer
are the same size, the source area can be left NULL.
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording "If the canvas area and source buffer are the same size" could be clearer. Consider aligning with the header documentation which states "If canvas_area and the size of src_buf are the same, src_area can be left NULL." The current wording might be interpreted as comparing areas directly rather than comparing the canvas area with the buffer dimensions.

Suggested change
color format of the buffer and Canvas need to match. If the canvas area and source buffer
are the same size, the source area can be left NULL.
color format of the buffer and Canvas need to match. If ``canvas_area`` and the size of ``src_buf``
are the same, ``src_area`` can be left NULL.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misleading parameter names in lv_canvas_copy_buf

3 participants