| OLD | NEW |
| 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 | 8 |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 // we explicitly call "our" version of clipPath. | 1294 // we explicitly call "our" version of clipPath. |
| 1295 SkPath path; | 1295 SkPath path; |
| 1296 | 1296 |
| 1297 path.addRect(rect); | 1297 path.addRect(rect); |
| 1298 this->SkCanvas::onClipPath(path, op, edgeStyle); | 1298 this->SkCanvas::onClipPath(path, op, edgeStyle); |
| 1299 } | 1299 } |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 static void rasterclip_path(SkRasterClip* rc, const SkCanvas* canvas, const SkPa
th& devPath, | 1302 static void rasterclip_path(SkRasterClip* rc, const SkCanvas* canvas, const SkPa
th& devPath, |
| 1303 SkRegion::Op op, bool doAA) { | 1303 SkRegion::Op op, bool doAA) { |
| 1304 // base is used to limit the size (and therefore memory allocation) of the | 1304 rc->op(devPath, canvas->getBaseLayerSize(), op, doAA); |
| 1305 // region that results from scan converting devPath. | |
| 1306 SkRegion base; | |
| 1307 | |
| 1308 if (SkRegion::kIntersect_Op == op) { | |
| 1309 // since we are intersect, we can do better (tighter) with currRgn's | |
| 1310 // bounds, than just using the device. However, if currRgn is complex, | |
| 1311 // our region blitter may hork, so we do that case in two steps. | |
| 1312 if (rc->isRect()) { | |
| 1313 // FIXME: we should also be able to do this when rc->isBW(), | |
| 1314 // but relaxing the test above triggers GM asserts in | |
| 1315 // SkRgnBuilder::blitH(). We need to investigate what's going on. | |
| 1316 rc->setPath(devPath, rc->bwRgn(), doAA); | |
| 1317 } else { | |
| 1318 base.setRect(rc->getBounds()); | |
| 1319 SkRasterClip clip; | |
| 1320 clip.setPath(devPath, base, doAA); | |
| 1321 rc->op(clip, op); | |
| 1322 } | |
| 1323 } else { | |
| 1324 const SkISize size = canvas->getBaseLayerSize(); | |
| 1325 base.setRect(0, 0, size.width(), size.height()); | |
| 1326 | |
| 1327 if (SkRegion::kReplace_Op == op) { | |
| 1328 rc->setPath(devPath, base, doAA); | |
| 1329 } else { | |
| 1330 SkRasterClip clip; | |
| 1331 clip.setPath(devPath, base, doAA); | |
| 1332 rc->op(clip, op); | |
| 1333 } | |
| 1334 } | |
| 1335 } | 1305 } |
| 1336 | 1306 |
| 1337 void SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { | 1307 void SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { |
| 1338 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; | 1308 ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle; |
| 1339 if (rrect.isRect()) { | 1309 if (rrect.isRect()) { |
| 1340 this->onClipRect(rrect.getBounds(), op, edgeStyle); | 1310 this->onClipRect(rrect.getBounds(), op, edgeStyle); |
| 1341 } else { | 1311 } else { |
| 1342 this->onClipRRect(rrect, op, edgeStyle); | 1312 this->onClipRRect(rrect, op, edgeStyle); |
| 1343 } | 1313 } |
| 1344 } | 1314 } |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2562 } | 2532 } |
| 2563 | 2533 |
| 2564 if (matrix) { | 2534 if (matrix) { |
| 2565 canvas->concat(*matrix); | 2535 canvas->concat(*matrix); |
| 2566 } | 2536 } |
| 2567 } | 2537 } |
| 2568 | 2538 |
| 2569 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2539 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
| 2570 fCanvas->restoreToCount(fSaveCount); | 2540 fCanvas->restoreToCount(fSaveCount); |
| 2571 } | 2541 } |
| OLD | NEW |