OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006 Alexey Proskuryakov | 3 * Copyright (C) 2006 Alexey Proskuryakov |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 static inline void getSkiaBoundsForGlyph(SkPaint& paint, Glyph glyph, SkRect& bo
unds) | 399 static inline void getSkiaBoundsForGlyph(SkPaint& paint, Glyph glyph, SkRect& bo
unds) |
400 { | 400 { |
401 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 401 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
402 | 402 |
403 SkPath path; | 403 SkPath path; |
404 paint.getTextPath(&glyph, sizeof(glyph), 0, 0, &path); | 404 paint.getTextPath(&glyph, sizeof(glyph), 0, 0, &path); |
405 bounds = path.getBounds(); | 405 bounds = path.getBounds(); |
406 | 406 |
407 if (!paint.isSubpixelText()) { | 407 if (!paint.isSubpixelText()) { |
408 SkIRect ir; | 408 SkIRect ir; |
409 bounds.round(&ir); | 409 bounds.roundOut(&ir); |
410 bounds.set(ir); | 410 bounds.set(ir); |
411 } | 411 } |
412 } | 412 } |
413 | 413 |
414 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const | 414 FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const |
415 { | 415 { |
416 if (!m_platformData.size()) | 416 if (!m_platformData.size()) |
417 return FloatRect(); | 417 return FloatRect(); |
418 | 418 |
419 SkASSERT(sizeof(glyph) == 2); // compile-time assert | 419 SkASSERT(sizeof(glyph) == 2); // compile-time assert |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 if (glyphs[i]) { | 493 if (glyphs[i]) { |
494 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); | 494 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); |
495 haveGlyphs = true; | 495 haveGlyphs = true; |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 return haveGlyphs; | 499 return haveGlyphs; |
500 } | 500 } |
501 | 501 |
502 } // namespace blink | 502 } // namespace blink |
OLD | NEW |