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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 14160005: Track the region where text is painted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase with TOT Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 width + fontMetrics.height(), fontMetrics.lin eSpacing()); 2194 width + fontMetrics.height(), fontMetrics.lin eSpacing());
2195 if (!fill) 2195 if (!fill)
2196 inflateStrokeRect(textRect); 2196 inflateStrokeRect(textRect);
2197 2197
2198 c->setTextDrawingMode(fill ? TextModeFill : TextModeStroke); 2198 c->setTextDrawingMode(fill ? TextModeFill : TextModeStroke);
2199 if (useMaxWidth) { 2199 if (useMaxWidth) {
2200 GraphicsContextStateSaver stateSaver(*c); 2200 GraphicsContextStateSaver stateSaver(*c);
2201 c->translate(location.x(), location.y()); 2201 c->translate(location.x(), location.y());
2202 // We draw when fontWidth is 0 so compositing operations (eg, a "copy" o p) still work. 2202 // We draw when fontWidth is 0 so compositing operations (eg, a "copy" o p) still work.
2203 c->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1)); 2203 c->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1));
2204 c->drawBidiText(font, textRun, FloatPoint(0, 0), Font::UseFallbackIfFont NotReady); 2204 c->drawBidiText(font, textRun, FloatPoint(0, 0), textRect, Font::UseFall backIfFontNotReady);
2205 } else 2205 } else
2206 c->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady ); 2206 c->drawBidiText(font, textRun, location, textRect, Font::UseFallbackIfFo ntNotReady);
2207 2207
2208 didDraw(textRect); 2208 didDraw(textRect);
2209 } 2209 }
2210 2210
2211 void CanvasRenderingContext2D::inflateStrokeRect(FloatRect& rect) const 2211 void CanvasRenderingContext2D::inflateStrokeRect(FloatRect& rect) const
2212 { 2212 {
2213 // Fast approximation of the stroke's bounding rect. 2213 // Fast approximation of the stroke's bounding rect.
2214 // This yields a slightly oversized rect but is very fast 2214 // This yields a slightly oversized rect but is very fast
2215 // compared to Path::strokeBoundingRect(). 2215 // compared to Path::strokeBoundingRect().
2216 static const float root2 = sqrtf(2); 2216 static const float root2 = sqrtf(2);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 return; 2248 return;
2249 2249
2250 realizeSaves(); 2250 realizeSaves();
2251 modifiableState().m_imageSmoothingEnabled = enabled; 2251 modifiableState().m_imageSmoothingEnabled = enabled;
2252 GraphicsContext* c = drawingContext(); 2252 GraphicsContext* c = drawingContext();
2253 if (c) 2253 if (c)
2254 c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone); 2254 c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone);
2255 } 2255 }
2256 2256
2257 } // namespace WebCore 2257 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698