aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-11 14:35:23 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-11 14:35:23 +0000
commit7324415759fe0c5a0902877b664aa942a89bd940 (patch)
tree9ce2ff069081c11aae41a7ae09effa146d56abfd /src/core
parent39a74751795351ee98b5bdb40510157eff4e4363 (diff)
use mapPoints instead of mapXY for the 2 corners of a rect (faster)
git-svn-id: http://skia.googlecode.com/svn/trunk@3906 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkDraw.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 549e23bcc4..a060bbb4f0 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -708,9 +708,12 @@ SkDraw::RectType SkDraw::ComputeRectType(const SkPaint& paint,
return rtype;
}
-static SkPoint* rect_points(SkRect& r, int index) {
- SkASSERT((unsigned)index < 2);
- return &((SkPoint*)(void*)&r)[index];
+static const SkPoint* rect_points(const SkRect& r) {
+ return (const SkPoint*)(void*)&r;
+}
+
+static SkPoint* rect_points(SkRect& r) {
+ return (SkPoint*)(void*)&r;
}
void SkDraw::drawRect(const SkRect& rect, const SkPaint& paint) const {
@@ -742,18 +745,15 @@ void SkDraw::drawRect(const SkRect& rect, const SkPaint& paint) const {
SkRect devRect;
// transform rect into devRect
- {
- matrix.mapXY(rect.fLeft, rect.fTop, rect_points(devRect, 0));
- matrix.mapXY(rect.fRight, rect.fBottom, rect_points(devRect, 1));
- devRect.sort();
- }
+ matrix.mapPoints(rect_points(devRect), rect_points(rect), 2);
+ devRect.sort();
if (fBounder && !fBounder->doRect(devRect, paint)) {
return;
}
// look for the quick exit, before we build a blitter
- {
+ if (true) {
SkIRect ir;
devRect.roundOut(&ir);
if (paint.getStyle() != SkPaint::kFill_Style) {