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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "skia/ext/platform_canvas.h" | 15 #include "skia/ext/platform_canvas.h" |
16 #include "third_party/skia/include/core/SkRefCnt.h" | 16 #include "third_party/skia/include/core/SkRefCnt.h" |
17 #include "ui/gfx/image/image_skia.h" | 17 #include "ui/gfx/image/image_skia.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
19 #include "ui/gfx/shadow_value.h" | 19 #include "ui/gfx/shadow_value.h" |
20 #include "ui/gfx/text_constants.h" | 20 #include "ui/gfx/text_constants.h" |
21 | 21 |
22 namespace gfx { | 22 namespace gfx { |
23 | 23 |
24 class Rect; | 24 class Rect; |
25 class RectF; | 25 class RectF; |
26 class FontList; | 26 class FontList; |
27 class Point; | 27 class Point; |
| 28 class PointF; |
28 class Size; | 29 class Size; |
29 class Transform; | 30 class Transform; |
30 | 31 |
31 // Canvas is a SkCanvas wrapper that provides a number of methods for | 32 // Canvas is a SkCanvas wrapper that provides a number of methods for |
32 // common operations used throughout an application built using ui/gfx. | 33 // common operations used throughout an application built using ui/gfx. |
33 // | 34 // |
34 // All methods that take integer arguments (as is used throughout views) | 35 // All methods that take integer arguments (as is used throughout views) |
35 // end with Int. If you need to use methods provided by SkCanvas, you'll | 36 // end with Int. If you need to use methods provided by SkCanvas, you'll |
36 // need to do a conversion. In particular you'll need to use |SkIntToScalar()|, | 37 // need to do a conversion. In particular you'll need to use |SkIntToScalar()|, |
37 // or if converting from a scalar to an integer |SkScalarRound()|. | 38 // or if converting from a scalar to an integer |SkScalarRound()|. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void DrawRect(const Rect& rect, SkColor color, SkXfermode::Mode mode); | 235 void DrawRect(const Rect& rect, SkColor color, SkXfermode::Mode mode); |
235 | 236 |
236 // Draws the given rectangle with the given |paint| parameters. | 237 // Draws the given rectangle with the given |paint| parameters. |
237 void DrawRect(const Rect& rect, const SkPaint& paint); | 238 void DrawRect(const Rect& rect, const SkPaint& paint); |
238 | 239 |
239 // Draw the given point with the given |paint| parameters. | 240 // Draw the given point with the given |paint| parameters. |
240 void DrawPoint(const Point& p, const SkPaint& paint); | 241 void DrawPoint(const Point& p, const SkPaint& paint); |
241 | 242 |
242 // Draws a single pixel line with the specified color. | 243 // Draws a single pixel line with the specified color. |
243 void DrawLine(const Point& p1, const Point& p2, SkColor color); | 244 void DrawLine(const Point& p1, const Point& p2, SkColor color); |
| 245 void DrawLine(const PointF& p1, const PointF& p2, SkColor color); |
244 | 246 |
245 // Draws a line with the given |paint| parameters. | 247 // Draws a line with the given |paint| parameters. |
246 void DrawLine(const Point& p1, const Point& p2, const SkPaint& paint); | 248 void DrawLine(const Point& p1, const Point& p2, const SkPaint& paint); |
| 249 void DrawLine(const PointF& p1, const PointF& p2, const SkPaint& paint); |
247 | 250 |
248 // Draws a circle with the given |paint| parameters. | 251 // Draws a circle with the given |paint| parameters. |
249 void DrawCircle(const Point& center_point, | 252 void DrawCircle(const Point& center_point, |
250 int radius, | 253 int radius, |
251 const SkPaint& paint); | 254 const SkPaint& paint); |
252 | 255 |
253 // Draws the given rectangle with rounded corners of |radius| using the | 256 // Draws the given rectangle with rounded corners of |radius| using the |
254 // given |paint| parameters. DEPRECATED in favor of the RectF version below. | 257 // given |paint| parameters. DEPRECATED in favor of the RectF version below. |
255 // TODO(mgiuca): Remove this (http://crbug.com/553726). | 258 // TODO(mgiuca): Remove this (http://crbug.com/553726). |
256 void DrawRoundRect(const Rect& rect, int radius, const SkPaint& paint); | 259 void DrawRoundRect(const Rect& rect, int radius, const SkPaint& paint); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 float image_scale_; | 453 float image_scale_; |
451 | 454 |
452 sk_sp<SkCanvas> canvas_; | 455 sk_sp<SkCanvas> canvas_; |
453 | 456 |
454 DISALLOW_COPY_AND_ASSIGN(Canvas); | 457 DISALLOW_COPY_AND_ASSIGN(Canvas); |
455 }; | 458 }; |
456 | 459 |
457 } // namespace gfx | 460 } // namespace gfx |
458 | 461 |
459 #endif // UI_GFX_CANVAS_H_ | 462 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |