Exemple #1
0
bool CFX_RenderDevice::SetClip_Rect(const FX_RECT& rect) {
  CFX_PathData path;
  path.AppendRect(rect.left, rect.bottom, rect.right, rect.top);
  if (!SetClip_PathFill(&path, nullptr, FXFILL_WINDING))
    return false;

  UpdateClipBox();
  return true;
}
Exemple #2
0
FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
                                       int bitmap_alpha,
                                       FX_DWORD color,
                                       const CFX_AffineMatrix* pMatrix,
                                       FX_DWORD render_flags,
                                       void*& handle,
                                       int alpha_flag,
                                       void* pIccTransform,
                                       int blend_type) {
  if (bitmap_alpha < 255 || pSource->HasAlpha() ||
      (pSource->IsAlphaMask() && (pSource->GetBPP() != 1 || !m_bSupportROP))) {
    return FALSE;
  }
  CFX_FloatRect unit_rect = pMatrix->GetUnitRect();
  FX_RECT full_rect = unit_rect.GetOutterRect();
  if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 &&
      FXSYS_fabs(pMatrix->c) < 0.5f && pMatrix->d != 0) {
    FX_BOOL bFlipX = pMatrix->a < 0;
    FX_BOOL bFlipY = pMatrix->d > 0;
    return StretchDIBits(pSource, color,
                         bFlipX ? full_rect.right : full_rect.left,
                         bFlipY ? full_rect.bottom : full_rect.top,
                         bFlipX ? -full_rect.Width() : full_rect.Width(),
                         bFlipY ? -full_rect.Height() : full_rect.Height(),
                         NULL, 0, alpha_flag, pIccTransform, blend_type);
  }
  if (FXSYS_fabs(pMatrix->a) < 0.5f && FXSYS_fabs(pMatrix->d) < 0.5f) {
    CFX_DIBitmap* pTransformed =
        pSource->SwapXY(pMatrix->c > 0, pMatrix->b < 0);
    if (pTransformed == NULL) {
      return FALSE;
    }
    FX_BOOL ret = StretchDIBits(
        pTransformed, color, full_rect.left, full_rect.top, full_rect.Width(),
        full_rect.Height(), NULL, 0, alpha_flag, pIccTransform, blend_type);
    delete pTransformed;
    return ret;
  }
  if (pSource->GetBPP() == 1) {
    CFX_DIBitmap* pTransformed = Transform1bppBitmap(pSource, pMatrix);
    if (pIccTransform == NULL) {
      return FALSE;
    }
    SaveState();
    CFX_PathData path;
    path.AppendRect(0, 0, 1.0f, 1.0f);
    SetClip_PathFill(&path, pMatrix, WINDING);
    FX_BOOL ret = StretchDIBits(
        pTransformed, color, full_rect.left, full_rect.top, full_rect.Width(),
        full_rect.Height(), NULL, 0, alpha_flag, pIccTransform, blend_type);
    RestoreState();
    delete pTransformed;
    handle = NULL;
    return ret;
  }
  return FALSE;
}