[go: nahoru, domu]

cc: Adjust HUD layer to account for zoom-for-dsf.

This patch updates the coordinate spaces of the HUD layer so that
they work consistently with or without zoom-for-dsf, which uses
painted_device_scale_factor and provides sizes in physical coordinates
(ie layout coordinates) instead of DIPS.

The HUD code paints things in DIPs, so this patch updates the drawing
code to also be aware that there are two spaces at play here.

R=szager@chromium.org

Fixed: 1271475
Change-Id: Ifc3aef4093699fca6007bf291c7d5d4e64992ebc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3293481
Commit-Queue: vmpstr <vmpstr@chromium.org>
Reviewed-by: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/main@{#943632}
diff --git a/cc/paint/paint_canvas.h b/cc/paint/paint_canvas.h
index a3e7cd5..5f99d01 100644
--- a/cc/paint/paint_canvas.h
+++ b/cc/paint/paint_canvas.h
@@ -79,6 +79,7 @@
   virtual void restoreToCount(int save_count) = 0;
   virtual void translate(SkScalar dx, SkScalar dy) = 0;
   virtual void scale(SkScalar sx, SkScalar sy) = 0;
+  void scale(SkScalar s) { scale(s, s); }
   virtual void rotate(SkScalar degrees) = 0;
   // TODO(aaronhk): crbug.com/1153330 deprecate these in favor of the SkM44
   // versions.