| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "skia/ext/platform_canvas.h" | 13 #include "skia/ext/platform_canvas.h" |
| 14 #include "skia/ext/refptr.h" | 14 #include "skia/ext/refptr.h" |
| 15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 #include "ui/gfx/shadow_value.h" | 17 #include "ui/gfx/shadow_value.h" |
| 18 #include "ui/gfx/text_constants.h" | 18 #include "ui/gfx/text_constants.h" |
| 19 | 19 |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 | 21 |
| 22 class Rect; | 22 class Rect; |
| 23 class RectF; |
| 23 class FontList; | 24 class FontList; |
| 24 class Point; | 25 class Point; |
| 25 class Size; | 26 class Size; |
| 26 class Transform; | 27 class Transform; |
| 27 | 28 |
| 28 // Canvas is a SkCanvas wrapper that provides a number of methods for | 29 // Canvas is a SkCanvas wrapper that provides a number of methods for |
| 29 // common operations used throughout an application built using ui/gfx. | 30 // common operations used throughout an application built using ui/gfx. |
| 30 // | 31 // |
| 31 // All methods that take integer arguments (as is used throughout views) | 32 // All methods that take integer arguments (as is used throughout views) |
| 32 // end with Int. If you need to use methods provided by SkCanvas, you'll | 33 // end with Int. If you need to use methods provided by SkCanvas, you'll |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 242 |
| 242 // Draws a line with the given |paint| parameters. | 243 // Draws a line with the given |paint| parameters. |
| 243 void DrawLine(const Point& p1, const Point& p2, const SkPaint& paint); | 244 void DrawLine(const Point& p1, const Point& p2, const SkPaint& paint); |
| 244 | 245 |
| 245 // Draws a circle with the given |paint| parameters. | 246 // Draws a circle with the given |paint| parameters. |
| 246 void DrawCircle(const Point& center_point, | 247 void DrawCircle(const Point& center_point, |
| 247 int radius, | 248 int radius, |
| 248 const SkPaint& paint); | 249 const SkPaint& paint); |
| 249 | 250 |
| 250 // Draws the given rectangle with rounded corners of |radius| using the | 251 // Draws the given rectangle with rounded corners of |radius| using the |
| 252 // given |paint| parameters. DEPRECATED in favor of the RectF version below. |
| 253 // TODO(mgiuca): Remove this (http://crbug.com/553726). |
| 254 void DrawRoundRect(const Rect& rect, int radius, const SkPaint& paint); |
| 255 |
| 256 // Draws the given rectangle with rounded corners of |radius| using the |
| 251 // given |paint| parameters. | 257 // given |paint| parameters. |
| 252 void DrawRoundRect(const Rect& rect, int radius, const SkPaint& paint); | 258 void DrawRoundRect(const RectF& rect, float radius, const SkPaint& paint); |
| 253 | 259 |
| 254 // Draws the given path using the given |paint| parameters. | 260 // Draws the given path using the given |paint| parameters. |
| 255 void DrawPath(const SkPath& path, const SkPaint& paint); | 261 void DrawPath(const SkPath& path, const SkPaint& paint); |
| 256 | 262 |
| 257 // Draws an image with the origin at the specified location. The upper left | 263 // Draws an image with the origin at the specified location. The upper left |
| 258 // corner of the bitmap is rendered at the specified location. | 264 // corner of the bitmap is rendered at the specified location. |
| 259 // Parameters are specified relative to current canvas scale not in pixels. | 265 // Parameters are specified relative to current canvas scale not in pixels. |
| 260 // Thus, x is 2 pixels if canvas scale = 2 & |x| = 1. | 266 // Thus, x is 2 pixels if canvas scale = 2 & |x| = 1. |
| 261 void DrawImageInt(const ImageSkia&, int x, int y); | 267 void DrawImageInt(const ImageSkia&, int x, int y); |
| 262 | 268 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 443 |
| 438 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; | 444 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; |
| 439 SkCanvas* canvas_; | 445 SkCanvas* canvas_; |
| 440 | 446 |
| 441 DISALLOW_COPY_AND_ASSIGN(Canvas); | 447 DISALLOW_COPY_AND_ASSIGN(Canvas); |
| 442 }; | 448 }; |
| 443 | 449 |
| 444 } // namespace gfx | 450 } // namespace gfx |
| 445 | 451 |
| 446 #endif // UI_GFX_CANVAS_H_ | 452 #endif // UI_GFX_CANVAS_H_ |
| OLD | NEW |