Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: ui/gfx/canvas.cc

Issue 1393013007: Add a Canvas::SaveAndUnscale() method for pixel-accurate drawing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/canvas.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas.cc
diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc
index 49e32350a42e45c8c498aa7cd00534f6c578b4fb..503cee00e9a7b8ef12c29d0e8653dbacfd4ec106 100644
--- a/ui/gfx/canvas.cc
+++ b/ui/gfx/canvas.cc
@@ -180,6 +180,13 @@ void Canvas::Save() {
canvas_->save();
}
+float Canvas::SaveAndUnscale() {
sky 2015/10/13 22:23:11 How expensive is save? The common case is scale=1.
Peter Kasting 2015/10/13 22:34:42 Save() is very cheap. Also we can't get rid of it
+ Save();
+ SkScalar scale_factor = 1.0f / image_scale_;
sky 2015/10/13 22:23:11 I'm not familiar enough with what we want to happe
Peter Kasting 2015/10/13 22:34:42 I did, but I'm not convinced that's what we actual
+ canvas_->scale(scale_factor, scale_factor);
+ return image_scale_;
+}
+
void Canvas::SaveLayerAlpha(uint8 alpha) {
canvas_->saveLayerAlpha(NULL, alpha);
}
« no previous file with comments | « ui/gfx/canvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698