| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 TextRun textRun(run); | 94 TextRun textRun(run); |
| 95 TextRunPaintInfo runInfo(textRun); | 95 TextRunPaintInfo runInfo(textRun); |
| 96 runInfo.bounds = textClipRect; | 96 runInfo.bounds = textClipRect; |
| 97 | 97 |
| 98 IntRect intRect(clip); | 98 IntRect intRect(clip); |
| 99 SkPictureBuilder pictureBuilder(intRect); | 99 SkPictureBuilder pictureBuilder(intRect); |
| 100 GraphicsContext* context = &pictureBuilder.context(); | 100 GraphicsContext* context = &pictureBuilder.context(); |
| 101 | 101 |
| 102 { | 102 { |
| 103 DrawingRecorder drawingRecorder(*context, *this, DisplayItem::WebFont, i
ntRect); | 103 DrawingRecorder drawingRecorder(*context, *this, DisplayItem::WebFont, i
ntRect); |
| 104 ASSERT(!drawingRecorder.canUseCachedDrawing()); |
| 104 context->save(); | 105 context->save(); |
| 105 context->setFillColor(color); | 106 context->setFillColor(color); |
| 106 context->clip(textClipRect); | 107 context->clip(textClipRect); |
| 107 context->drawText(m_font, runInfo, leftBaseline); | 108 context->drawText(m_font, runInfo, leftBaseline); |
| 108 context->restore(); | 109 context->restore(); |
| 109 } | 110 } |
| 110 | 111 |
| 111 pictureBuilder.endRecording()->playback(canvas); | 112 pictureBuilder.endRecording()->playback(canvas); |
| 112 } | 113 } |
| 113 | 114 |
| 114 int WebFontImpl::calculateWidth(const WebTextRun& run) const | 115 int WebFontImpl::calculateWidth(const WebTextRun& run) const |
| 115 { | 116 { |
| 116 return m_font.width(run, 0); | 117 return m_font.width(run, 0); |
| 117 } | 118 } |
| 118 | 119 |
| 119 int WebFontImpl::offsetForPosition(const WebTextRun& run, float position) const | 120 int WebFontImpl::offsetForPosition(const WebTextRun& run, float position) const |
| 120 { | 121 { |
| 121 return m_font.offsetForPosition(run, position, true); | 122 return m_font.offsetForPosition(run, position, true); |
| 122 } | 123 } |
| 123 | 124 |
| 124 WebFloatRect WebFontImpl::selectionRectForText(const WebTextRun& run, const WebF
loatPoint& leftBaseline, int height, int from, int to) const | 125 WebFloatRect WebFontImpl::selectionRectForText(const WebTextRun& run, const WebF
loatPoint& leftBaseline, int height, int from, int to) const |
| 125 { | 126 { |
| 126 return m_font.selectionRectForText(run, leftBaseline, height, from, to); | 127 return m_font.selectionRectForText(run, leftBaseline, height, from, to); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |