aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDraw.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-03-06 13:40:24 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-06 19:56:46 +0000
commitbe1b3971806e3d80aa9673a36e2b35d0145198ac (patch)
treefec8c2a345951fdd14b4c5da392586f231cb9c92 /src/core/SkDraw.cpp
parent18e9ba1eddb09bff6083f9a83dc569d3b3b54fe6 (diff)
add tiler for SkDraw
Bug: skia:2122 Change-Id: I276de2064939151eef5fa14c53188e8b5728b7c9 Reviewed-on: https://skia-review.googlesource.com/110840 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r--src/core/SkDraw.cpp74
1 files changed, 32 insertions, 42 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 21a89ae5a9..cf06b7b3b5 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -14,7 +14,6 @@
#include "SkCanvas.h"
#include "SkColorData.h"
#include "SkDevice.h"
-#include "SkDeviceLooper.h"
#include "SkDraw.h"
#include "SkDrawProcs.h"
#include "SkFindAndPlaceGlyph.h"
@@ -785,8 +784,7 @@ void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint,
}
}
- if (!SkRectPriv::MakeLargeS32().contains(bbox)) {
- // bbox.roundOut() is undefined; use slow path.
+ if (!SkRectPriv::FitsInFixed(bbox) && rtype != kHair_RectType) {
draw_rect_as_path(*this, prePaintRect, paint, matrix);
return;
}
@@ -796,45 +794,37 @@ void SkDraw::drawRect(const SkRect& prePaintRect, const SkPaint& paint,
return;
}
- SkDeviceLooper looper(fDst, *fRC, ir, paint.isAntiAlias());
- while (looper.next()) {
- SkRect localDevRect;
- looper.mapRect(&localDevRect, devRect);
- SkMatrix localMatrix;
- looper.mapMatrix(&localMatrix, *matrix);
-
- SkAutoBlitterChoose blitterStorage(looper.getPixmap(), localMatrix, paint);
- const SkRasterClip& clip = looper.getRC();
- SkBlitter* blitter = blitterStorage.get();
-
- // we want to "fill" if we are kFill or kStrokeAndFill, since in the latter
- // case we are also hairline (if we've gotten to here), which devolves to
- // effectively just kFill
- switch (rtype) {
- case kFill_RectType:
- if (paint.isAntiAlias()) {
- SkScan::AntiFillRect(localDevRect, clip, blitter);
- } else {
- SkScan::FillRect(localDevRect, clip, blitter);
- }
- break;
- case kStroke_RectType:
- if (paint.isAntiAlias()) {
- SkScan::AntiFrameRect(localDevRect, strokeSize, clip, blitter);
- } else {
- SkScan::FrameRect(localDevRect, strokeSize, clip, blitter);
- }
- break;
- case kHair_RectType:
- if (paint.isAntiAlias()) {
- SkScan::AntiHairRect(localDevRect, clip, blitter);
- } else {
- SkScan::HairRect(localDevRect, clip, blitter);
- }
- break;
- default:
- SkDEBUGFAIL("bad rtype");
- }
+ SkAutoBlitterChoose blitterStorage(fDst, *matrix, paint);
+ const SkRasterClip& clip = *fRC;
+ SkBlitter* blitter = blitterStorage.get();
+
+ // we want to "fill" if we are kFill or kStrokeAndFill, since in the latter
+ // case we are also hairline (if we've gotten to here), which devolves to
+ // effectively just kFill
+ switch (rtype) {
+ case kFill_RectType:
+ if (paint.isAntiAlias()) {
+ SkScan::AntiFillRect(devRect, clip, blitter);
+ } else {
+ SkScan::FillRect(devRect, clip, blitter);
+ }
+ break;
+ case kStroke_RectType:
+ if (paint.isAntiAlias()) {
+ SkScan::AntiFrameRect(devRect, strokeSize, clip, blitter);
+ } else {
+ SkScan::FrameRect(devRect, strokeSize, clip, blitter);
+ }
+ break;
+ case kHair_RectType:
+ if (paint.isAntiAlias()) {
+ SkScan::AntiHairRect(devRect, clip, blitter);
+ } else {
+ SkScan::HairRect(devRect, clip, blitter);
+ }
+ break;
+ default:
+ SkDEBUGFAIL("bad rtype");
}
}