Пример #1
0
// writes the scratchmem buffer to compressed
// format into the mipmap cache. does nothing
// if compression is disabled.
void
dt_mipmap_cache_compress(
  dt_mipmap_buffer_t *buf,
  uint8_t *const scratchmem)
{
  // only do something if compression is on, don't compress skulls:
  if(darktable.mipmap_cache->compression_type && buf->width > 8 && buf->height > 8)
  {
    int flags = squish_dxt1;
    // low quality:
    if(darktable.mipmap_cache->compression_type == 1) flags |= squish_colour_range_fit;
    squish_compress_image(scratchmem, buf->width, buf->height, buf->buf, squish_dxt1);
  }
}
Пример #2
0
// writes the scratchmem buffer to compressed
// format into the mipmap cache. does nothing
// if compression is disabled.
void
dt_mipmap_cache_compress(
  dt_mipmap_buffer_t *buf,
  uint8_t *const scratchmem)
{
#ifdef HAVE_SQUISH
  // only do something if compression is on, don't compress skulls:
  if(darktable.mipmap_cache->compression_type && buf->width > 8 && buf->height > 8)
  {
    int flags = squish_dxt1;
    // low quality:
    if(darktable.mipmap_cache->compression_type == 1) flags |= squish_colour_range_fit;
    squish_compress_image(scratchmem, buf->width, buf->height, buf->buf, squish_dxt1);
  }
  else
#endif
  {
    memcpy(buf->buf, scratchmem, (size_t)buf->width*buf->height*4*sizeof(uint8_t));
  }
}