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 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 } | 225 } |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 void RenderTextMac::ComputeRuns() { | 229 void RenderTextMac::ComputeRuns() { |
230 DCHECK(line_); | 230 DCHECK(line_); |
231 | 231 |
232 CFArrayRef ct_runs = CTLineGetGlyphRuns(line_); | 232 CFArrayRef ct_runs = CTLineGetGlyphRuns(line_); |
233 const CFIndex ct_runs_count = CFArrayGetCount(ct_runs); | 233 const CFIndex ct_runs_count = CFArrayGetCount(ct_runs); |
234 | 234 |
235 Point offset(GetTextOrigin()); | 235 Vector2d offset(GetTextOffset()); |
236 // Skia will draw glyphs with respect to the baseline. | 236 // Skia will draw glyphs with respect to the baseline. |
237 offset.Offset(0, common_baseline_); | 237 offset.Grow(0, common_baseline_); |
Peter Kasting
2012/10/30 01:14:14
Nit: Inline this addition into the SkIntToScalar c
danakj
2012/10/30 19:21:21
Then we need to inline it also into the run_origin
Peter Kasting
2012/10/30 20:24:37
No, I forgot to mention. We should also have run_
danakj
2012/10/30 21:14:52
Oh I see, yes.
| |
238 | 238 |
239 const SkScalar x = SkIntToScalar(offset.x()); | 239 const SkScalar x = SkIntToScalar(offset.x()); |
240 const SkScalar y = SkIntToScalar(offset.y()); | 240 const SkScalar y = SkIntToScalar(offset.y()); |
241 SkPoint run_origin = SkPoint::Make(offset.x(), offset.y()); | 241 SkPoint run_origin = SkPoint::Make(offset.x(), offset.y()); |
242 | 242 |
243 const CFRange empty_cf_range = CFRangeMake(0, 0); | 243 const CFRange empty_cf_range = CFRangeMake(0, 0); |
244 for (CFIndex i = 0; i < ct_runs_count; ++i) { | 244 for (CFIndex i = 0; i < ct_runs_count; ++i) { |
245 CTRunRef ct_run = | 245 CTRunRef ct_run = |
246 base::mac::CFCast<CTRunRef>(CFArrayGetValueAtIndex(ct_runs, i)); | 246 base::mac::CFCast<CTRunRef>(CFArrayGetValueAtIndex(ct_runs, i)); |
247 const size_t glyph_count = CTRunGetGlyphCount(ct_run); | 247 const size_t glyph_count = CTRunGetGlyphCount(ct_run); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 run_origin.offset(run_width, 0); | 315 run_origin.offset(run_width, 0); |
316 } | 316 } |
317 runs_valid_ = true; | 317 runs_valid_ = true; |
318 } | 318 } |
319 | 319 |
320 RenderText* RenderText::CreateInstance() { | 320 RenderText* RenderText::CreateInstance() { |
321 return new RenderTextMac; | 321 return new RenderTextMac; |
322 } | 322 } |
323 | 323 |
324 } // namespace gfx | 324 } // namespace gfx |
OLD | NEW |