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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Path.cpp

Issue 2675793003: use SkPath::computeTightBounds (Closed)
Patch Set: so I guess it IS needed Created 3 years, 10 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 | « no previous file | no next file » | 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) 2003, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
3 * 2006 Rob Buis <buis@kde.org> 3 * 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 bool Path::strokeContains(const FloatPoint& point, 102 bool Path::strokeContains(const FloatPoint& point,
103 const StrokeData& strokeData) const { 103 const StrokeData& strokeData) const {
104 return strokePath(strokeData) 104 return strokePath(strokeData)
105 .contains(WebCoreFloatToSkScalar(point.x()), 105 .contains(WebCoreFloatToSkScalar(point.x()),
106 WebCoreFloatToSkScalar(point.y())); 106 WebCoreFloatToSkScalar(point.y()));
107 } 107 }
108 108
109 namespace { 109 namespace {
110 110
111 FloatRect pathBounds(const SkPath& path, Path::BoundsType boundsType) { 111 FloatRect pathBounds(const SkPath& path, Path::BoundsType boundsType) {
112 SkRect bounds; 112 return boundsType == Path::BoundsType::Conservative
113 if (boundsType == Path::BoundsType::Conservative || 113 ? path.getBounds()
114 !TightBounds(path, &bounds)) { 114 : path.computeTightBounds();
115 return path.getBounds();
116 }
117
118 DCHECK_EQ(boundsType, Path::BoundsType::Exact);
119 return bounds;
120 } 115 }
121 116
122 } // anonymous ns 117 } // anonymous ns
123 118
124 // TODO(fmalita): evaluate returning exact bounds in all cases. 119 // TODO(fmalita): evaluate returning exact bounds in all cases.
125 FloatRect Path::boundingRect(BoundsType boundsType) const { 120 FloatRect Path::boundingRect(BoundsType boundsType) const {
126 return pathBounds(m_path, boundsType); 121 return pathBounds(m_path, boundsType);
127 } 122 }
128 123
129 FloatRect Path::strokeBoundingRect(const StrokeData& strokeData, 124 FloatRect Path::strokeBoundingRect(const StrokeData& strokeData,
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 545 }
551 546
552 #if DCHECK_IS_ON() 547 #if DCHECK_IS_ON()
553 bool ellipseIsRenderable(float startAngle, float endAngle) { 548 bool ellipseIsRenderable(float startAngle, float endAngle) {
554 return (std::abs(endAngle - startAngle) < twoPiFloat) || 549 return (std::abs(endAngle - startAngle) < twoPiFloat) ||
555 WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); 550 WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat);
556 } 551 }
557 #endif 552 #endif
558 553
559 } // namespace blink 554 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698