Skip to content

Fix documentation errors in Android.Graphics Canvas (R040b) - #1656

Merged
jonathanpeppers merged 3 commits into
mainfrom
jonathanpeppers-review-r040b-canvas-follow-up
Nov 20, 2026
Merged

jonathanpeppers merged 3 commits into
mainfrom
jonathanpeppers-review-r040b-canvas-follow-up

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Scope

Follow-up review item R040b: docs/xml/Android.Graphics/Canvas.xml. It fixes the two members that had the same errors that #1645 fixed in sibling RecordingCanvas.xml, plus two related findings in the same file (scope extended by the campaign coordinator).

Fixes

Source: source-37.2_r01.zip (SHA256 9D637C3AF6654A2F1B696B3D19C54BB77E38DF2B0106116934703F314B3D4E84).

  1. Canvas.DrawBitmap(int[], int, int, int, int, int, int, bool, Paint) hasAlpha: the AI text limited the behavior to "the Android 16 implementation", which is the wrong scope for these API 37 docs. The int overload calls the float overload (Canvas.java:1688-1696, BaseCanvas.java:216-221), which sends hasAlpha to nDrawBitmap (BaseCanvas.java:187-213). The new text is the official @param hasAlpha text of the float overload (Canvas.java:1669-1670), the same as Fix documentation errors in Android.Graphics (R138) #1645.
  2. Canvas.DrawDoubleRoundRect(RectF, float, float, RectF, float, float, Paint) innerRy: "outer rectangle" changed to "inner rectangle". This is an upstream Javadoc typo (Canvas.java:2086). BaseCanvas.java:412-428 sends innerRx and innerRy with the inner bounds to the inner parameters of nDrawDoubleRoundRect (BaseCanvas.java:797-800). The sibling innerRx text says "inner".
  3. Canvas.ClipRegion(Region, Region.Op) returns: the old text said "The Android 16 base compatibility implementation returns false without changing the clip". That is wrong on the API levels where the member is supported (it has [UnsupportedOSPlatform("android26.0")]). Before API level 26 it called native_clipRegion and returned whether the resulting clip is non-empty (AOSP android-7.1.2_r1 Canvas.java). From API level 26 it is a @removed stub that returns false (AOSP android-8.0.0_r1 Canvas.java; source-37.2_r01.zip Canvas.java:1110-1114). New text: true if the resulting clip is non-empty; on API level 26 and later the method does not change the clip and returns false. This agrees with the one-argument ClipRegion(Region).
  4. Canvas.DrawDoubleRoundRect(RectF, float[], RectF, float[], Paint) innerRadii: "outer rounded rectangle" changed to "inner rounded rectangle". This is an upstream Javadoc typo (Canvas.java:2105-2112). BaseCanvas.java:433-452 sends innerRadii with the inner bounds to the inner parameters of nDrawDoubleRoundRect (BaseCanvas.java:802-804).

Uncertain findings

None.

Checks

  • Changed XML parses; git diff --check is clean; no new placeholders; BOM and CRLF line endings kept; 4-line diff.
  • Rubber-duck reviews (gemini-4-argon) for all three commits: no findings.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 07:18
@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) November 20, 2026 07:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the Canvas parameter documentation corrections.

No open issues 🎉

What changed in this PR

Corrects two parameter descriptions in Android.Graphics.Canvas, aligning them with the sibling RecordingCanvas fixes in #1645. This PR changes documentation only.

Changes:

  • Replaces the Android 16-specific hasAlpha description with the official alpha-channel behavior.
  • Corrects innerRy to refer to the inner rectangle rather than the outer rectangle.
File Description
docs/​xml/​Android.Graphics/​Canvas.xml Corrects parameter documentation for DrawBitmap and DrawDoubleRoundRect.

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The documentation-only corrections in Canvas.xml have no outstanding review issues.

No open issues 🎉

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed 2dc1949f against main at 283f094d. This is a static, read-only review.

  • DrawBitmap(int[], int, int, int, int, int, int, bool, Paint) hasAlpha: the new text is the upstream @param hasAlpha of the float overload. The int overload forwards to it through BaseCanvas.drawBitmap and nDrawBitmap, and the text now matches RecordingCanvas.xml.
  • DrawDoubleRoundRect innerRy and innerRadii: "inner" is correct. BaseCanvas.drawDoubleRoundRect passes innerRx/innerRy and innerRadii with the inner bounds to the inner parameters of nDrawDoubleRoundRect, so the upstream "outer" wording is a Javadoc typo.
  • Blocking, Canvas.xml:1048 (ClipRegion(Region, Region.Op) returns): with "Android 16" removed, the text now says the method always returns false without changing the clip. That return false; body is the stub added when the API became @removed in API level 26 (android-8.0.0_r1 Canvas.java:981-984; both overloads are in core/api/removed.txt). Before API level 26 it called native_clipRegion(...) and returned whether the resulting clip is non-empty (android-7.1.2_r1 Canvas.java:818-821).
  • This member is marked [UnsupportedOSPlatform("android26.0")], so the new text is wrong on every API level where it is supported. It also contradicts the one-argument ClipRegion(Region) at Canvas.xml:986, which has the same history and says "true if the resulting is non-empty".
  • Suggested fix: restore the upstream return text, for example <see langword="true" /> if the resulting clip is non-empty., optionally followed by a note that on API level 26 and later the method does not change the clip and returns <see langword="false" />.
  • The rest of the diff is clean. The four single-line replacements parse, BOM state and line endings are unchanged, and Canvas.xml has not changed on main after the merge base b91969a6.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers

Copy link
Copy Markdown
Member Author

Thanks. Fixed in c420847: the ClipRegion(Region, Region.Op) returns text now says true if the resulting clip is non-empty, and that on API level 26 and later the method does not change the clip and returns false. Verified against AOSP android-7.1.2_r1 (native_clipRegion) and android-8.0.0_r1 (@removed stub).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the Canvas documentation corrections.

No open issues 🎉

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed c4208472 against main at ab3994d8. This is a static, read-only review.

  • The blocker from my earlier review is resolved. Canvas.ClipRegion(Region, Region.Op) returns now says true if the resulting clip is non-empty, and that on API level 26 and later the method does not change the clip and returns false. This matches android-7.1.2_r1 Canvas.java (@return true if the resulting is non-empty, returns native_clipRegion(...)) and the @removed stub that returns false in android-8.0.0_r1 and current main (listed in core/api/removed.txt). It also matches the member's [UnsupportedOSPlatform("android26.0")] and the ClipRegion(Region) returns text.
  • DrawBitmap(int[], int, int, int, int, int, int, bool, Paint) hasAlpha now uses the official text of the float overload. In BaseCanvas.java the int overload forwards to the float overload, which passes hasAlpha to nDrawBitmap. The text also matches the float overload and RecordingCanvas.xml.
  • DrawDoubleRoundRect innerRadii and innerRy now say "inner" instead of the upstream "outer" typo. BaseCanvas.java passes both values with the inner RectF to nDrawDoubleRoundRect.
  • The diff against the merge base b91969a6 is exactly these 4 lines in docs/xml/Android.Graphics/Canvas.xml. The file still parses, the BOM and line endings are unchanged, and no Android.Graphics file changed on main since the merge base.
  • No blocking issues found.

@jonathanpeppers
jonathanpeppers merged commit c240ab8 into main Nov 20, 2026
4 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-review-r040b-canvas-follow-up branch November 20, 2026 09:21
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.

3 participants