OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/gfx/canvas_skia.h" | 5 #include "ui/gfx/canvas_skia.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include <cairo/cairo.h> | 9 #include <cairo/cairo.h> |
10 #include <pango/pango.h> | 10 #include <pango/pango.h> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 } | 111 } |
112 | 112 |
113 void DrawStringContext::Draw(const SkColor& text_color) { | 113 void DrawStringContext::Draw(const SkColor& text_color) { |
114 DrawPangoLayout(cr_, layout_, font_, bounds_, text_rect_, text_color, | 114 DrawPangoLayout(cr_, layout_, font_, bounds_, text_rect_, text_color, |
115 text_direction_, flags_); | 115 text_direction_, flags_); |
116 } | 116 } |
117 | 117 |
118 void DrawStringContext::DrawWithHalo(const SkColor& text_color, | 118 void DrawStringContext::DrawWithHalo(const SkColor& text_color, |
119 const SkColor& halo_color) { | 119 const SkColor& halo_color) { |
120 gfx::CanvasSkia text_canvas(bounds_.width() + 2, bounds_.height() + 2, false); | 120 gfx::CanvasSkia text_canvas(bounds_.width() + 2, bounds_.height() + 2, false); |
121 text_canvas.FillRectInt(static_cast<SkColor>(0), | 121 text_canvas.FillRect( |
122 0, 0, bounds_.width() + 2, bounds_.height() + 2); | 122 static_cast<SkColor>(0), |
Peter Kasting
2011/10/27 19:17:29
Nit: OK to leave this on previous line
tfarina
2011/10/27 20:46:03
Done.
| |
123 gfx::Rect(0, 0, bounds_.width() + 2, bounds_.height() + 2)); | |
123 | 124 |
124 { | 125 { |
125 skia::ScopedPlatformPaint scoped_platform_paint(text_canvas.sk_canvas()); | 126 skia::ScopedPlatformPaint scoped_platform_paint(text_canvas.sk_canvas()); |
126 cairo_t* text_cr = scoped_platform_paint.GetPlatformSurface(); | 127 cairo_t* text_cr = scoped_platform_paint.GetPlatformSurface(); |
127 | 128 |
128 // TODO: The current approach (stroking the text path to generate the halo | 129 // TODO: The current approach (stroking the text path to generate the halo |
129 // and then filling it for the main text) won't work if |text_color| is | 130 // and then filling it for the main text) won't work if |text_color| is |
130 // non-opaque. If we need to do this at some later point, | 131 // non-opaque. If we need to do this at some later point, |
131 // http://lists.freedesktop.org/archives/cairo/2004-September/001829.html | 132 // http://lists.freedesktop.org/archives/cairo/2004-September/001829.html |
132 // suggests "do[ing] the stroke and fill with opaque paint onto an | 133 // suggests "do[ing] the stroke and fill with opaque paint onto an |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 cairo_paint(cr); | 277 cairo_paint(cr); |
277 } | 278 } |
278 #endif // defined(TOOLKIT_USES_GTK) | 279 #endif // defined(TOOLKIT_USES_GTK) |
279 | 280 |
280 ui::TextureID CanvasSkia::GetTextureID() { | 281 ui::TextureID CanvasSkia::GetTextureID() { |
281 // TODO(wjmaclean) | 282 // TODO(wjmaclean) |
282 return 0; | 283 return 0; |
283 } | 284 } |
284 | 285 |
285 } // namespace gfx | 286 } // namespace gfx |
OLD | NEW |