CFX_DIBitmap* CFX_DIBSource::StretchTo(int dest_width, int dest_height, FX_DWORD flags, const FX_RECT* pClip) const
{
    FX_RECT clip_rect(0, 0, FXSYS_abs(dest_width), FXSYS_abs(dest_height));
    if (pClip) {
        clip_rect.Intersect(*pClip);
    }
    if (clip_rect.IsEmpty()) {
        return NULL;
    }
    if (dest_width == m_Width && dest_height == m_Height) {
        return Clone(&clip_rect);
    }
    CFX_ImageStretcher stretcher;
    CFX_BitmapStorer storer;
    if (stretcher.Start(&storer, this, dest_width, dest_height, clip_rect, flags)) {
        stretcher.Continue(NULL);
    }
    return storer.Detach();
}
Exemplo n.º 2
0
CFX_DIBitmap* CFX_DIBSource::StretchTo(int dest_width,
                                       int dest_height,
                                       uint32_t flags,
                                       const FX_RECT* pClip) const {
  FX_RECT clip_rect(0, 0, FXSYS_abs(dest_width), FXSYS_abs(dest_height));
  if (pClip)
    clip_rect.Intersect(*pClip);

  if (clip_rect.IsEmpty())
    return nullptr;

  if (dest_width == m_Width && dest_height == m_Height)
    return Clone(&clip_rect);

  CFX_BitmapStorer storer;
  CFX_ImageStretcher stretcher(&storer, this, dest_width, dest_height,
                               clip_rect, flags);
  if (stretcher.Start())
    stretcher.Continue(nullptr);
  return storer.Detach().release();
}