Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: third_party/WebKit/Source/web/WebFontImpl.cpp

Issue 1512803004: Use refs for GraphicsContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 WebColor color, const WebRect& clip) const 90 WebColor color, const WebRect& clip) const
91 { 91 {
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 ASSERT(!DrawingRecorder::useCachedDrawingIfPossible(context, *this, DisplayI tem::WebFont));
103 { 103 {
104 DrawingRecorder drawingRecorder(*context, *this, DisplayItem::WebFont, i ntRect); 104 DrawingRecorder drawingRecorder(context, *this, DisplayItem::WebFont, in tRect);
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698