Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
8251027: DrawString with TexturePaint is corrupted
Browse files Browse the repository at this point in the history
  • Loading branch information
jayathirthrao committed Aug 28, 2020
1 parent 47ea44d commit 1be6d47
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Expand Up @@ -113,8 +113,7 @@
sw = ((sx + tw) > sx2) ? (sx2 - sx) : tw;
MTLVertexCache_AddMaskQuad(mtlc,
sx, sy, x, y, sw, sh,
MTLVC_MASK_CACHE_TILE_WIDTH, pMask, dstOps,
MTLVC_MASK_CACHE_TILE_WIDTH);
maskscan, pMask, dstOps);
}
}

Expand Down
Expand Up @@ -714,8 +714,7 @@
MTLVertexCache_AddMaskQuad(mtlc,
sx, sy, x, y, sw, sh,
w, ginfo->image,
dstOps,
ginfo->width);
dstOps);
}
}

Expand Down
Expand Up @@ -78,8 +78,7 @@ void MTLVertexCache_AddMaskQuad(MTLContext *mtlc,
jint dstx, jint dsty,
jint width, jint height,
jint maskscan, void *mask,
BMTLSDOps *dstOps,
jint fullwidth);
BMTLSDOps *dstOps);
void
MTLVertexCache_AddGlyphQuad(MTLContext *mtlc,
jfloat tx1, jfloat ty1, jfloat tx2, jfloat ty2,
Expand Down
Expand Up @@ -260,8 +260,7 @@ void MTLVertexCache_FreeVertexCache()
jint dstx, jint dsty,
jint width, jint height,
jint maskscan, void *mask,
BMTLSDOps *dstOps,
jint fullwidth)
BMTLSDOps *dstOps)
{
jfloat tx1, ty1, tx2, ty2;
jfloat dx1, dy1, dx2, dy2;
Expand All @@ -286,8 +285,8 @@ void MTLVertexCache_FreeVertexCache()
(maskCacheIndex % MTLVC_MASK_CACHE_WIDTH_IN_TILES);
jint texy = MTLVC_MASK_CACHE_TILE_HEIGHT *
(maskCacheIndex / MTLVC_MASK_CACHE_WIDTH_IN_TILES);
J2dTraceLn5(J2D_TRACE_INFO, "texx = %d texy = %d width = %d height = %d fullwidth = %d", texx, texy, width,
height, fullwidth);
J2dTraceLn5(J2D_TRACE_INFO, "texx = %d texy = %d width = %d height = %d maskscan = %d", texx, texy, width,
height, maskscan);
NSUInteger bytesPerRow = 1 * width;
NSUInteger slice = bytesPerRow * srcy + srcx;
MTLRegion region = {
Expand All @@ -305,7 +304,7 @@ void MTLVertexCache_FreeVertexCache()
// We can use MTLBuffer and then copy source subtexture but that
// adds extra blitting logic.
// TODO : Research more and try removing memcpy logic.
if (fullwidth <= width) {
if (maskscan <= width) {
int height_offset = bytesPerRow * srcy;
[maskCacheTex.texture replaceRegion:region
mipmapLevel:0
Expand All @@ -318,7 +317,7 @@ void MTLVertexCache_FreeVertexCache()
dst_offset = 0;
for (int i = srcy; i < srcy + height; i++) {
J2dTraceLn2(J2D_TRACE_INFO, "srcx = %d srcy = %d", srcx, srcy);
src_offset = fullwidth * i + srcx;
src_offset = maskscan * i + srcx;
J2dTraceLn2(J2D_TRACE_INFO, "src_offset = %d dst_offset = %d", src_offset, dst_offset);
memcpy(tile + dst_offset, mask + src_offset, width);
dst_offset = dst_offset + width;
Expand Down

0 comments on commit 1be6d47

Please sign in to comment.