CAShapeLayerWithClipRender.m 640 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // CAShapeLayerWithClipRender.m
  3. // SVGKit-iOS
  4. //
  5. // Created by David Gileadi on 8/14/14.
  6. // Copyright (c) 2014 na. All rights reserved.
  7. //
  8. #import "CAShapeLayerWithClipRender.h"
  9. #import "CALayerWithClipRender.h"
  10. @implementation CAShapeLayerWithClipRender
  11. - (void)renderInContext:(CGContextRef)ctx {
  12. if (CGRectIsEmpty(self.bounds)) return;
  13. CALayer *mask = nil;
  14. if( self.mask != nil ) {
  15. [CALayerWithClipRender maskLayer:self inContext:ctx];
  16. mask = self.mask;
  17. self.mask = nil;
  18. }
  19. [super renderInContext:ctx];
  20. if( mask != nil ) {
  21. self.mask = mask;
  22. }
  23. }
  24. @end