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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Saves a copy of the drawing state onto a stack, operating on this copy | 168 // Saves a copy of the drawing state onto a stack, operating on this copy |
169 // until a balanced call to Restore() is made. | 169 // until a balanced call to Restore() is made. |
170 void Save(); | 170 void Save(); |
171 | 171 |
| 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 |
172 // 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 |
173 // at the specified alpha once Restore() is called. | 178 // at the specified alpha once Restore() is called. |
174 // |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 |
175 // transform. | 180 // transform. |
176 void SaveLayerAlpha(uint8 alpha); | 181 void SaveLayerAlpha(uint8 alpha); |
177 void SaveLayerAlpha(uint8 alpha, const Rect& layer_bounds); | 182 void SaveLayerAlpha(uint8 alpha, const Rect& layer_bounds); |
178 | 183 |
179 // 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 |
180 // call Restore() more times than Save*(). | 185 // call Restore() more times than Save*(). |
181 void Restore(); | 186 void Restore(); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 445 |
441 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; | 446 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; |
442 SkCanvas* canvas_; | 447 SkCanvas* canvas_; |
443 | 448 |
444 DISALLOW_COPY_AND_ASSIGN(Canvas); | 449 DISALLOW_COPY_AND_ASSIGN(Canvas); |
445 }; | 450 }; |
446 | 451 |
447 } // namespace gfx | 452 } // namespace gfx |
448 | 453 |
449 #endif // UI_GFX_CANVAS_H_ | 454 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |