Commit 3294e997 authored by David Black's avatar David Black Committed by Chromium LUCI CQ

Fix white paint artifacts around holding space images.

Before: http://shortn/_L6D4o1zrki
After: http://shortn/_MuXhA5lF6T

Bug: 1163326
Change-Id: Ifed54414f0adfabc289d9f90f665226a7300d099
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612050
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840429}
parent 38212843
......@@ -155,12 +155,18 @@ class DragImageItemView : public views::View {
}
void OnPaintBackground(gfx::Canvas* canvas) override {
// NOTE: The contents bounds are shrunk by a single pixel to avoid
// painting the background outside content bounds as might otherwise occur
// due to pixel rounding. Failure to do so could result in white paint
// artifacts.
gfx::Rect bounds(GetContentsBounds());
bounds.Inset(gfx::Insets(1));
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(SK_ColorWHITE);
flags.setLooper(gfx::CreateShadowDrawLooper(GetShadowDetails().values));
canvas->DrawRoundRect(GetContentsBounds(), kDragImageItemViewCornerRadius,
flags);
canvas->DrawRoundRect(bounds, kDragImageItemViewCornerRadius, flags);
}
private:
......
......@@ -313,12 +313,16 @@ void HoldingSpaceTrayIconPreview::OnPaintLayer(
gfx::Canvas* canvas = recorder.canvas();
// Background.
// NOTE: The background radius is shrunk by a single pixel to avoid being
// painted outside `contents_image_` bounds as might otherwise occur due to
// pixel rounding. Failure to do so could result in white paint artifacts.
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(SK_ColorWHITE);
canvas->DrawCircle(
contents_bounds.CenterPoint(),
std::min(contents_bounds.width(), contents_bounds.height()) / 2, flags);
std::min(contents_bounds.width(), contents_bounds.height()) / 2 - 1,
flags);
// Contents.
if (!contents_image_.isNull()) {
......
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