Prepare for new GlyphContext.

This commit is contained in:
Mikael Sand
2017-08-15 19:50:50 +03:00
parent 1c1e8a860b
commit f1657d9ddf
9 changed files with 141 additions and 40 deletions
-33
View File
@@ -13,10 +13,6 @@
#import "RNSVGGlyphContext.h"
@implementation RNSVGText
{
RNSVGText *_textRoot;
RNSVGGlyphContext *_glyphContext;
}
- (void)setTextAnchor:(RNSVGTextAnchor)textAnchor
{
@@ -28,7 +24,6 @@
{
[self clip:context];
CGContextSaveGState(context);
[self setupGlyphContext:context];
CGPathRef path = [self getGroupPath:context];
CGAffineTransform transform = [self getAlignTransform:path];
@@ -43,12 +38,6 @@
CGPathRelease(transformedPath);
}
- (void)setupGlyphContext:(CGContextRef)context
{
_glyphContext = [[RNSVGGlyphContext alloc] initWithDimensions:[self getContextWidth]
height:[self getContextHeight]];
}
// release the cached CGPathRef for RNSVGTSpan
- (void)releaseCachedPath
{
@@ -70,7 +59,6 @@
- (CGPathRef)getPath:(CGContextRef)context
{
[self setupGlyphContext:context];
CGPathRef groupPath = [self getGroupPath:context];
CGAffineTransform transform = [self getAlignTransform:groupPath];
[self releaseCachedPath];
@@ -117,27 +105,6 @@
return anchor;
}
- (RNSVGText *)getTextRoot
{
if (!_textRoot) {
_textRoot = self;
while (_textRoot && [_textRoot class] != [RNSVGText class]) {
if (![_textRoot isKindOfClass:[RNSVGText class]]) {
//todo: throw exception here
break;
}
_textRoot = (RNSVGText*)[_textRoot superview];
}
}
return _textRoot;
}
- (RNSVGGlyphContext *)getGlyphContext
{
return _glyphContext;
}
- (void)pushGlyphContext
{
[[[self getTextRoot] getGlyphContext] pushContext:self.font