Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: src/core/SkDraw.cpp

Issue 23392006: add SkDeviceLooper to handle larger-than-fixedpoint (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 671da49d099dc826b75542944b834b4b9649851a..a9d5fbb0b63269d476a6cdba3a0263ff7d8ba28b 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
-
#include "SkDraw.h"
#include "SkBlitter.h"
#include "SkBounder.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
#include "SkDevice.h"
+#include "SkDeviceLooper.h"
#include "SkFixed.h"
#include "SkMaskFilter.h"
#include "SkPaint.h"
@@ -873,48 +873,56 @@ void SkDraw::drawRect(const SkRect& rect, const SkPaint& paint) const {
}
// look for the quick exit, before we build a blitter
- if (true) {
- SkIRect ir;
- devRect.roundOut(&ir);
- if (paint.getStyle() != SkPaint::kFill_Style) {
- // extra space for hairlines
- ir.inset(-1, -1);
- }
- if (fRC->quickReject(ir))
- return;
+ SkIRect ir;
+ devRect.roundOut(&ir);
+ if (paint.getStyle() != SkPaint::kFill_Style) {
+ // extra space for hairlines
+ ir.inset(-1, -1);
+ }
+ if (fRC->quickReject(ir)) {
+ return;
}
- SkAutoBlitterChoose blitterStorage(*fBitmap, 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");
+ SkDeviceLooper looper(*fBitmap, *fRC, ir, paint.isAntiAlias());
+ while (looper.next()) {
tomhudson 2013/08/28 10:53:05 This injects another degree of indirection & bunch
reed1 2013/08/28 12:35:07 There should be zero allocations in the (common) c
+ SkRect localDevRect;
+ looper.mapRect(&localDevRect, devRect);
+ SkMatrix localMatrix;
+ looper.mapMatrix(&localMatrix, matrix);
+
+ SkAutoBlitterChoose blitterStorage(looper.getBitmap(), 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");
+ }
}
}
@@ -2825,3 +2833,4 @@ bool SkDraw::DrawToMask(const SkPath& devPath, const SkIRect* clipBounds,
return true;
}
+

Powered by Google App Engine
This is Rietveld 408576698