aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2014-11-19 05:03:18 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-19 05:03:18 -0800
commitb07a94f1cba3976596ae1a7f23d8c2043ba353f3 (patch)
tree9c2d202dc47a62742f950cb9702abc5e4327cf34 /src/core
parentb50612cbda6c289ac6d859810c37a2a03f0ae26a (diff)
add roundOut that returns its result
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkBitmapDevice.cpp3
-rw-r--r--src/core/SkCanvas.cpp4
-rw-r--r--src/core/SkDraw.cpp10
-rw-r--r--src/core/SkImageFilter.cpp6
-rw-r--r--src/core/SkMaskFilter.cpp2
-rw-r--r--src/core/SkRasterClip.cpp9
-rw-r--r--src/core/SkScalerContext.cpp3
-rw-r--r--src/core/SkScan_Antihair.cpp3
-rw-r--r--src/core/SkScan_Hairline.cpp4
9 files changed, 14 insertions, 30 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 5204fdb53e..9df7c9b655 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -260,8 +260,7 @@ void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
// 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 8d17be7bfe..4fda7a37b3 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1586,9 +1586,7 @@ bool SkCanvas::quickReject(const SkRect& rect) const {
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 95d348efc5..7ccd258ba8 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -813,8 +813,7 @@ void SkDraw::drawRect(const SkRect& rect, const SkPaint& paint) const {
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 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
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 @@ void SkDraw::validate() const {
#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 8f49a06c15..79f04b88ec 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -290,8 +290,7 @@ bool SkImageFilter::applyCropRect(const Context& ctx, const SkBitmap& src,
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 @@ bool SkImageFilter::applyCropRect(const Context& ctx, Proxy* proxy, const SkBitm
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 86f303c561..28c9a381d3 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -337,7 +337,7 @@ void SkMaskFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
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 f820c5a0a4..35197c1ad9 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -76,9 +76,6 @@ bool SkRasterClip::setRect(const SkIRect& rect) {
/////////////////////////////////////////////////////////////////////////////////////
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 @@ bool SkRasterClip::setConservativeRect(const SkRect& r, const SkIRect& clipR, bo
op = SkRegion::kIntersect_Op;
}
fBW.setRect(clipR);
- fBW.op(ir, op);
+ fBW.op(r.roundOut(), op);
return this->updateCacheAndReturnNonEmpty();
}
@@ -178,7 +175,7 @@ bool SkRasterClip::op(const SkPath& path, const SkISize& size, SkRegion::Op op,
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 @@ bool SkRasterClip::op(const SkRect& r, const SkISize& size, SkRegion::Op op, boo
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 8cb416e9ae..20413a7dd7 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -167,8 +167,7 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) {
}
} 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 1ad68e5075..67c8917f0a 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -854,8 +854,7 @@ void SkScan::AntiFillRect(const SkRect& origR, const SkRegion* clip,
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 1e7e762b5a..7ca54eac33 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -377,14 +377,12 @@ void SkScan::HairLine(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.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();