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

Side by Side Diff: ui/gfx/canvas.h

Issue 1425163002: gfx: Rename canvas SaveAndUnscale to UnscaleTheDeviceScaleFactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ninepatchscale
Patch Set: scopedunscale: . Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | ui/gfx/canvas.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_CANVAS_H_ 5 #ifndef UI_GFX_CANVAS_H_
6 #define UI_GFX_CANVAS_H_ 6 #define UI_GFX_CANVAS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 SkColor halo_color, 158 SkColor halo_color,
159 const Rect& display_rect, 159 const Rect& display_rect,
160 int flags); 160 int flags);
161 161
162 // Extracts an ImageSkiaRep from the contents of this canvas. 162 // Extracts an ImageSkiaRep from the contents of this canvas.
163 ImageSkiaRep ExtractImageRep() const; 163 ImageSkiaRep ExtractImageRep() const;
164 164
165 // Draws a dashed rectangle of the specified color. 165 // Draws a dashed rectangle of the specified color.
166 void DrawDashedRect(const Rect& rect, SkColor color); 166 void DrawDashedRect(const Rect& rect, SkColor color);
167 167
168 // Unscales by the image scale factor (aka device scale factor), and returns
169 // that factor. This is useful when callers want to draw directly in the
170 // native scale.
171 float UndoDeviceScaleFactor();
172
168 // Saves a copy of the drawing state onto a stack, operating on this copy 173 // Saves a copy of the drawing state onto a stack, operating on this copy
169 // until a balanced call to Restore() is made. 174 // until a balanced call to Restore() is made.
170 void Save(); 175 void Save();
171 176
172 // Saves the drawing state, unscales by the image scale factor, and returns
173 // that factor. This is useful when callers want to draw directly in the
174 // native scale.
175 float SaveAndUnscale();
176
177 // As with Save(), except draws to a layer that is blended with the canvas 177 // As with Save(), except draws to a layer that is blended with the canvas
178 // at the specified alpha once Restore() is called. 178 // at the specified alpha once Restore() is called.
179 // |layer_bounds| are the bounds of the layer relative to the current 179 // |layer_bounds| are the bounds of the layer relative to the current
180 // transform. 180 // transform.
181 void SaveLayerAlpha(uint8 alpha); 181 void SaveLayerAlpha(uint8 alpha);
182 void SaveLayerAlpha(uint8 alpha, const Rect& layer_bounds); 182 void SaveLayerAlpha(uint8 alpha, const Rect& layer_bounds);
183 183
184 // Restores the drawing state after a call to Save*(). It is an error to 184 // Restores the drawing state after a call to Save*(). It is an error to
185 // call Restore() more times than Save*(). 185 // call Restore() more times than Save*().
186 void Restore(); 186 void Restore();
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; 434 skia::RefPtr<skia::PlatformCanvas> owned_canvas_;
435 SkCanvas* canvas_; 435 SkCanvas* canvas_;
436 436
437 DISALLOW_COPY_AND_ASSIGN(Canvas); 437 DISALLOW_COPY_AND_ASSIGN(Canvas);
438 }; 438 };
439 439
440 } // namespace gfx 440 } // namespace gfx
441 441
442 #endif // UI_GFX_CANVAS_H_ 442 #endif // UI_GFX_CANVAS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | ui/gfx/canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698