| 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(static_cast<SkColor>(0), |
| 122 0, 0, bounds_.width() + 2, bounds_.height() + 2); | 122 gfx::Rect(0, 0, bounds_.width() + 2, bounds_.height() + 2)); |
| 123 | 123 |
| 124 { | 124 { |
| 125 skia::ScopedPlatformPaint scoped_platform_paint(text_canvas.sk_canvas()); | 125 skia::ScopedPlatformPaint scoped_platform_paint(text_canvas.sk_canvas()); |
| 126 cairo_t* text_cr = scoped_platform_paint.GetPlatformSurface(); | 126 cairo_t* text_cr = scoped_platform_paint.GetPlatformSurface(); |
| 127 | 127 |
| 128 // TODO: The current approach (stroking the text path to generate the halo | 128 // 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 | 129 // 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, | 130 // non-opaque. If we need to do this at some later point, |
| 131 // http://lists.freedesktop.org/archives/cairo/2004-September/001829.html | 131 // http://lists.freedesktop.org/archives/cairo/2004-September/001829.html |
| 132 // suggests "do[ing] the stroke and fill with opaque paint onto an | 132 // 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); | 276 cairo_paint(cr); |
| 277 } | 277 } |
| 278 #endif // defined(TOOLKIT_USES_GTK) | 278 #endif // defined(TOOLKIT_USES_GTK) |
| 279 | 279 |
| 280 ui::TextureID CanvasSkia::GetTextureID() { | 280 ui::TextureID CanvasSkia::GetTextureID() { |
| 281 // TODO(wjmaclean) | 281 // TODO(wjmaclean) |
| 282 return 0; | 282 return 0; |
| 283 } | 283 } |
| 284 | 284 |
| 285 } // namespace gfx | 285 } // namespace gfx |
| OLD | NEW |