def __handle_scale_rot(self):
        """Handle scaling and rotation of the surface"""
        if self.__is_rot_pending:
            self.__execute_rot(self.untransformed_image)
            self.__is_rot_pending = False

            # Scale the image using the recently rotated surface to keep the orientation correct
            self.__execute_scale(self.image, self.image.get_size())
            self.__is_scale_pending = False

        # The image is not rotating while scaling, thus use the untransformed image to scale.
        if self.__is_scale_pending:
            self.__execute_scale(self.untransformed_image, self.untransformed_image.get_size())
            self.__is_scale_pending = False
Handle scaling and rotation of the surface