         #else
             let scale = CGFloat(1.0)
         #endif
-        let width = Int((self.spaceSize.width + self.margin.left + self.margin.right + self.padding.left + self.padding.right) * scale)
-        let height = Int((self.spaceSize.height + self.margin.top + self.margin.bottom + self.padding.top + self.padding.bottom) * scale)
-        
-        let spaceRect = CGRect(x: 0, y: 0, width: width, height: height)
+        
+        let tempW = self.spaceSize.width + self.margin.horizontal + self.padding.horizontal
+        let tempH = self.spaceSize.height + self.margin.vertical + self.padding.vertical
+        let width = Int(tempW * scale)
+        let height = Int(tempH * scale)
+        
+        let spaceRect = CGRect(
+            x: 0,
+            y: 0,
+            width: width,
+            height: height
+        )
         
         /// Alloc Memory
         let memorySize = width * height * 4

            drawContext.draw(
                self.saveImage.cgImage!,
                in: CGRect(
                    x: (self.offset.x + self.margin.left + self.padding.left) * scale,
                    y: (self.offset.y + self.margin.top + self.padding.top) * scale,
                    width: size.width * scale,
                    height: size.height * scale
                )

        if !self.isAlphaBlend {
            drawContext.clip(to: spaceRect, mask: drawContext.makeImage()!)
        }
        self.afterLayer.forEach {
            $0(LayerType(drawContext, spaceRect, width, height, memoryPool))
        }
        drawContext.restoreGState()
        
        /// Last Layer
        self.lastLayer.forEach {
            $0(LayerType(drawContext, spaceRect, width, height, memoryPool))
        }
        
        #if !os(OSX)
            UIGraphicsEndImageContext()
