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

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

Issue 2654853002: Remove gfx::Canvas::DrawStringRectWithHalo. (Closed)
Patch Set: Created 3 years, 10 months 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 NO_ELLIPSIS = 1 << 7, 66 NO_ELLIPSIS = 1 << 7,
67 67
68 // Specifies if words can be split by new lines. 68 // Specifies if words can be split by new lines.
69 // This only works with MULTI_LINE. 69 // This only works with MULTI_LINE.
70 CHARACTER_BREAK = 1 << 8, 70 CHARACTER_BREAK = 1 << 8,
71 71
72 // Instructs DrawStringRect() to not use subpixel rendering. This is useful 72 // Instructs DrawStringRect() to not use subpixel rendering. This is useful
73 // when rendering text onto a fully- or partially-transparent background 73 // when rendering text onto a fully- or partially-transparent background
74 // that will later be blended with another image. 74 // that will later be blended with another image.
75 NO_SUBPIXEL_RENDERING = 1 << 9, 75 NO_SUBPIXEL_RENDERING = 1 << 9,
76
77 // Draw text with 1px border.
78 HALO_EFFECT = 1 << 10,
79 }; 76 };
80 77
81 // Creates an empty canvas with image_scale of 1x. 78 // Creates an empty canvas with image_scale of 1x.
82 Canvas(); 79 Canvas();
83 80
84 // Creates canvas with provided DIP |size| and |image_scale|. 81 // Creates canvas with provided DIP |size| and |image_scale|.
85 // If this canvas is not opaque, it's explicitly cleared to transparent before 82 // If this canvas is not opaque, it's explicitly cleared to transparent before
86 // being returned. 83 // being returned.
87 Canvas(const Size& size, float image_scale, bool is_opaque); 84 Canvas(const Size& size, float image_scale, bool is_opaque);
88 85
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 138
142 // Returns the default text alignment to be used when drawing text on a 139 // Returns the default text alignment to be used when drawing text on a
143 // Canvas based on the directionality of the system locale language. 140 // Canvas based on the directionality of the system locale language.
144 // This function is used by Canvas::DrawStringRect when the text alignment 141 // This function is used by Canvas::DrawStringRect when the text alignment
145 // is not specified. 142 // is not specified.
146 // 143 //
147 // This function returns either Canvas::TEXT_ALIGN_LEFT or 144 // This function returns either Canvas::TEXT_ALIGN_LEFT or
148 // Canvas::TEXT_ALIGN_RIGHT. 145 // Canvas::TEXT_ALIGN_RIGHT.
149 static int DefaultCanvasTextAlignment(); 146 static int DefaultCanvasTextAlignment();
150 147
151 // Draws text with a 1-pixel halo around it of the given color.
152 // On Windows, it allows ClearType to be drawn to an otherwise transparent
153 // bitmap for drag images. Drag images have only 1-bit of transparency, so
154 // we don't do any fancy blurring.
155 // On Linux, text with halo is created by stroking it with 2px |halo_color|
156 // then filling it with |text_color|.
157 // On Mac, NOTIMPLEMENTED.
158 // TODO(dhollowa): Skia-native implementation is underway. Cut over to
159 // that when ready. http::/crbug.com/109946
160 void DrawStringRectWithHalo(const base::string16& text,
161 const FontList& font_list,
162 SkColor text_color,
163 SkColor halo_color,
164 const Rect& display_rect,
165 int flags);
166
167 // Extracts an ImageSkiaRep from the contents of this canvas. 148 // Extracts an ImageSkiaRep from the contents of this canvas.
168 ImageSkiaRep ExtractImageRep() const; 149 ImageSkiaRep ExtractImageRep() const;
169 150
170 // Draws a dashed rectangle of the specified color. 151 // Draws a dashed rectangle of the specified color.
171 // DEPRECATED in favor of the RectF version below. 152 // DEPRECATED in favor of the RectF version below.
172 // TODO(funkysidd): Remove this (http://crbug.com/553726) 153 // TODO(funkysidd): Remove this (http://crbug.com/553726)
173 void DrawDashedRect(const Rect& rect, SkColor color); 154 void DrawDashedRect(const Rect& rect, SkColor color);
174 155
175 // Draws a dashed rectangle of the specified color. 156 // Draws a dashed rectangle of the specified color.
176 void DrawDashedRect(const RectF& rect, SkColor color); 157 void DrawDashedRect(const RectF& rect, SkColor color);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 // but surface_ will be null. 481 // but surface_ will be null.
501 sk_sp<SkSurface> surface_; 482 sk_sp<SkSurface> surface_;
502 SkCanvas* canvas_; 483 SkCanvas* canvas_;
503 484
504 DISALLOW_COPY_AND_ASSIGN(Canvas); 485 DISALLOW_COPY_AND_ASSIGN(Canvas);
505 }; 486 };
506 487
507 } // namespace gfx 488 } // namespace gfx
508 489
509 #endif // UI_GFX_CANVAS_H_ 490 #endif // UI_GFX_CANVAS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698