import { TexturePool } from '../../../renderers/shared/texture/TexturePool.mjs';
import { Bounds } from '../../../scene/bounds/Bounds.mjs';

const tempBounds = new 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.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;
}

export { getPo2TextureFromSource };
//# sourceMappingURL=getPo2TextureFromSource.mjs.map
