SkCanvas::onDrawPicture() quick-reject
authorfmalita <fmalita@chromium.org>
Thu, 20 Aug 2015 19:08:18 +0000 (12:08 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 20 Aug 2015 19:08:18 +0000 (12:08 -0700)
R=reed@google.com,mtklein@google.com

Review URL: https://codereview.chromium.org/1264133003

src/core/SkCanvas.cpp

index 02afe92e335e5df4b16014d1ff2933c82620f7d6..daf8425f57fb9b395de3f3984995a39e15669f0a 100644 (file)
@@ -2774,6 +2774,19 @@ void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, con
 
 void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
                              const SkPaint* paint) {
+    if (!paint || paint->canComputeFastBounds()) {
+        SkRect bounds = picture->cullRect();
+        if (paint) {
+            paint->computeFastBounds(bounds, &bounds);
+        }
+        if (matrix) {
+            matrix->mapRect(&bounds);
+        }
+        if (this->quickReject(bounds)) {
+            return;
+        }
+    }
+
     SkBaseDevice* device = this->getTopDevice();
     if (device) {
         // Canvas has to first give the device the opportunity to render