Commit 470afe3f authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Center dino within the cleared area in generated sharing QR codes

Bug: 1107690
Change-Id: Ib94f111c3f4080c658f37dd8f25a4d8da751d5a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354905
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Travis Skare <skare@chromium.org>
Reviewed-by: default avatarTravis Skare <skare@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797980}
parent 342f0f7a
......@@ -104,8 +104,14 @@ void QRCodeGeneratorServiceImpl::DrawDino(SkCanvas* canvas,
kModuleSizePixels * kModuleSizePixels,
(dest_rect.bottom() + dino_border_px + kModuleSizePixels - 1) /
kModuleSizePixels * kModuleSizePixels);
canvas->drawRect(background, paint_background);
// Center the dino within the cleared space, and draw it.
SkScalar delta_x =
SkScalarRoundToScalar(background.centerX() - dest_rect.centerX());
SkScalar delta_y =
SkScalarRoundToScalar(background.centerY() - dest_rect.centerY());
dest_rect.offset(delta_x, delta_y);
SkRect dino_bounds;
dino_bitmap_.getBounds(&dino_bounds);
canvas->drawBitmapRect(dino_bitmap_, dino_bounds, dest_rect, nullptr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment