'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var TexturePool = require('../../../renderers/shared/texture/TexturePool.js');
var Bounds = require('../../../scene/bounds/Bounds.js');

const tempBounds = new Bounds.Bounds();
function getPo2TextureFromSource(image, resolution) {
  const bounds = tempBounds;
  bounds.minX = 0;
  bounds.minY = 0;
  bounds.maxX = image.width / resolution | 0;
  bounds.maxY = image.height / resolution | 0;
  const texture = TexturePool.TexturePool.getOptimalTexture(
    bounds.width,
    bounds.height,
    resolution,
    false
  );
  texture.source.uploadMethodId = "image";
  texture.source.resource = image;
  texture.frameWidth = image.width / resolution;
  texture.frameHeight = image.height / resolution;
  texture.source.update();
  texture.layout.updateUvs();
  return texture;
}

exports.getPo2TextureFromSource = getPo2TextureFromSource;
//# sourceMappingURL=getPo2TextureFromSource.js.map
