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

Unified Diff: src/core/SkCanvas.cpp

Issue 2215113002: check zero-length text draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 0b0434dab895963f0132fcbabe7ca99d93b3e8a2..d42c726c6c6a24c6ca7689bc68937ba616d1c710 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2746,22 +2746,30 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
void SkCanvas::drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawText()");
- this->onDrawText(text, byteLength, x, y, paint);
+ if (byteLength) {
+ this->onDrawText(text, byteLength, x, y, paint);
+ }
}
void SkCanvas::drawPosText(const void* text, size_t byteLength, const SkPoint pos[],
const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPosText()");
- this->onDrawPosText(text, byteLength, pos, paint);
+ if (byteLength) {
+ this->onDrawPosText(text, byteLength, pos, paint);
+ }
}
void SkCanvas::drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
SkScalar constY, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPosTextH()");
- this->onDrawPosTextH(text, byteLength, xpos, constY, paint);
+ if (byteLength) {
+ this->onDrawPosTextH(text, byteLength, xpos, constY, paint);
+ }
}
void SkCanvas::drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawTextOnPath()");
- this->onDrawTextOnPath(text, byteLength, path, matrix, paint);
+ if (byteLength) {
+ this->onDrawTextOnPath(text, byteLength, path, matrix, paint);
+ }
}
void SkCanvas::drawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
const SkRect* cullRect, const SkPaint& paint) {
« 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