Resolved some darwin/drawtext.m TODOs.
This commit is contained in:
parent
84d49cd45b
commit
243e210cbc
|
@ -167,7 +167,6 @@ void uiDrawFreeTextLayout(uiDrawTextLayout *tl)
|
||||||
uiFree(tl->u8tou16);
|
uiFree(tl->u8tou16);
|
||||||
[tl->backgroundBlocks release];
|
[tl->backgroundBlocks release];
|
||||||
uiFree(tl->lineMetrics);
|
uiFree(tl->lineMetrics);
|
||||||
// TODO release tl->lines?
|
|
||||||
CFRelease(tl->frame);
|
CFRelease(tl->frame);
|
||||||
CFRelease(tl->path);
|
CFRelease(tl->path);
|
||||||
CFRelease(tl->framesetter);
|
CFRelease(tl->framesetter);
|
||||||
|
@ -179,8 +178,11 @@ void uiDrawFreeTextLayout(uiDrawTextLayout *tl)
|
||||||
void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
|
void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
|
||||||
{
|
{
|
||||||
backgroundBlock b;
|
backgroundBlock b;
|
||||||
|
CGAffineTransform textMatrix;
|
||||||
|
|
||||||
CGContextSaveGState(c->c);
|
CGContextSaveGState(c->c);
|
||||||
|
// save the text matrix because it's not part of the graphics state
|
||||||
|
textMatrix = CGContextGetTextMatrix(c->c);
|
||||||
|
|
||||||
for (b in tl->backgroundBlocks)
|
for (b in tl->backgroundBlocks)
|
||||||
b(c, tl, x, y);
|
b(c, tl, x, y);
|
||||||
|
@ -190,7 +192,6 @@ void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
|
||||||
// TODO how is this affected by a non-identity CTM?
|
// TODO how is this affected by a non-identity CTM?
|
||||||
CGContextTranslateCTM(c->c, 0, c->height);
|
CGContextTranslateCTM(c->c, 0, c->height);
|
||||||
CGContextScaleCTM(c->c, 1.0, -1.0);
|
CGContextScaleCTM(c->c, 1.0, -1.0);
|
||||||
// TODO save the text matrix
|
|
||||||
CGContextSetTextMatrix(c->c, CGAffineTransformIdentity);
|
CGContextSetTextMatrix(c->c, CGAffineTransformIdentity);
|
||||||
|
|
||||||
// wait, that's not enough; we need to offset y values to account for our new flipping
|
// wait, that's not enough; we need to offset y values to account for our new flipping
|
||||||
|
@ -205,6 +206,7 @@ void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
|
||||||
|
|
||||||
CTFrameDraw(tl->frame, c->c);
|
CTFrameDraw(tl->frame, c->c);
|
||||||
|
|
||||||
|
CGContextSetTextMatrix(c->c, textMatrix);
|
||||||
CGContextRestoreGState(c->c);
|
CGContextRestoreGState(c->c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue