aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-07-31 08:00:25 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-31 13:22:42 +0000
commitb3f6ac44dba7b8bc30c37753c7ce1257633525d6 (patch)
treedb54f04a59705762034d7ed8792b78525e1542fc /src
parent1eace2db482c9d91e5375783a073941a640a5a76 (diff)
Don't create GrAtlasTextBlobs for zero glyph count text draws.
Bug: chromium:749472 Change-Id: I709889dd6bb06032e30cbf820ca67e7534cfac58 Reviewed-on: https://skia-review.googlesource.com/28540 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 22228ed2b6..3ddf4ff69d 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -241,7 +241,9 @@ GrAtlasTextContext::MakeDrawTextBlob(GrTextBlobCache* blobCache,
const char text[], size_t byteLength,
SkScalar x, SkScalar y) {
int glyphCount = paint.skPaint().countText(text, byteLength);
-
+ if (!glyphCount) {
+ return nullptr;
+ }
sk_sp<GrAtlasTextBlob> blob = blobCache->makeBlob(glyphCount, 1);
blob->initThrowawayBlob(viewMatrix, x, y);
@@ -267,6 +269,9 @@ GrAtlasTextContext::MakeDrawPosTextBlob(GrTextBlobCache* blobCache,
const SkScalar pos[], int scalarsPerPosition, const
SkPoint& offset) {
int glyphCount = paint.skPaint().countText(text, byteLength);
+ if (!glyphCount) {
+ return nullptr;
+ }
sk_sp<GrAtlasTextBlob> blob = blobCache->makeBlob(glyphCount, 1);
blob->initThrowawayBlob(viewMatrix, offset.x(), offset.y());
@@ -297,8 +302,10 @@ void GrAtlasTextContext::drawText(GrContext* context, GrRenderTargetContext* rtc
paint, ComputeScalerContextFlags(rtc),
viewMatrix, props,
text, byteLength, x, y));
- blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable.get(), paint, clip,
- viewMatrix, regionClipBounds, x, y);
+ if (blob) {
+ blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable.get(), paint, clip,
+ viewMatrix, regionClipBounds, x, y);
+ }
return;
}
@@ -325,8 +332,10 @@ void GrAtlasTextContext::drawPosText(GrContext* context, GrRenderTargetContext*
text, byteLength,
pos, scalarsPerPosition,
offset));
- blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable.get(), paint, clip,
- viewMatrix, regionClipBounds, offset.fX, offset.fY);
+ if (blob) {
+ blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable.get(), paint, clip,
+ viewMatrix, regionClipBounds, offset.fX, offset.fY);
+ }
return;
}