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

Side by Side Diff: src/core/SkEdgeClipper.cpp

Issue 913503002: cull edges that are to the right of the clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2009 The Android Open Source Project 3 * Copyright 2009 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkEdgeClipper.h" 10 #include "SkEdgeClipper.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 SkASSERT(pts[0].fX <= pts[1].fX); 141 SkASSERT(pts[0].fX <= pts[1].fX);
142 SkASSERT(pts[1].fX <= pts[2].fX); 142 SkASSERT(pts[1].fX <= pts[2].fX);
143 143
144 // Now chop in X has needed, and record the segments 144 // Now chop in X has needed, and record the segments
145 145
146 if (pts[2].fX <= clip.fLeft) { // wholly to the left 146 if (pts[2].fX <= clip.fLeft) { // wholly to the left
147 this->appendVLine(clip.fLeft, pts[0].fY, pts[2].fY, reverse); 147 this->appendVLine(clip.fLeft, pts[0].fY, pts[2].fY, reverse);
148 return; 148 return;
149 } 149 }
150 if (pts[0].fX >= clip.fRight) { // wholly to the right 150 if (pts[0].fX >= clip.fRight) { // wholly to the right
151 this->appendVLine(clip.fRight, pts[0].fY, pts[2].fY, reverse); 151 if (!this->canCullToTheRight()) {
152 this->appendVLine(clip.fRight, pts[0].fY, pts[2].fY, reverse);
153 }
152 return; 154 return;
153 } 155 }
154 156
155 SkScalar t; 157 SkScalar t;
156 SkPoint tmp[5]; // for SkChopQuadAt 158 SkPoint tmp[5]; // for SkChopQuadAt
157 159
158 // are we partially to the left 160 // are we partially to the left
159 if (pts[0].fX < clip.fLeft) { 161 if (pts[0].fX < clip.fLeft) {
160 if (chopMonoQuadAtX(pts, clip.fLeft, &t)) { 162 if (chopMonoQuadAtX(pts, clip.fLeft, &t)) {
161 SkChopQuadAt(pts, tmp, t); 163 SkChopQuadAt(pts, tmp, t);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 reverse = !reverse; 345 reverse = !reverse;
344 } 346 }
345 347
346 // Now chop in X has needed, and record the segments 348 // Now chop in X has needed, and record the segments
347 349
348 if (pts[3].fX <= clip.fLeft) { // wholly to the left 350 if (pts[3].fX <= clip.fLeft) { // wholly to the left
349 this->appendVLine(clip.fLeft, pts[0].fY, pts[3].fY, reverse); 351 this->appendVLine(clip.fLeft, pts[0].fY, pts[3].fY, reverse);
350 return; 352 return;
351 } 353 }
352 if (pts[0].fX >= clip.fRight) { // wholly to the right 354 if (pts[0].fX >= clip.fRight) { // wholly to the right
353 this->appendVLine(clip.fRight, pts[0].fY, pts[3].fY, reverse); 355 if (!this->canCullToTheRight()) {
356 this->appendVLine(clip.fRight, pts[0].fY, pts[3].fY, reverse);
357 }
354 return; 358 return;
355 } 359 }
356 360
357 // are we partially to the left 361 // are we partially to the left
358 if (pts[0].fX < clip.fLeft) { 362 if (pts[0].fX < clip.fLeft) {
359 SkScalar t; 363 SkScalar t;
360 if (chopMonoCubicAtX(pts, clip.fLeft, &t)) { 364 if (chopMonoCubicAtX(pts, clip.fLeft, &t)) {
361 SkPoint tmp[7]; 365 SkPoint tmp[7];
362 SkChopCubicAt(pts, tmp, t); 366 SkChopCubicAt(pts, tmp, t);
363 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[3].fY, reverse); 367 this->appendVLine(clip.fLeft, tmp[0].fY, tmp[3].fY, reverse);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 assert_monotonic(&pts[0].fY, count); 526 assert_monotonic(&pts[0].fY, count);
523 } 527 }
524 } 528 }
525 529
526 void sk_assert_monotonic_x(const SkPoint pts[], int count) { 530 void sk_assert_monotonic_x(const SkPoint pts[], int count) {
527 if (count > 1) { 531 if (count > 1) {
528 assert_monotonic(&pts[0].fX, count); 532 assert_monotonic(&pts[0].fX, count);
529 } 533 }
530 } 534 }
531 #endif 535 #endif
OLDNEW
« no previous file with comments | « src/core/SkEdgeClipper.h ('k') | src/core/SkLineClipper.h » ('j') | src/core/SkScan_Path.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698