+- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView {
+ CGSGenericObj style = nil;
+ CGShadowStyle shadow;
+
+ if (_scalesSmoothly || castsShadow) {
+ [NSGraphicsContext saveGraphicsState];
+ }
+
+ if (_scalesSmoothly) {
+ // CGContextSetInterpolationQuality([[NSGraphicsContext currentContext] graphicsPort], kCGInterpolationHigh);
+ [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
+ [[NSGraphicsContext currentContext] setShouldAntialias:YES];
+ }
+
+ if (castsShadow) {
+ // Create the shadow style to use for drawing the string
+ shadow.version = 0;
+ shadow.elevation = shadowElevation;
+ shadow.azimuth = shadowAzimuth;
+ shadow.ambient = shadowAmbient;
+ shadow.height = shadowHeight;
+ shadow.radius = shadowRadius;
+ shadow.saturation = shadowSaturation;
+ style = CGStyleCreateShadow(&shadow);
+ CGContextSetStyle([[NSGraphicsContext currentContext] graphicsPort], style);
+ }
+
+ [super drawWithFrame:rect inView:controlView];
+
+ if (castsShadow) {
+ CGStyleRelease(style);
+ }
+
+ if (_scalesSmoothly || castsShadow) {
+ [NSGraphicsContext restoreGraphicsState];
+ }
+}