Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 UnscaleTheDeviceScaleFactor(); | |
|
Peter Kasting
2015/10/29 23:11:10
This name is so verbose it reads poorly. How abou
sky
2015/10/29 23:37:54
+1 to Peter's first suggestion UndoDeviceScale.
danakj
2015/10/30 17:51:21
Done. I used UndoDeviceScaleFactor(), because we n
| |
| 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 Loading... | |
| 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_ |
| OLD | NEW |