function scopedSetPackState(gl, options, fn) {
  var colorspaceConversion;
  var premultiplyAlpha;
  var flipY;
  if (options.colorspaceConversion !== undefined) {
    colorspaceConversion = gl.getParameter(UNPACK_COLORSPACE_CONVERSION_WEBGL);
    gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
  }
  if (options.premultiplyAlpha !== undefined) {
    premultiplyAlpha = gl.getParameter(UNPACK_PREMULTIPLY_ALPHA_WEBGL);
    gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha);
  }
  if (options.flipY !== undefined) {
    flipY = gl.getParameter(UNPACK_FLIP_Y_WEBGL);
    gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY);
  }
  fn();
  if (colorspaceConversion !== undefined) {
    gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, colorspaceConversion);
  }
  if (premultiplyAlpha !== undefined) {
    gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultiplyAlpha);
  }
  if (flipY !== undefined) {
    gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, flipY);
  }
}
Saves the current packing state, sets the packing state as specified
then calls a function, after which the packing state will be restored.
@param {WebGLRenderingContext} gl the WebGLRenderingContext
@param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
@param {function():void} [fn] A function to call, after which the packing state will be restored.
@private