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

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

Issue 19543005: turn off debugging printfs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove unused code 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 | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkPathOpsQuad.cpp ('k') | src/pathops/SkPathOpsTypes.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 2012 Google Inc. 2 * Copyright 2012 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 #include "SkPathOpsCubic.h" 7 #include "SkPathOpsCubic.h"
8 #include "SkPathOpsLine.h" 8 #include "SkPathOpsLine.h"
9 #include "SkPathOpsQuad.h" 9 #include "SkPathOpsQuad.h"
10 #include "SkPathOpsRect.h" 10 #include "SkPathOpsRect.h"
11 11
12 void SkDRect::setBounds(const SkDLine& line) { 12 void SkDRect::setBounds(const SkDLine& line) {
13 set(line[0]); 13 set(line[0]);
14 add(line[1]); 14 add(line[1]);
15 } 15 }
16 16
17 void SkDRect::setBounds(const SkDQuad& quad) { 17 void SkDRect::setBounds(const SkDQuad& quad) {
18 set(quad[0]); 18 set(quad[0]);
19 add(quad[2]); 19 add(quad[2]);
20 double tValues[2]; 20 double tValues[2];
21 int roots = 0; 21 int roots = 0;
22 if (!between(quad[0].fX, quad[1].fX, quad[2].fX)) { 22 if (!between(quad[0].fX, quad[1].fX, quad[2].fX)) {
23 roots = SkDQuad::FindExtrema(quad[0].fX, quad[1].fX, quad[2].fX, tValues ); 23 roots = SkDQuad::FindExtrema(quad[0].fX, quad[1].fX, quad[2].fX, tValues );
24 } 24 }
25 if (!between(quad[0].fY, quad[1].fY, quad[2].fY)) { 25 if (!between(quad[0].fY, quad[1].fY, quad[2].fY)) {
26 roots += SkDQuad::FindExtrema(quad[0].fY, quad[1].fY, quad[2].fY, &tValu es[roots]); 26 roots += SkDQuad::FindExtrema(quad[0].fY, quad[1].fY, quad[2].fY, &tValu es[roots]);
27 } 27 }
28 for (int x = 0; x < roots; ++x) { 28 for (int x = 0; x < roots; ++x) {
29 add(quad.xyAtT(tValues[x])); 29 add(quad.ptAtT(tValues[x]));
30 } 30 }
31 } 31 }
32 32
33 void SkDRect::setRawBounds(const SkDQuad& quad) { 33 void SkDRect::setRawBounds(const SkDQuad& quad) {
34 set(quad[0]); 34 set(quad[0]);
35 for (int x = 1; x < 3; ++x) { 35 for (int x = 1; x < 3; ++x) {
36 add(quad[x]); 36 add(quad[x]);
37 } 37 }
38 } 38 }
39 39
40 static bool is_bounded_by_end_points(double a, double b, double c, double d) { 40 static bool is_bounded_by_end_points(double a, double b, double c, double d) {
41 return between(a, b, d) && between(a, c, d); 41 return between(a, b, d) && between(a, c, d);
42 } 42 }
43 43
44 void SkDRect::setBounds(const SkDCubic& c) { 44 void SkDRect::setBounds(const SkDCubic& c) {
45 set(c[0]); 45 set(c[0]);
46 add(c[3]); 46 add(c[3]);
47 double tValues[4]; 47 double tValues[4];
48 int roots = 0; 48 int roots = 0;
49 if (!is_bounded_by_end_points(c[0].fX, c[1].fX, c[2].fX, c[3].fX)) { 49 if (!is_bounded_by_end_points(c[0].fX, c[1].fX, c[2].fX, c[3].fX)) {
50 roots = SkDCubic::FindExtrema(c[0].fX, c[1].fX, c[2].fX, c[3].fX, tValue s); 50 roots = SkDCubic::FindExtrema(c[0].fX, c[1].fX, c[2].fX, c[3].fX, tValue s);
51 } 51 }
52 if (!is_bounded_by_end_points(c[0].fY, c[1].fY, c[2].fY, c[3].fY)) { 52 if (!is_bounded_by_end_points(c[0].fY, c[1].fY, c[2].fY, c[3].fY)) {
53 roots += SkDCubic::FindExtrema(c[0].fY, c[1].fY, c[2].fY, c[3].fY, &tVal ues[roots]); 53 roots += SkDCubic::FindExtrema(c[0].fY, c[1].fY, c[2].fY, c[3].fY, &tVal ues[roots]);
54 } 54 }
55 for (int x = 0; x < roots; ++x) { 55 for (int x = 0; x < roots; ++x) {
56 add(c.xyAtT(tValues[x])); 56 add(c.ptAtT(tValues[x]));
57 } 57 }
58 } 58 }
59 59
60 void SkDRect::setRawBounds(const SkDCubic& cubic) { 60 void SkDRect::setRawBounds(const SkDCubic& cubic) {
61 set(cubic[0]); 61 set(cubic[0]);
62 for (int x = 1; x < 4; ++x) { 62 for (int x = 1; x < 4; ++x) {
63 add(cubic[x]); 63 add(cubic[x]);
64 } 64 }
65 } 65 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsQuad.cpp ('k') | src/pathops/SkPathOpsTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698