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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 const FontList& font_list, | 163 const FontList& font_list, |
164 SkColor text_color, | 164 SkColor text_color, |
165 SkColor halo_color, | 165 SkColor halo_color, |
166 const Rect& display_rect, | 166 const Rect& display_rect, |
167 int flags); | 167 int flags); |
168 | 168 |
169 // Extracts an ImageSkiaRep from the contents of this canvas. | 169 // Extracts an ImageSkiaRep from the contents of this canvas. |
170 ImageSkiaRep ExtractImageRep() const; | 170 ImageSkiaRep ExtractImageRep() const; |
171 | 171 |
172 // Draws a dashed rectangle of the specified color. | 172 // Draws a dashed rectangle of the specified color. |
173 // DEPRECATED in favor of the RectF version below. | |
174 // TODO(funkysidd): Remove this (http://crbug.com/553726) | |
175 void DrawDashedRect(const Rect& rect, SkColor color); | |
176 | |
177 // Draws a dashed rectangle of the specified color. | |
178 void DrawDashedRect(const RectF& rect, SkColor color); | 173 void DrawDashedRect(const RectF& rect, SkColor color); |
179 | 174 |
180 // Unscales by the image scale factor (aka device scale factor), and returns | 175 // Unscales by the image scale factor (aka device scale factor), and returns |
181 // that factor. This is useful when callers want to draw directly in the | 176 // that factor. This is useful when callers want to draw directly in the |
182 // native scale. | 177 // native scale. |
183 float UndoDeviceScaleFactor(); | 178 float UndoDeviceScaleFactor(); |
184 | 179 |
185 // Saves a copy of the drawing state onto a stack, operating on this copy | 180 // Saves a copy of the drawing state onto a stack, operating on this copy |
186 // until a balanced call to Restore() is made. | 181 // until a balanced call to Restore() is made. |
187 void Save(); | 182 void Save(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // SkBlendMode::kSrcOver. | 227 // SkBlendMode::kSrcOver. |
233 void FillRect(const Rect& rect, SkColor color); | 228 void FillRect(const Rect& rect, SkColor color); |
234 | 229 |
235 // Fills |rect| with the specified |color| and |mode|. | 230 // Fills |rect| with the specified |color| and |mode|. |
236 void FillRect(const Rect& rect, SkColor color, SkBlendMode mode); | 231 void FillRect(const Rect& rect, SkColor color, SkBlendMode mode); |
237 | 232 |
238 // Draws a single pixel rect in the specified region with the specified | 233 // Draws a single pixel rect in the specified region with the specified |
239 // color, using a transfer mode of SkBlendMode::kSrcOver. | 234 // color, using a transfer mode of SkBlendMode::kSrcOver. |
240 // | 235 // |
241 // NOTE: if you need a single pixel line, use DrawLine. | 236 // NOTE: if you need a single pixel line, use DrawLine. |
242 // DEPRECATED in favor of the RectF version below. | |
243 // TODO(funkysidd): Remove this (http://crbug.com/553726) | |
244 void DrawRect(const Rect& rect, SkColor color); | |
245 | |
246 // Draws a single pixel rect in the specified region with the specified | |
247 // color, using a transfer mode of SkBlendMode::kSrcOver. | |
248 // | |
249 // NOTE: if you need a single pixel line, use DrawLine. | |
250 void DrawRect(const RectF& rect, SkColor color); | 237 void DrawRect(const RectF& rect, SkColor color); |
251 | 238 |
252 // Draws a single pixel rect in the specified region with the specified | 239 // Draws a single pixel rect in the specified region with the specified |
253 // color and transfer mode. | 240 // color and transfer mode. |
254 // | 241 // |
255 // NOTE: if you need a single pixel line, use DrawLine. | 242 // NOTE: if you need a single pixel line, use DrawLine. |
256 // DEPRECATED in favor of the RectF version below. | |
257 // TODO(funkysidd): Remove this (http://crbug.com/553726) | |
258 void DrawRect(const Rect& rect, SkColor color, SkBlendMode mode); | |
259 | |
260 // Draws a single pixel rect in the specified region with the specified | |
261 // color and transfer mode. | |
262 // | |
263 // NOTE: if you need a single pixel line, use DrawLine. | |
264 void DrawRect(const RectF& rect, SkColor color, SkBlendMode mode); | 243 void DrawRect(const RectF& rect, SkColor color, SkBlendMode mode); |
265 | 244 |
266 // Draws the given rectangle with the given |flags| parameters. | 245 // Draws the given rectangle with the given |flags| parameters. |
267 // DEPRECATED in favor of the RectF version below. | 246 // DEPRECATED in favor of the RectF version below. |
268 // TODO(funkysidd): Remove this (http://crbug.com/553726) | 247 // TODO(funkysidd): Remove this (http://crbug.com/553726) |
269 void DrawRect(const Rect& rect, const cc::PaintFlags& flags); | 248 void DrawRect(const Rect& rect, const cc::PaintFlags& flags); |
270 | 249 |
271 // Draws the given rectangle with the given |flags| parameters. | 250 // Draws the given rectangle with the given |flags| parameters. |
272 void DrawRect(const RectF& rect, const cc::PaintFlags& flags); | 251 void DrawRect(const RectF& rect, const cc::PaintFlags& flags); |
273 | 252 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 base::Optional<SkBitmap> bitmap_; | 495 base::Optional<SkBitmap> bitmap_; |
517 base::Optional<cc::SkiaPaintCanvas> owned_canvas_; | 496 base::Optional<cc::SkiaPaintCanvas> owned_canvas_; |
518 cc::PaintCanvas* canvas_; | 497 cc::PaintCanvas* canvas_; |
519 | 498 |
520 DISALLOW_COPY_AND_ASSIGN(Canvas); | 499 DISALLOW_COPY_AND_ASSIGN(Canvas); |
521 }; | 500 }; |
522 | 501 |
523 } // namespace gfx | 502 } // namespace gfx |
524 | 503 |
525 #endif // UI_GFX_CANVAS_H_ | 504 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |