Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp |
| index b24c632a72a90f2434a11d85a8d76b7d4ae93e41..fc551ba29b6c89796f3af6a0a4a5dfccfc62d6d9 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp |
| @@ -74,8 +74,8 @@ GraphicsContext::GraphicsContext(PaintController& paintController, |
| if (metaData) |
| m_metaData = *metaData; |
| - // FIXME: Do some tests to determine how many states are typically used, and allocate |
| - // several here. |
| + // FIXME: Do some tests to determine how many states are typically used, and |
| + // allocate several here. |
| m_paintStateStack.append(GraphicsContextState::create()); |
| m_paintState = m_paintStateStack.last().get(); |
| @@ -212,8 +212,9 @@ SkColorFilter* GraphicsContext::getColorFilter() const { |
| void GraphicsContext::setColorFilter(ColorFilter colorFilter) { |
| GraphicsContextState* stateToSet = mutableState(); |
| - // We only support one active color filter at the moment. If (when) this becomes a problem, |
| - // we should switch to using color filter chains (Skia work in progress). |
| + // We only support one active color filter at the moment. If (when) this |
| + // becomes a problem, we should switch to using color filter chains (Skia work |
| + // in progress). |
| DCHECK(!stateToSet->getColorFilter()); |
| stateToSet->setColorFilter(WebCoreColorFilterToSkiaColorFilter(colorFilter)); |
| } |
| @@ -484,7 +485,8 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) { |
| if (getStrokeStyle() == DottedStroke || getStrokeStyle() == DashedStroke) { |
| // Do a rect fill of our endpoints. This ensures we always have the |
| - // appearance of being a border. We then draw the actual dotted/dashed line. |
| + // appearance of being a border. We then draw the actual dotted/dashed |
| + // line. |
| SkRect r1, r2; |
| r1.set(p1.x(), p1.y(), p1.x() + width, p1.y() + width); |
| r2.set(p2.x(), p2.y(), p2.x() + width, p2.y() + width); |
| @@ -1041,9 +1043,10 @@ bool isSimpleDRRect(const FloatRoundedRect& outer, |
| iRadii.bottomLeft().height())) |
| return false; |
| - // We also ignore DRRects with a very thick relative stroke (shapes which are mostly filled by |
| - // the stroke): Skia's stroke outline can diverge significantly from the outer/inner contours |
| - // in some edge cases, so we fall back to drawDRRect instead. |
| + // We also ignore DRRects with a very thick relative stroke (shapes which are |
| + // mostly filled by the stroke): Skia's stroke outline can diverge |
| + // significantly from the outer/inner contours in some edge cases, so we fall |
| + // back to drawDRRect instead. |
|
Stephen White
2016/10/05 14:45:37
Nit: drawDRRect() (not new to this patch)
Peter Kasting
2016/10/05 18:46:01
Done.
|
| const float kMaxStrokeToSizeRatio = 0.75f; |
| if (2 * strokeSize.width() / outer.rect().width() > kMaxStrokeToSizeRatio || |
| 2 * strokeSize.height() / outer.rect().height() > kMaxStrokeToSizeRatio) |
| @@ -1152,7 +1155,8 @@ void GraphicsContext::clipOut(const Path& pathToClip) { |
| if (contextDisabled()) |
| return; |
| - // Use const_cast and temporarily toggle the inverse fill type instead of copying the path. |
| + // Use const_cast and temporarily toggle the inverse fill type instead of |
| + // copying the path. |
| SkPath& path = const_cast<SkPath&>(pathToClip.getSkPath()); |
| path.toggleInverseFillType(); |
| clipPath(path, AntiAliased); |
| @@ -1274,10 +1278,11 @@ void GraphicsContext::adjustLineToPixelBoundaries(FloatPoint& p1, |
| FloatPoint& p2, |
| float strokeWidth, |
| StrokeStyle penStyle) { |
| - // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic |
| - // works out. For example, with a border width of 3, WebKit will pass us (y1+y2)/2, e.g., |
| - // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave |
| - // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. |
| + // For odd widths, we add in 0.5 to the appropriate x/y so that the float |
| + // arithmetic works out. For example, with a border width of 3, WebKit will |
| + // pass us (y1+y2)/2, e.g., (50+53)/2 = 103/2 = 51 when we want 51.5. It is |
| + // always true that an even width gave us a perfect position, but an odd width |
| + // gave us a position that is off by exactly 0.5. |
| if (penStyle == DottedStroke || penStyle == DashedStroke) { |
| if (p1.x() == p2.x()) { |
| p1.setY(p1.y() + strokeWidth); |
| @@ -1288,7 +1293,7 @@ void GraphicsContext::adjustLineToPixelBoundaries(FloatPoint& p1, |
| } |
| } |
| - if (static_cast<int>(strokeWidth) % 2) { //odd |
| + if (static_cast<int>(strokeWidth) % 2) { // odd |
| if (p1.x() == p2.x()) { |
| // We're a vertical line. Adjust our x. |
| p1.setX(p1.x() + 0.5f); |