add roundOut that returns its result
BUG=skia:
Review URL: https://codereview.chromium.org/742663002
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 5204fdb..9df7c9b 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -260,8 +260,7 @@
// since we may need to clamp to the borders of the src rect within
// the bitmap, we extract a subset.
- SkIRect srcIR;
- tmpSrc.roundOut(&srcIR);
+ const SkIRect srcIR = tmpSrc.roundOut();
if(bitmap.pixelRef()->getTexture()) {
// Accelerated source canvas, don't use extractSubset but readPixels to get the subset.
// This way, the pixels are copied in CPU memory instead of GPU memory.
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 8d17be7..4fda7a3 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1586,9 +1586,7 @@
if (fMCRec->fMatrix.hasPerspective()) {
SkRect dst;
fMCRec->fMatrix.mapRect(&dst, rect);
- SkIRect idst;
- dst.roundOut(&idst);
- return !SkIRect::Intersects(idst, fMCRec->fRasterClip.getBounds());
+ return !SkIRect::Intersects(dst.roundOut(), fMCRec->fRasterClip.getBounds());
} else {
const SkRect& clipR = this->getLocalClipBounds();
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 95d348e..7ccd258 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -813,8 +813,7 @@
devRect.sort();
// look for the quick exit, before we build a blitter
- SkIRect ir;
- devRect.roundOut(&ir);
+ SkIRect ir = devRect.roundOut();
if (paint.getStyle() != SkPaint::kFill_Style) {
// extra space for hairlines
if (paint.getStrokeWidth() == 0) {
@@ -1210,11 +1209,8 @@
static bool clipped_out(const SkMatrix& m, const SkRasterClip& c,
const SkRect& srcR) {
SkRect dstR;
- SkIRect devIR;
-
m.mapRect(&dstR, srcR);
- dstR.roundOut(&devIR);
- return c.quickReject(devIR);
+ return c.quickReject(dstR.roundOut());
}
static bool clipped_out(const SkMatrix& matrix, const SkRasterClip& clip,
@@ -2282,7 +2278,7 @@
#include "SkBlitter.h"
static bool compute_bounds(const SkPath& devPath, const SkIRect* clipBounds,
- const SkMaskFilter* filter, const SkMatrix* filterMatrix,
+ const SkMaskFilter* filter, const SkMatrix* filterMatrix,
SkIRect* bounds) {
if (devPath.isEmpty()) {
return false;
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 8f49a06..79f04b8 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -290,8 +290,7 @@
srcBounds.offset(srcOffset);
SkRect cropRect;
ctx.ctm().mapRect(&cropRect, fCropRect.rect());
- SkIRect cropRectI;
- cropRect.roundOut(&cropRectI);
+ const SkIRect cropRectI = cropRect.roundOut();
uint32_t flags = fCropRect.flags();
if (flags & CropRect::kHasLeft_CropEdge) srcBounds.fLeft = cropRectI.fLeft;
if (flags & CropRect::kHasTop_CropEdge) srcBounds.fTop = cropRectI.fTop;
@@ -311,8 +310,7 @@
srcBounds.offset(*srcOffset);
SkRect cropRect;
ctx.ctm().mapRect(&cropRect, fCropRect.rect());
- SkIRect cropRectI;
- cropRect.roundOut(&cropRectI);
+ const SkIRect cropRectI = cropRect.roundOut();
uint32_t flags = fCropRect.flags();
*bounds = srcBounds;
if (flags & CropRect::kHasLeft_CropEdge) bounds->fLeft = cropRectI.fLeft;
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 86f303c..28c9a38 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -337,7 +337,7 @@
SkMask srcM, dstM;
srcM.fImage = NULL;
- src.roundOut(&srcM.fBounds);
+ srcM.fBounds = src.roundOut();
srcM.fRowBytes = 0;
srcM.fFormat = SkMask::kA8_Format;
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp
index f820c5a..35197c1 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -76,9 +76,6 @@
/////////////////////////////////////////////////////////////////////////////////////
bool SkRasterClip::setConservativeRect(const SkRect& r, const SkIRect& clipR, bool isInverse) {
- SkIRect ir;
- r.roundOut(&ir);
-
SkRegion::Op op;
if (isInverse) {
op = SkRegion::kDifference_Op;
@@ -86,7 +83,7 @@
op = SkRegion::kIntersect_Op;
}
fBW.setRect(clipR);
- fBW.op(ir, op);
+ fBW.op(r.roundOut(), op);
return this->updateCacheAndReturnNonEmpty();
}
@@ -178,7 +175,7 @@
ir = SkIRect::MakeSize(size);
break;
case kContinue_MutateResult:
- path.getBounds().roundOut(&ir);
+ ir = path.getBounds().roundOut();
break;
}
return this->op(ir, op);
@@ -287,7 +284,7 @@
ir = SkIRect::MakeSize(size);
break;
case kContinue_MutateResult:
- r.roundOut(&ir);
+ ir = r.roundOut();
break;
}
return this->op(ir, op);
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 8cb416e..20413a7 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -167,8 +167,7 @@
}
} else {
// just use devPath
- SkIRect ir;
- devPath.getBounds().roundOut(&ir);
+ const SkIRect ir = devPath.getBounds().roundOut();
if (ir.isEmpty() || !ir.is16Bit()) {
goto SK_ERROR;
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index 1ad68e5..67c8917 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -854,8 +854,7 @@
return;
}
- SkIRect outerBounds;
- newR.roundOut(&outerBounds);
+ const SkIRect outerBounds = newR.roundOut();
if (clip->isRect()) {
antifillrect(newR, blitter);
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index 1e7e762..7ca54ea 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -377,14 +377,12 @@
} else {
const SkRegion* clipRgn = NULL;
SkRect r;
- SkIRect ir;
r.set(p0.fX, p0.fY, p1.fX, p1.fY);
r.sort();
r.inset(-SK_ScalarHalf, -SK_ScalarHalf);
- r.roundOut(&ir);
SkAAClipBlitterWrapper wrap;
- if (!clip.quickContains(ir)) {
+ if (!clip.quickContains(r.roundOut())) {
wrap.init(clip, blitter);
blitter = wrap.getBlitter();
clipRgn = &wrap.getRgn();