aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkDraw.cpp12
-rw-r--r--src/core/SkRRect.cpp3
-rw-r--r--src/core/SkRasterizer.cpp3
-rw-r--r--src/core/SkScan_Antihair.cpp2
-rw-r--r--src/core/SkScan_Hairline.cpp11
5 files changed, 9 insertions, 22 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index bd4e40e9f1..ef268bfed3 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -2181,11 +2181,7 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
}
// init our bounds from the path
- {
- SkRect pathBounds = devPath.getBounds();
- pathBounds.inset(-SK_ScalarHalf, -SK_ScalarHalf);
- pathBounds.roundOut(bounds);
- }
+ *bounds = devPath.getBounds().makeOutset(SK_ScalarHalf, SK_ScalarHalf).roundOut();
SkIPoint margin = SkIPoint::Make(0, 0);
if (filter) {
@@ -2204,7 +2200,6 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
// (possibly) trim the bounds to reflect the clip
// (plus whatever slop the filter needs)
if (clipBounds) {
- SkIRect tmp = *clipBounds;
// Ugh. Guard against gigantic margins from wacky filters. Without this
// check we can request arbitrary amounts of slop beyond our visible
// clip, and bring down the renderer (at least on finite RAM machines
@@ -2212,9 +2207,8 @@ static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
// quality of large filters like blurs, and the corresponding memory
// requests.
static const int MAX_MARGIN = 128;
- tmp.inset(-SkMin32(margin.fX, MAX_MARGIN),
- -SkMin32(margin.fY, MAX_MARGIN));
- if (!bounds->intersect(tmp)) {
+ if (!bounds->intersect(clipBounds->makeOutset(SkMin32(margin.fX, MAX_MARGIN),
+ SkMin32(margin.fY, MAX_MARGIN)))) {
return false;
}
}
diff --git a/src/core/SkRRect.cpp b/src/core/SkRRect.cpp
index f2927644da..d8b4a20d88 100644
--- a/src/core/SkRRect.cpp
+++ b/src/core/SkRRect.cpp
@@ -453,9 +453,8 @@ bool SkRRect::transform(const SkMatrix& matrix, SkRRect* dst) const {
///////////////////////////////////////////////////////////////////////////////
void SkRRect::inset(SkScalar dx, SkScalar dy, SkRRect* dst) const {
- SkRect r = fRect;
+ const SkRect r = fRect.makeInset(dx, dy);
- r.inset(dx, dy);
if (r.isEmpty()) {
dst->setEmpty();
return;
diff --git a/src/core/SkRasterizer.cpp b/src/core/SkRasterizer.cpp
index 3a7af95555..ab9e011761 100644
--- a/src/core/SkRasterizer.cpp
+++ b/src/core/SkRasterizer.cpp
@@ -27,8 +27,7 @@ bool SkRasterizer::rasterize(const SkPath& fillPath, const SkMatrix& matrix,
if (!filter->filterMask(&dstM, srcM, matrix, &margin)) {
return false;
}
- storage = *clipBounds;
- storage.inset(-margin.fX, -margin.fY);
+ storage = clipBounds->makeOutset(margin.fX, margin.fY);
clipBounds = &storage;
}
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index d0341510a9..a3305e2dc8 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -625,7 +625,7 @@ void SkScan::AntiHairLineRgn(const SkPoint& pt0, const SkPoint& pt1,
since the 1/2 pixel boundary is important to the antihair blitter,
we don't want to risk numerical fate by chopping on that edge.
*/
- clipBounds.inset(-SK_Scalar1, -SK_Scalar1);
+ clipBounds.outset(SK_Scalar1, SK_Scalar1);
if (!SkLineClipper::IntersectLine(pts, clipBounds, pts)) {
return;
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index 7ca54eac33..bd597b3d68 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -267,9 +267,7 @@ static void hair_path(const SkPath& path, const SkRasterClip& rclip,
const SkRegion* clip = NULL;
{
- SkIRect ibounds;
- path.getBounds().roundOut(&ibounds);
- ibounds.inset(-1, -1);
+ const SkIRect ibounds = path.getBounds().roundOut().makeOutset(1, 1);
if (rclip.quickReject(ibounds)) {
return;
@@ -379,7 +377,7 @@ void SkScan::HairLine(const SkPoint& p0, const SkPoint& p1,
SkRect r;
r.set(p0.fX, p0.fY, p1.fX, p1.fY);
r.sort();
- r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
+ r.outset(SK_ScalarHalf, SK_ScalarHalf);
SkAAClipBlitterWrapper wrap;
if (!clip.quickContains(r.roundOut())) {
@@ -398,14 +396,11 @@ void SkScan::AntiHairLine(const SkPoint& p0, const SkPoint& p1,
} else {
const SkRegion* clipRgn = NULL;
SkRect r;
- SkIRect ir;
r.set(p0.fX, p0.fY, p1.fX, p1.fY);
r.sort();
- r.roundOut(&ir);
- ir.inset(-1, -1);
SkAAClipBlitterWrapper wrap;
- if (!clip.quickContains(ir)) {
+ if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) {
wrap.init(clip, blitter);
blitter = wrap.getBlitter();
clipRgn = &wrap.getRgn();