| 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 #include "ui/gfx/render_text_mac.h" | 5 #include "ui/gfx/render_text_mac.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
| 9 #include <CoreText/CoreText.h> | 9 #include <CoreText/CoreText.h> |
| 10 | 10 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 const TextRun& run = runs_[i]; | 252 const TextRun& run = runs_[i]; |
| 253 renderer->SetForegroundColor(run.foreground); | 253 renderer->SetForegroundColor(run.foreground); |
| 254 renderer->SetTextSize(CTFontGetSize(run.ct_font)); | 254 renderer->SetTextSize(CTFontGetSize(run.ct_font)); |
| 255 | 255 |
| 256 // The painter adds its own ref. So don't |release()| it from the ref ptr in | 256 // The painter adds its own ref. So don't |release()| it from the ref ptr in |
| 257 // TextRun. | 257 // TextRun. |
| 258 renderer->SetTypeface(run.typeface); | 258 renderer->SetTypeface(run.typeface); |
| 259 | 259 |
| 260 renderer->DrawPosText(&run.glyph_positions[0], &run.glyphs[0], | 260 renderer->DrawPosText(&run.glyph_positions[0], &run.glyphs[0], |
| 261 run.glyphs.size()); | 261 run.glyphs.size()); |
| 262 renderer->DrawDecorations(run.origin.x(), run.origin.y(), run.width, | 262 if (run.underline) |
| 263 run.underline, run.strike); | 263 renderer->DrawUnderline(run.origin.x(), run.origin.y(), run.width); |
| 264 if (run.strike) |
| 265 renderer->DrawStrike(run.origin.x(), run.origin.y(), run.width, |
| 266 strike_thickness_factor()); |
| 264 } | 267 } |
| 265 } | 268 } |
| 266 | 269 |
| 267 RenderTextMac::TextRun::TextRun() | 270 RenderTextMac::TextRun::TextRun() |
| 268 : ct_run(NULL), | 271 : ct_run(NULL), |
| 269 origin(SkPoint::Make(0, 0)), | 272 origin(SkPoint::Make(0, 0)), |
| 270 width(0), | 273 width(0), |
| 271 foreground(SK_ColorBLACK), | 274 foreground(SK_ColorBLACK), |
| 272 underline(false), | 275 underline(false), |
| 273 strike(false) {} | 276 strike(false) {} |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 // TODO(karandeepb): This is not invoked on any codepath currently. Style the | 480 // TODO(karandeepb): This is not invoked on any codepath currently. Style the |
| 478 // returned text if need be. | 481 // returned text if need be. |
| 479 if (obscured()) | 482 if (obscured()) |
| 480 return false; | 483 return false; |
| 481 | 484 |
| 482 decorated_text->text = GetTextFromRange(range); | 485 decorated_text->text = GetTextFromRange(range); |
| 483 return true; | 486 return true; |
| 484 } | 487 } |
| 485 | 488 |
| 486 } // namespace gfx | 489 } // namespace gfx |
| OLD | NEW |