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

Side by Side Diff: src/pathops/SkPathOpsTightBounds.cpp

Issue 348343002: add pathops tight bounds; conform path ops' gyp to unit tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | « include/pathops/SkPathOps.h ('k') | tests/PathOpsTightBoundsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 #include "SkOpEdgeBuilder.h"
8 #include "SkPathOpsCommon.h"
9
10 bool TightBounds(const SkPath& path, SkRect* result) {
11 // turn path into list of segments
12 SkTArray<SkOpContour> contours;
13 SkOpEdgeBuilder builder(path, contours);
14 if (!builder.finish()) {
15 return false;
16 }
17 SkTArray<SkOpContour*, true> contourList;
18 MakeContourList(contours, contourList, false, false);
19 SkOpContour** currentPtr = contourList.begin();
20 result->setEmpty();
21 if (!currentPtr) {
22 return true;
23 }
24 SkOpContour** listEnd = contourList.end();
25 SkOpContour* current = *currentPtr++;
26 SkPathOpsBounds bounds = current->bounds();
27 while (currentPtr != listEnd) {
28 current = *currentPtr++;
29 bounds.add(current->bounds());
30 }
31 *result = bounds;
32 return true;
33 }
OLDNEW
« no previous file with comments | « include/pathops/SkPathOps.h ('k') | tests/PathOpsTightBoundsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698