     }
     
     private func prepareToResize() {
-        let boundsCenter = CGPoint(x: CGRectGetMidX(bounds), y: CGRectGetMidY(bounds))
-        pointToCenterAfterResize = convertPoint(boundsCenter, toView: zoomView)
+        let boundsCenter = CGPoint(x: bounds.midX, y: bounds.midY)
+        pointToCenterAfterResize = convert(boundsCenter, to: zoomView)
         
         scaleToRestoreAfterResize = zoomScale
         

            setZoomScale(minimumZoomScale, animated: true)
        }
        else {
            let center = gestureRecognizer.locationInView(gestureRecognizer.view)
            let zoomRect = zoomRectForScale(ImageScrollView.kZoomInFactorFromMinWhenDoubleTap * minimumZoomScale, center: center)
            zoomToRect(zoomRect, animated: true)
        }
    }
    
    private func zoomRectForScale(scale: CGFloat, center: CGPoint) -> CGRect {
        var zoomRect = CGRectZero
        
        // the zoom rect is in the content view's coordinates.
        // at a zoom scale of 1.0, it would be the size of the imageScrollView's bounds.

        contentSize = imageSize
        setMaxMinZoomScalesForCurrentBounds()
        zoomScale = minimumZoomScale
        contentOffset = CGPoint.zero
    }
    
    private func setMaxMinZoomScalesForCurrentBounds() {
