Apply filterTextFlags so the fonts are the same.
In order to apply filterTextFlags correctly, teach
TrackLayerDevice how to process save and restore layers.
At this point, I don't see any other traffic than the
cache warming traffic.
This code has a performance between 82% and 105% of just
drawing the picture.
BUG=skia:7515
Change-Id: I44736be46884f18b6d120d4b5ca582f34dbdff0f
Reviewed-on: https://skia-review.googlesource.com/114641
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 2f31335..24a6d4a 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -52,58 +52,6 @@
#define RETURN_ON_NULL(ptr) do { if (nullptr == (ptr)) return; } while (0)
#define RETURN_ON_FALSE(pred) do { if (!(pred)) return; } while (0)
-class SkNoPixelsDevice : public SkBaseDevice {
-public:
- SkNoPixelsDevice(const SkIRect& bounds, const SkSurfaceProps& props)
- : SkBaseDevice(SkImageInfo::MakeUnknown(bounds.width(), bounds.height()), props)
- {
- // this fails if we enable this assert: DiscardableImageMapTest.GetDiscardableImagesInRectMaxImage
- //SkASSERT(bounds.width() >= 0 && bounds.height() >= 0);
- }
-
- void resetForNextPicture(const SkIRect& bounds) {
- //SkASSERT(bounds.width() >= 0 && bounds.height() >= 0);
- this->privateResize(bounds.width(), bounds.height());
- }
-
-protected:
- // We don't track the clip at all (for performance), but we have to respond to some queries.
- // We pretend to be wide-open. We could pretend to always be empty, but that *seems* worse.
- void onSave() override {}
- void onRestore() override {}
- void onClipRect(const SkRect& rect, SkClipOp, bool aa) override {}
- void onClipRRect(const SkRRect& rrect, SkClipOp, bool aa) override {}
- void onClipPath(const SkPath& path, SkClipOp, bool aa) override {}
- void onClipRegion(const SkRegion& deviceRgn, SkClipOp) override {}
- void onSetDeviceClipRestriction(SkIRect* mutableClipRestriction) override {}
- bool onClipIsAA() const override { return false; }
- void onAsRgnClip(SkRegion* rgn) const override {
- rgn->setRect(SkIRect::MakeWH(this->width(), this->height()));
- }
- ClipType onGetClipType() const override {
- return kRect_ClipType;
- }
-
- void drawPaint(const SkPaint& paint) override {}
- void drawPoints(SkCanvas::PointMode, size_t, const SkPoint[], const SkPaint&) override {}
- void drawRect(const SkRect&, const SkPaint&) override {}
- void drawOval(const SkRect&, const SkPaint&) override {}
- void drawRRect(const SkRRect&, const SkPaint&) override {}
- void drawPath(const SkPath&, const SkPaint&, const SkMatrix*, bool) override {}
- void drawBitmap(const SkBitmap&, SkScalar x, SkScalar y, const SkPaint&) override {}
- void drawSprite(const SkBitmap&, int, int, const SkPaint&) override {}
- void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint&,
- SkCanvas::SrcRectConstraint) override {}
- void drawText(const void*, size_t, SkScalar, SkScalar, const SkPaint&) override {}
- void drawPosText(const void*, size_t, const SkScalar[], int, const SkPoint&,
- const SkPaint&) override {}
- void drawDevice(SkBaseDevice*, int, int, const SkPaint&) override {}
- void drawVertices(const SkVertices*, SkBlendMode, const SkPaint&) override {}
-
-private:
- typedef SkBaseDevice INHERITED;
-};
-
///////////////////////////////////////////////////////////////////////////////////////////////////
/*
@@ -974,7 +922,6 @@
return true;
}
-
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
return this->saveLayer(SaveLayerRec(bounds, paint, 0));
}
@@ -2907,6 +2854,9 @@
SkNoDrawCanvas::SkNoDrawCanvas(const SkIRect& bounds)
: INHERITED(bounds, kConservativeRasterClip_InitFlag) {}
+SkNoDrawCanvas::SkNoDrawCanvas(SkBaseDevice *device)
+ : INHERITED(device) {}
+
SkCanvas::SaveLayerStrategy SkNoDrawCanvas::getSaveLayerStrategy(const SaveLayerRec& rec) {
(void)this->INHERITED::getSaveLayerStrategy(rec);
return kNoLayer_SaveLayerStrategy;