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

Side by Side Diff: src/utils/SkPatchUtils.cpp

Issue 429343004: Stopped skipping tests in dm of SkPatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Moved DRAW_PATCH DrawType to the last position Created 6 years, 4 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 | « src/utils/SkNWayCanvas.cpp ('k') | src/utils/SkProxyCanvas.cpp » ('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 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPatchUtils.h" 8 #include "SkPatchUtils.h"
9 9
10 #include "SkGeometry.h"
11
12 // size in pixels of each partition per axis, adjust this knob 10 // size in pixels of each partition per axis, adjust this knob
13 static const int kPartitionSize = 30; 11 static const int kPartitionSize = 15;
14 12
15 /** 13 /**
16 * Calculate the approximate arc length given a bezier curve's control points. 14 * Calculate the approximate arc length given a bezier curve's control points.
17 */ 15 */
18 static SkScalar approx_arc_length(SkPoint* points, int count) { 16 static SkScalar approx_arc_length(SkPoint* points, int count) {
19 if (count < 2) { 17 if (count < 2) {
20 return 0; 18 return 0;
21 } 19 }
22 SkScalar arcLength = 0; 20 SkScalar arcLength = 0;
23 for (int i = 0; i < count - 1; i++) { 21 for (int i = 0; i < count - 1; i++) {
(...skipping 24 matching lines...) Expand all
48 patch.getRightPoints(pts); 46 patch.getRightPoints(pts);
49 matrix->mapPoints(pts, 4); 47 matrix->mapPoints(pts, 4);
50 SkScalar rightLength = approx_arc_length(pts, 4); 48 SkScalar rightLength = approx_arc_length(pts, 4);
51 49
52 // Level of detail per axis, based on the larger side between top and bottom or left and right 50 // Level of detail per axis, based on the larger side between top and bottom or left and right
53 int lodX = static_cast<int>(SkMaxScalar(topLength, bottomLength) / kPartitio nSize); 51 int lodX = static_cast<int>(SkMaxScalar(topLength, bottomLength) / kPartitio nSize);
54 int lodY = static_cast<int>(SkMaxScalar(leftLength, rightLength) / kPartitio nSize); 52 int lodY = static_cast<int>(SkMaxScalar(leftLength, rightLength) / kPartitio nSize);
55 53
56 return SkISize::Make(SkMax32(4, lodX), SkMax32(4, lodY)); 54 return SkISize::Make(SkMax32(4, lodX), SkMax32(4, lodY));
57 } 55 }
OLDNEW
« no previous file with comments | « src/utils/SkNWayCanvas.cpp ('k') | src/utils/SkProxyCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698