aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-08-04 15:54:41 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-04 15:54:41 -0700
commitac09554dce518e9d4496771f648f3ae17eca857c (patch)
tree9f3b295624d7f8de4c3ab17c0b08ae8a3c2f6408
parent3b88a03e987d4be17b46da1dd646c663d324d2ae (diff)
check zero-length text draws
-rw-r--r--src/core/SkCanvas.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 0b0434dab8..d42c726c6c 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) {