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

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

Issue 18551004: Miscellaneous cleanup to reduce number of includes in platform/graphics/ Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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
« no previous file with comments | « Source/core/html/HTMLCanvasElement.cpp ('k') | Source/core/platform/graphics/AnnotationMode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 fontMetrics.lineSpacing()); 2167 fontMetrics.lineSpacing());
2168 if (!fill) 2168 if (!fill)
2169 inflateStrokeRect(textRunPaintInfo.bounds); 2169 inflateStrokeRect(textRunPaintInfo.bounds);
2170 2170
2171 c->setTextDrawingMode(fill ? TextModeFill : TextModeStroke); 2171 c->setTextDrawingMode(fill ? TextModeFill : TextModeStroke);
2172 if (useMaxWidth) { 2172 if (useMaxWidth) {
2173 GraphicsContextStateSaver stateSaver(*c); 2173 GraphicsContextStateSaver stateSaver(*c);
2174 c->translate(location.x(), location.y()); 2174 c->translate(location.x(), location.y());
2175 // We draw when fontWidth is 0 so compositing operations (eg, a "copy" o p) still work. 2175 // We draw when fontWidth is 0 so compositing operations (eg, a "copy" o p) still work.
2176 c->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1)); 2176 c->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1));
2177 c->drawBidiText(font, textRunPaintInfo, FloatPoint(0, 0), Font::UseFallb ackIfFontNotReady); 2177 c->drawBidiText(font, textRunPaintInfo, FloatPoint(0, 0), UseFallbackIfF ontNotReady);
2178 } else 2178 } else {
2179 c->drawBidiText(font, textRunPaintInfo, location, Font::UseFallbackIfFon tNotReady); 2179 c->drawBidiText(font, textRunPaintInfo, location, UseFallbackIfFontNotRe ady);
2180 }
2180 2181
2181 didDraw(textRunPaintInfo.bounds); 2182 didDraw(textRunPaintInfo.bounds);
2182 } 2183 }
2183 2184
2184 void CanvasRenderingContext2D::inflateStrokeRect(FloatRect& rect) const 2185 void CanvasRenderingContext2D::inflateStrokeRect(FloatRect& rect) const
2185 { 2186 {
2186 // Fast approximation of the stroke's bounding rect. 2187 // Fast approximation of the stroke's bounding rect.
2187 // This yields a slightly oversized rect but is very fast 2188 // This yields a slightly oversized rect but is very fast
2188 // compared to Path::strokeBoundingRect(). 2189 // compared to Path::strokeBoundingRect().
2189 static const float root2 = sqrtf(2); 2190 static const float root2 = sqrtf(2);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 } 2229 }
2229 2230
2230 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const 2231 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const
2231 { 2232 {
2232 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate(); 2233 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate();
2233 attributes->setAlpha(m_hasAlpha); 2234 attributes->setAlpha(m_hasAlpha);
2234 return attributes.release(); 2235 return attributes.release();
2235 } 2236 }
2236 2237
2237 } // namespace WebCore 2238 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLCanvasElement.cpp ('k') | Source/core/platform/graphics/AnnotationMode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698