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

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: Rebased + translate bounds before passing to paint 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 2b08a94c85e603a434d35dece267c3ab96bb0498..19ba3346cfbe1e61150b93ea9ce632a9f4f32428 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -22,6 +22,7 @@
#include "SkSmallAllocator.h"
#include "SkSurface_Base.h"
#include "SkTemplates.h"
+#include "SkTextBlob.h"
#include "SkTextFormatParams.h"
#include "SkTLazy.h"
#include "SkUtils.h"
@@ -2217,6 +2218,23 @@ void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPat
void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
+
+ // FIXME: temporarily disable quickreject for empty bounds,
+ // pending implicit blob bounds implementation.
+ if (!blob->bounds().isEmpty() && paint.canComputeFastBounds()) {
+ SkRect storage;
+ const SkRect *bounds = &blob->bounds();
reed1 2014/08/29 16:22:56 Do we need local "bounds" or the if (x || y)? com
f(malita) 2014/08/29 16:32:01 Only if we want to avoid initializing a "translate
+
+ if (x || y) {
+ storage = bounds->makeOffset(x, y);
+ bounds = &storage;
+ }
+
+ if (this->quickReject(paint.computeFastBounds(*bounds, &storage))) {
+ return;
+ }
+ }
+
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
while (iter.next()) {
« 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