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

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

Issue 876923003: [SkSVGDevice] Initial clipping support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: win build warning 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
« 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 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasDrawable.h" 9 #include "SkCanvasDrawable.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 if (devPath.getBounds().isEmpty()) { 1439 if (devPath.getBounds().isEmpty()) {
1440 // resetting the path will remove any NaN or other wanky values 1440 // resetting the path will remove any NaN or other wanky values
1441 // that might upset our scan converter. 1441 // that might upset our scan converter.
1442 devPath.reset(); 1442 devPath.reset();
1443 } 1443 }
1444 1444
1445 // if we called path.swap() we could avoid a deep copy of this path 1445 // if we called path.swap() we could avoid a deep copy of this path
1446 fClipStack.clipDevPath(devPath, op, kSoft_ClipEdgeStyle == edgeStyle); 1446 fClipStack.clipDevPath(devPath, op, kSoft_ClipEdgeStyle == edgeStyle);
1447 1447
1448 if (fAllowSimplifyClip) { 1448 if (fAllowSimplifyClip) {
1449 devPath.reset(); 1449 bool clipIsAA = getClipStack()->asPath(&devPath);
1450 devPath.setFillType(SkPath::kInverseEvenOdd_FillType); 1450 if (clipIsAA) {
1451 const SkClipStack* clipStack = getClipStack(); 1451 edgeStyle = kSoft_ClipEdgeStyle;
1452 SkClipStack::Iter iter(*clipStack, SkClipStack::Iter::kBottom_IterStart) ;
1453 const SkClipStack::Element* element;
1454 while ((element = iter.next())) {
1455 SkClipStack::Element::Type type = element->getType();
1456 SkPath operand;
1457 if (type != SkClipStack::Element::kEmpty_Type) {
1458 element->asPath(&operand);
1459 }
1460 SkRegion::Op elementOp = element->getOp();
1461 if (elementOp == SkRegion::kReplace_Op) {
1462 devPath = operand;
1463 } else {
1464 Op(devPath, operand, (SkPathOp) elementOp, &devPath);
1465 }
1466 // if the prev and curr clips disagree about aa -vs- not, favor the aa request.
1467 // perhaps we need an API change to avoid this sort of mixed-signals about
1468 // clipping.
1469 if (element->isAA()) {
1470 edgeStyle = kSoft_ClipEdgeStyle;
1471 }
1472 } 1452 }
1453
1473 op = SkRegion::kReplace_Op; 1454 op = SkRegion::kReplace_Op;
1474 } 1455 }
1475 1456
1476 rasterclip_path(&fMCRec->fRasterClip, this, devPath, op, edgeStyle); 1457 rasterclip_path(&fMCRec->fRasterClip, this, devPath, op, edgeStyle);
1477 } 1458 }
1478 1459
1479 void SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) { 1460 void SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) {
1480 this->checkForDeferredSave(); 1461 this->checkForDeferredSave();
1481 this->onClipRegion(rgn, op); 1462 this->onClipRegion(rgn, op);
1482 } 1463 }
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 } 2557 }
2577 2558
2578 if (matrix) { 2559 if (matrix) {
2579 canvas->concat(*matrix); 2560 canvas->concat(*matrix);
2580 } 2561 }
2581 } 2562 }
2582 2563
2583 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2564 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2584 fCanvas->restoreToCount(fSaveCount); 2565 fCanvas->restoreToCount(fSaveCount);
2585 } 2566 }
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