From 1a8f234f616063ee2990c681f269c81ca1575298 Mon Sep 17 00:00:00 2001 From: Jim Van Verth Date: Thu, 26 Oct 2017 14:27:10 -0400 Subject: [PATCH] Fix assert in text clipping. The original code was truncating to int rather than taking the floor. This would give us the wrong integer value for negative numbers. Bug: skia:7225 Change-Id: Ief6a01358d936dd3b3e1d36af569274995c2586e Reviewed-on: https://skia-review.googlesource.com/64064 Commit-Queue: Jim Van Verth Reviewed-by: Greg Daniel Reviewed-by: Robert Phillips --- src/gpu/ops/GrAtlasTextOp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp index 21e7c6fa69..591afb2770 100644 --- a/src/gpu/ops/GrAtlasTextOp.cpp +++ b/src/gpu/ops/GrAtlasTextOp.cpp @@ -84,10 +84,10 @@ static void clip_quads(const SkIRect& clipRect, SkPoint* blobPositionRB = reinterpret_cast(blobVertices + 3*vertexStride); // positions for bitmap glyphs are pixel boundary aligned - SkIRect positionRect = SkIRect::MakeLTRB(blobPositionLT->fX, - blobPositionLT->fY, - blobPositionRB->fX, - blobPositionRB->fY); + SkIRect positionRect = SkIRect::MakeLTRB(SkScalarFloorToInt(blobPositionLT->fX), + SkScalarFloorToInt(blobPositionLT->fY), + SkScalarFloorToInt(blobPositionRB->fX), + SkScalarFloorToInt(blobPositionRB->fY)); if (clipRect.contains(positionRect)) { memcpy(currVertex, blobVertices, 4 * vertexStride); currVertex += 4 * vertexStride;