| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 FontCachePurgePreventer fontCachePurgePreventer; | 92 FontCachePurgePreventer fontCachePurgePreventer; |
| 93 FloatRect textClipRect(clip); | 93 FloatRect textClipRect(clip); |
| 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 ASSERT(!DrawingRecorder::useCachedDrawingIfPossible(*context, *this, Display
Item::WebFont)); |
| 102 { | 103 { |
| 103 DrawingRecorder drawingRecorder(*context, *this, DisplayItem::WebFont, i
ntRect); | 104 DrawingRecorder drawingRecorder(*context, *this, DisplayItem::WebFont, i
ntRect); |
| 104 ASSERT(!drawingRecorder.canUseCachedDrawing()); | |
| 105 context->save(); | 105 context->save(); |
| 106 context->setFillColor(color); | 106 context->setFillColor(color); |
| 107 context->clip(textClipRect); | 107 context->clip(textClipRect); |
| 108 context->drawText(m_font, runInfo, leftBaseline); | 108 context->drawText(m_font, runInfo, leftBaseline); |
| 109 context->restore(); | 109 context->restore(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 pictureBuilder.endRecording()->playback(canvas); | 112 pictureBuilder.endRecording()->playback(canvas); |
| 113 } | 113 } |
| 114 | 114 |
| 115 int WebFontImpl::calculateWidth(const WebTextRun& run) const | 115 int WebFontImpl::calculateWidth(const WebTextRun& run) const |
| 116 { | 116 { |
| 117 return m_font.width(run, 0); | 117 return m_font.width(run, 0); |
| 118 } | 118 } |
| 119 | 119 |
| 120 int WebFontImpl::offsetForPosition(const WebTextRun& run, float position) const | 120 int WebFontImpl::offsetForPosition(const WebTextRun& run, float position) const |
| 121 { | 121 { |
| 122 return m_font.offsetForPosition(run, position, true); | 122 return m_font.offsetForPosition(run, position, true); |
| 123 } | 123 } |
| 124 | 124 |
| 125 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 |
| 126 { | 126 { |
| 127 return m_font.selectionRectForText(run, leftBaseline, height, from, to); | 127 return m_font.selectionRectForText(run, leftBaseline, height, from, to); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |