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

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

Issue 163683002: Store SkRRects in SkClipStack (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix unhandled enum value warning in unit test Created 6 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkClipStack.h ('k') | src/core/SkClipStack.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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 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 "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 devPath.setFillType(SkPath::kInverseEvenOdd_FillType); 1288 devPath.setFillType(SkPath::kInverseEvenOdd_FillType);
1289 const SkClipStack* clipStack = getClipStack(); 1289 const SkClipStack* clipStack = getClipStack();
1290 SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart) ; 1290 SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart) ;
1291 const SkClipStack::Element* element; 1291 const SkClipStack::Element* element;
1292 while ((element = iter.next())) { 1292 while ((element = iter.next())) {
1293 SkClipStack::Element::Type type = element->getType(); 1293 SkClipStack::Element::Type type = element->getType();
1294 if (type == SkClipStack::Element::kEmpty_Type) { 1294 if (type == SkClipStack::Element::kEmpty_Type) {
1295 continue; 1295 continue;
1296 } 1296 }
1297 SkPath operand; 1297 SkPath operand;
1298 if (type == SkClipStack::Element::kRect_Type) { 1298 element->asPath(&operand);
1299 operand.addRect(element->getRect());
1300 } else if (type == SkClipStack::Element::kPath_Type) {
1301 operand = element->getPath();
1302 } else {
1303 SkDEBUGFAIL("Unexpected type.");
1304 }
1305 SkRegion::Op elementOp = element->getOp(); 1299 SkRegion::Op elementOp = element->getOp();
1306 if (elementOp == SkRegion::kReplace_Op) { 1300 if (elementOp == SkRegion::kReplace_Op) {
1307 devPath = operand; 1301 devPath = operand;
1308 } else { 1302 } else {
1309 Op(devPath, operand, (SkPathOp) elementOp, &devPath); 1303 Op(devPath, operand, (SkPathOp) elementOp, &devPath);
1310 } 1304 }
1311 // if the prev and curr clips disagree about aa -vs- not, favor the aa request. 1305 // if the prev and curr clips disagree about aa -vs- not, favor the aa request.
1312 // perhaps we need an API change to avoid this sort of mixed-signals about 1306 // perhaps we need an API change to avoid this sort of mixed-signals about
1313 // clipping. 1307 // clipping.
1314 doAA |= element->isAA(); 1308 doAA |= element->isAA();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 void SkCanvas::replayClips(ClipVisitor* visitor) const { 1445 void SkCanvas::replayClips(ClipVisitor* visitor) const {
1452 SkClipStack::B2TIter iter(fClipStack); 1446 SkClipStack::B2TIter iter(fClipStack);
1453 const SkClipStack::Element* element; 1447 const SkClipStack::Element* element;
1454 1448
1455 static const SkRect kEmpty = { 0, 0, 0, 0 }; 1449 static const SkRect kEmpty = { 0, 0, 0, 0 };
1456 while ((element = iter.next()) != NULL) { 1450 while ((element = iter.next()) != NULL) {
1457 switch (element->getType()) { 1451 switch (element->getType()) {
1458 case SkClipStack::Element::kPath_Type: 1452 case SkClipStack::Element::kPath_Type:
1459 visitor->clipPath(element->getPath(), element->getOp(), element- >isAA()); 1453 visitor->clipPath(element->getPath(), element->getOp(), element- >isAA());
1460 break; 1454 break;
1455 case SkClipStack::Element::kRRect_Type:
1456 visitor->clipRRect(element->getRRect(), element->getOp(), elemen t->isAA());
1457 break;
1461 case SkClipStack::Element::kRect_Type: 1458 case SkClipStack::Element::kRect_Type:
1462 visitor->clipRect(element->getRect(), element->getOp(), element- >isAA()); 1459 visitor->clipRect(element->getRect(), element->getOp(), element- >isAA());
1463 break; 1460 break;
1464 case SkClipStack::Element::kEmpty_Type: 1461 case SkClipStack::Element::kEmpty_Type:
1465 visitor->clipRect(kEmpty, SkRegion::kIntersect_Op, false); 1462 visitor->clipRect(kEmpty, SkRegion::kIntersect_Op, false);
1466 break; 1463 break;
1467 } 1464 }
1468 } 1465 }
1469 } 1466 }
1470 1467
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 return *paint; 2224 return *paint;
2228 } 2225 }
2229 2226
2230 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } 2227 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); }
2231 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } 2228 int SkCanvas::LayerIter::x() const { return fImpl->getX(); }
2232 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } 2229 int SkCanvas::LayerIter::y() const { return fImpl->getY(); }
2233 2230
2234 /////////////////////////////////////////////////////////////////////////////// 2231 ///////////////////////////////////////////////////////////////////////////////
2235 2232
2236 SkCanvas::ClipVisitor::~ClipVisitor() { } 2233 SkCanvas::ClipVisitor::~ClipVisitor() { }
OLDNEW
« no previous file with comments | « include/core/SkClipStack.h ('k') | src/core/SkClipStack.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698