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

Unified Diff: src/core/SkCanvas.cpp

Issue 494763004: Quick-reject draw text blob calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Don't quickreject empty bounds. Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index af25b46f3f808f386a04387a14eb78a36fe418bd..e4a5caf067124f664b3daa0ead7b8a00d59869f6 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2220,9 +2220,29 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
SkASSERT(blob);
+ bool hasOffset = x || y;
+
+ // FIXME: temporarily disable quickreject for empty bounds,
+ // pending implicit blob bounds implementation.
+ if (!blob->bounds().isEmpty() && paint.canComputeFastBounds()) {
+ SkRect storage;
reed1 2014/08/29 15:34:28 I wonder if we should send the translated rect to
f(malita) 2014/08/29 16:01:26 Done.
+ const SkRect* bounds = &paint.computeFastBounds(blob->bounds(), &storage);
+ if (hasOffset) {
+ if (bounds != &storage) {
+ storage = *bounds;
+ bounds = &storage;
+ }
+ storage.offset(x, y);
+ }
+
+ if (this->quickReject(*bounds)) {
+ return;
+ }
+ }
+
// FIXME: dispatch to the device instead
- if (x || y) {
+ if (hasOffset) {
this->translate(x, y);
reed1 2014/08/29 15:34:28 Eeeek! translate is virtual. I thought all of this
f(malita) 2014/08/29 15:36:39 It is now, just haven't rebased this yet :)
}
@@ -2252,7 +2272,7 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
it.next();
}
- if (x || y) {
+ if (hasOffset) {
this->translate(-x, -y);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698