Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: ui/gfx/canvas.h

Issue 1428623005: views::Border: Added CreateRoundedRectBorder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@boxlayout-collapse_when_hidden
Patch Set: Explain why the float version is preferred. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/gfx/canvas.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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. NOTE: The RectF version is preferred because the
253 // rectangle should be painted at a half-pixel offset when painting with
254 // odd-numbered thickness.
Evan Stade 2015/11/10 00:34:32 I don't even think you need to write this much. I'
Matt Giuca 2015/11/10 00:53:15 Done.
255 void DrawRoundRect(const Rect& rect, int radius, const SkPaint& paint);
256
257 // Draws the given rectangle with rounded corners of |radius| using the
251 // given |paint| parameters. 258 // given |paint| parameters.
252 void DrawRoundRect(const Rect& rect, int radius, const SkPaint& paint); 259 void DrawRoundRect(const RectF& rect, float radius, const SkPaint& paint);
253 260
254 // Draws the given path using the given |paint| parameters. 261 // Draws the given path using the given |paint| parameters.
255 void DrawPath(const SkPath& path, const SkPaint& paint); 262 void DrawPath(const SkPath& path, const SkPaint& paint);
256 263
257 // Draws an image with the origin at the specified location. The upper left 264 // Draws an image with the origin at the specified location. The upper left
258 // corner of the bitmap is rendered at the specified location. 265 // corner of the bitmap is rendered at the specified location.
259 // Parameters are specified relative to current canvas scale not in pixels. 266 // Parameters are specified relative to current canvas scale not in pixels.
260 // Thus, x is 2 pixels if canvas scale = 2 & |x| = 1. 267 // Thus, x is 2 pixels if canvas scale = 2 & |x| = 1.
261 void DrawImageInt(const ImageSkia&, int x, int y); 268 void DrawImageInt(const ImageSkia&, int x, int y);
262 269
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 444
438 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; 445 skia::RefPtr<skia::PlatformCanvas> owned_canvas_;
439 SkCanvas* canvas_; 446 SkCanvas* canvas_;
440 447
441 DISALLOW_COPY_AND_ASSIGN(Canvas); 448 DISALLOW_COPY_AND_ASSIGN(Canvas);
442 }; 449 };
443 450
444 } // namespace gfx 451 } // namespace gfx
445 452
446 #endif // UI_GFX_CANVAS_H_ 453 #endif // UI_GFX_CANVAS_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698