         transform = CGAffineTransformConcat(transform, CGAffineTransformMakeTranslation(0.0, self.size.height))
         CGContextConcatCTM(context, transform)
 
-//        CGContextSetAllowsAntialiasing(context, true)
-//        CGContextSetShouldAntialias(context, true)
-
         let drawRect = CGRect(origin: CGPointZero, size: self.size)
 
         CGContextClipToMask(context, drawRect, maskImage.CGImage)

        return roundImage
    }

    func bubbleImageWithTailDirection(tailDirection: MessageImageTailDirection, size: CGSize) -> UIImage {

        let scale = UIScreen.mainScreen().scale
        let orientation: UIImageOrientation = tailDirection == .Left ? .Up : .UpMirrored
        var maskImage = UIImage(CGImage: UIImage(named: "left_tail_image_bubble")!.CGImage, scale: scale, orientation: orientation)!
        maskImage = maskImage.resizableImageWithCapInsets(UIEdgeInsets(top: 25, left: 27, bottom: 20, right: 20), resizingMode: UIImageResizingMode.Stretch)
        maskImage = maskImage.renderAtSize(size)

        let bubbleImage = self.fixRotation().cropToAspectRatio(size.width / size.height).resizeToTargetSize(size).maskWithImage(maskImage)

        return bubbleImage
    }

//    func maskWithImage(maskImage: UIImage) -> UIImage {
//
//        let scale = UIScreen.mainScreen().scale
//
//        let colorSpace = CGColorSpaceCreateDeviceRGB()
//        let bitmapInfo = CGBitmapInfo(CGImageAlphaInfo.PremultipliedLast.rawValue)
//        let context = CGBitmapContextCreate(nil, Int(maskImage.size.width * scale), Int(maskImage.size.height * scale), 8, 0, colorSpace, bitmapInfo)
//
//        CGContextSetAllowsAntialiasing(context, true)
//        CGContextSetShouldAntialias(context, true)
//
//        let drawRect = CGRect(origin: CGPointZero, size: self.size)
//
//        CGContextClipToMask(context, drawRect, maskImage.CGImage)
//
//        CGContextDrawImage(context, drawRect, self.CGImage)
//
//        let cgImage = CGBitmapContextCreateImage(context)!
//        let roundImage = UIImage(CGImage: cgImage)!
//
//        return roundImage
//    }
}

        let cgImage = CGImageCreateWithImageInRect(self.CGImage, rect)
        return UIImage(CGImage: cgImage)!
    }
/*
    private func bubblePathWithTailDirection(tailDirection: MessageImageTailDirection, size: CGSize) -> UIBezierPath {
        let scale = UIScreen.mainScreen().scale

