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

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

Issue 1331533002: [poc] curve-filter Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix CanvasRenderingContext2D::createPattern crash for #40 Created 4 years, 11 months 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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "web/WebFontImpl.h" 31 #include "web/WebFontImpl.h"
32 32
33 #include "platform/fonts/FontCache.h" 33 #include "platform/fonts/FontCache.h"
34 #include "platform/fonts/FontDescription.h" 34 #include "platform/fonts/FontDescription.h"
35 #include "platform/graphics/GraphicsContext.h" 35 #include "platform/graphics/GraphicsContext.h"
36 #include "platform/graphics/GraphicsScreen.h"
36 #include "platform/graphics/paint/DrawingRecorder.h" 37 #include "platform/graphics/paint/DrawingRecorder.h"
37 #include "platform/graphics/paint/SkPictureBuilder.h" 38 #include "platform/graphics/paint/SkPictureBuilder.h"
38 #include "platform/text/TextRun.h" 39 #include "platform/text/TextRun.h"
39 #include "public/platform/WebFloatPoint.h" 40 #include "public/platform/WebFloatPoint.h"
40 #include "public/platform/WebFloatRect.h" 41 #include "public/platform/WebFloatRect.h"
41 #include "public/platform/WebRect.h" 42 #include "public/platform/WebRect.h"
42 #include "public/web/WebFontDescription.h" 43 #include "public/web/WebFontDescription.h"
43 #include "public/web/WebTextRun.h" 44 #include "public/web/WebTextRun.h"
44 45
45 namespace blink { 46 namespace blink {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 94
94 void WebFontImpl::drawText(WebCanvas* canvas, const WebTextRun& run, const WebFl oatPoint& leftBaseline, 95 void WebFontImpl::drawText(WebCanvas* canvas, const WebTextRun& run, const WebFl oatPoint& leftBaseline,
95 WebColor color, const WebRect& clip) const 96 WebColor color, const WebRect& clip) const
96 { 97 {
97 FontCachePurgePreventer fontCachePurgePreventer; 98 FontCachePurgePreventer fontCachePurgePreventer;
98 FloatRect textClipRect(clip); 99 FloatRect textClipRect(clip);
99 TextRun textRun(run); 100 TextRun textRun(run);
100 TextRunPaintInfo runInfo(textRun); 101 TextRunPaintInfo runInfo(textRun);
101 runInfo.bounds = textClipRect; 102 runInfo.bounds = textClipRect;
102 103
104 WillPaintForDevice device(ScreenDevice::sRGBPlugin); // FIXME: PPAPI interna l text metrics.
105
103 IntRect intRect(clip); 106 IntRect intRect(clip);
104 SkPictureBuilder pictureBuilder(intRect); 107 SkPictureBuilder pictureBuilder(intRect);
105 GraphicsContext& context = pictureBuilder.context(); 108 GraphicsContext& context = pictureBuilder.context();
106 109
107 ASSERT(!DrawingRecorder::useCachedDrawingIfPossible(context, *this, DisplayI tem::WebFont)); 110 ASSERT(!DrawingRecorder::useCachedDrawingIfPossible(context, *this, DisplayI tem::WebFont));
108 { 111 {
109 DrawingRecorder drawingRecorder(context, *this, DisplayItem::WebFont, in tRect); 112 DrawingRecorder drawingRecorder(context, *this, DisplayItem::WebFont, in tRect);
110 context.save(); 113 context.save();
111 context.setFillColor(color); 114 context.setFillColor(color);
112 context.clip(textClipRect); 115 context.clip(textClipRect);
(...skipping 13 matching lines...) Expand all
126 { 129 {
127 return m_font.offsetForPosition(run, position, true); 130 return m_font.offsetForPosition(run, position, true);
128 } 131 }
129 132
130 WebFloatRect WebFontImpl::selectionRectForText(const WebTextRun& run, const WebF loatPoint& leftBaseline, int height, int from, int to) const 133 WebFloatRect WebFontImpl::selectionRectForText(const WebTextRun& run, const WebF loatPoint& leftBaseline, int height, int from, int to) const
131 { 134 {
132 return m_font.selectionRectForText(run, leftBaseline, height, from, to); 135 return m_font.selectionRectForText(run, leftBaseline, height, from, to);
133 } 136 }
134 137
135 } // namespace blink 138 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/PageOverlay.cpp ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698