• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FXSYS_fabs函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FXSYS_fabs函数的典型用法代码示例。如果您正苦于以下问题:C++ FXSYS_fabs函数的具体用法?C++ FXSYS_fabs怎么用?C++ FXSYS_fabs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FXSYS_fabs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ArgbEncode

FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha()
{
    if (m_pDIBSource->IsOpaqueImage()) {
        CFX_PathData path;
        path.AppendRect(0, 0, 1, 1);
        path.Transform(&m_ImageMatrix);
        FX_DWORD fill_color = ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha);
        m_pRenderStatus->m_pDevice->DrawPath(&path, NULL, NULL, fill_color, 0, FXFILL_WINDING);
    } else {
        const CFX_DIBSource* pAlphaMask = m_pDIBSource->IsAlphaMask() ? m_pDIBSource : m_pDIBSource->GetAlphaMask();
        if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) {
            int left, top;
            CFX_DIBitmap* pTransformed = pAlphaMask->TransformTo(&m_ImageMatrix, left, top);
            if (pTransformed == NULL) {
                return TRUE;
            }
            m_pRenderStatus->m_pDevice->SetBitMask(pTransformed, left, top, ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
            delete pTransformed;
        } else {
            CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
            FX_RECT image_rect = image_rect_f.GetOutterRect();
            int dest_width = m_ImageMatrix.a > 0 ? image_rect.Width() : -image_rect.Width();
            int dest_height = m_ImageMatrix.d > 0 ? -image_rect.Height() : image_rect.Height();
            int left = dest_width > 0 ? image_rect.left : image_rect.right;
            int top = dest_height > 0 ? image_rect.top : image_rect.bottom;
            m_pRenderStatus->m_pDevice->StretchBitMask(pAlphaMask, left, top, dest_width, dest_height,
                    ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
        }
        if (m_pDIBSource != pAlphaMask) {
            delete pAlphaMask;
        }
    }
    return FALSE;
}
开发者ID:witwall,项目名称:pdfium,代码行数:34,代码来源:fpdf_render_image.cpp


示例2: CGPointMake

FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap*     bitmap,
        FX_INT32            left,
        FX_INT32            top,
        void* pIccTransform,
        FX_BOOL bDEdge)
{
    if (FXDC_PRINTER == _deviceClass) {
        return FALSE;
    }
    if (bitmap->GetBPP() < 32) {
        return FALSE;
    }
    if (!(_renderCaps | FXRC_GET_BITS)) {
        return FALSE;
    }
    CGPoint pt = CGPointMake(left, top);
    pt = CGPointApplyAffineTransform(pt, _foxitDevice2User);
    CGAffineTransform ctm = CGContextGetCTM(_context);
    pt.x *= FXSYS_fabs(ctm.a);
    pt.y *= FXSYS_fabs(ctm.d);
    CGImageRef image = CGBitmapContextCreateImage(_context);
    if (NULL == image) {
        return FALSE;
    }
    CGFloat width	= (CGFloat) bitmap->GetWidth();
    CGFloat height	= (CGFloat) bitmap->GetHeight();
    if (width + pt.x > _width) {
        width -= (width + pt.x - _width);
    }
    if (height + pt.y > _height) {
        height -= (height + pt.y - _height);
    }
    CGImageRef subImage = CGImageCreateWithImageInRect(image,
                          CGRectMake(pt.x,
                                     pt.y,
                                     width,
                                     height));
    CGContextRef context = createContextWithBitmap(bitmap);
    CGRect rect = CGContextGetClipBoundingBox(context);
    CGContextClearRect(context, rect);
    CGContextDrawImage(context, rect, subImage);
    CGContextRelease(context);
    CGImageRelease(subImage);
    CGImageRelease(image);
    if (bitmap->HasAlpha()) {
        for (int row = 0; row < bitmap->GetHeight(); row ++) {
            FX_LPBYTE pScanline = (FX_LPBYTE)bitmap->GetScanline(row);
            for (int col = 0; col < bitmap->GetWidth(); col ++) {
                if (pScanline[3] > 0) {
                    pScanline[0] = (pScanline[0] * 255.f / pScanline[3] + .5f);
                    pScanline[1] = (pScanline[1] * 255.f / pScanline[3] + .5f);
                    pScanline[2] = (pScanline[2] * 255.f / pScanline[3] + .5f);
                }
                pScanline += 4;
            }
        }
    }
    return TRUE;
}
开发者ID:151706061,项目名称:PDFium,代码行数:59,代码来源:fx_quartz_device.cpp


示例3: FXSYS_fabs

CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
                                              FX_DWORD charcode,
                                              const CFX_AffineMatrix* pMatrix,
                                              FX_FLOAT retinaScaleX,
                                              FX_FLOAT retinaScaleY) {
  const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode);
  if (!pChar || !pChar->m_pBitmap)
    return nullptr;

  CFX_DIBitmap* pBitmap = pChar->m_pBitmap;
  CFX_AffineMatrix image_matrix, text_matrix;
  image_matrix = pChar->m_ImageMatrix;
  text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0);
  image_matrix.Concat(text_matrix);
  CFX_DIBitmap* pResBitmap = NULL;
  int left, top;
  if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 &&
      FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) {
    int top_line, bottom_line;
    top_line = _DetectFirstLastScan(pBitmap, TRUE);
    bottom_line = _DetectFirstLastScan(pBitmap, FALSE);
    if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) {
      FX_FLOAT top_y = image_matrix.d + image_matrix.f;
      FX_FLOAT bottom_y = image_matrix.f;
      FX_BOOL bFlipped = top_y > bottom_y;
      if (bFlipped) {
        FX_FLOAT temp = top_y;
        top_y = bottom_y;
        bottom_y = temp;
      }
      pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line);
      pResBitmap = pBitmap->StretchTo(
          (int)(FXSYS_round(image_matrix.a) * retinaScaleX),
          (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) *
                retinaScaleY));
      top = top_line;
      if (image_matrix.a < 0) {
        image_matrix.Scale(retinaScaleX, retinaScaleY);
        left = FXSYS_round(image_matrix.e + image_matrix.a);
      } else {
        left = FXSYS_round(image_matrix.e);
      }
    } else {
    }
  }
  if (pResBitmap == NULL) {
    image_matrix.Scale(retinaScaleX, retinaScaleY);
    pResBitmap = pBitmap->TransformTo(&image_matrix, left, top);
  }
  if (pResBitmap == NULL) {
    return NULL;
  }
  CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap;
  pGlyph->m_Left = left;
  pGlyph->m_Top = -top;
  pGlyph->m_Bitmap.TakeOver(pResBitmap);
  delete pResBitmap;
  return pGlyph;
}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:59,代码来源:fpdf_render_text.cpp


示例4: GetLastPoint

void CFDE_Path::AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2) {
  FX_PATHPOINT* pLast = GetLastPoint();
  if (!pLast || FXSYS_fabs(pLast->m_PointX - pt1.x) > 0.001 ||
      FXSYS_fabs(pLast->m_PointY - pt1.y) > 0.001) {
    MoveTo(pt1);
  }
  LineTo(pt2);
}
开发者ID:gradescope,项目名称:pdfium,代码行数:8,代码来源:cfde_path.cpp


示例5: DrawTextString

static void DrawTextString(CFX_RenderDevice* pDevice,
                           const CPDF_Point& pt,
                           CPDF_Font* pFont,
                           FX_FLOAT fFontSize,
                           CPDF_Matrix* pUser2Device,
                           const CFX_ByteString& str,
                           FX_ARGB crTextFill,
                           FX_ARGB crTextStroke,
                           int32_t nHorzScale) {
  FX_FLOAT x = pt.x, y = pt.y;
  pUser2Device->Transform(x, y);

  if (pFont) {
    if (nHorzScale != 100) {
      CPDF_Matrix mt(nHorzScale / 100.0f, 0, 0, 1, 0, 0);
      mt.Concat(*pUser2Device);

      CPDF_RenderOptions ro;
      ro.m_Flags = RENDER_CLEARTYPE;
      ro.m_ColorMode = RENDER_COLOR_NORMAL;

      if (crTextStroke != 0) {
        CPDF_Point pt1(0, 0), pt2(1, 0);
        pUser2Device->Transform(pt1.x, pt1.y);
        pUser2Device->Transform(pt2.x, pt2.y);
        CFX_GraphStateData gsd;
        gsd.m_LineWidth =
            (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));

        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,
                                          str, crTextFill, crTextStroke, &gsd,
                                          &ro);
      } else
        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,
                                          str, crTextFill, 0, NULL, &ro);
    } else {
      CPDF_RenderOptions ro;
      ro.m_Flags = RENDER_CLEARTYPE;
      ro.m_ColorMode = RENDER_COLOR_NORMAL;

      if (crTextStroke != 0) {
        CPDF_Point pt1(0, 0), pt2(1, 0);
        pUser2Device->Transform(pt1.x, pt1.y);
        pUser2Device->Transform(pt2.x, pt2.y);
        CFX_GraphStateData gsd;
        gsd.m_LineWidth =
            (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));

        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,
                                          pUser2Device, str, crTextFill,
                                          crTextStroke, &gsd, &ro);
      } else
        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,
                                          pUser2Device, str, crTextFill, 0,
                                          NULL, &ro);
    }
  }
}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:58,代码来源:fxet_pageobjs.cpp


示例6: _MatchFloatRange

static void _MatchFloatRange(FX_FLOAT f1, FX_FLOAT f2, int& i1, int& i2) {
    int length = (int)FXSYS_ceil(f2 - f1);
    int i1_1 = (int)FXSYS_floor(f1);
    int i1_2 = (int)FXSYS_ceil(f1);
    FX_FLOAT error1 = f1 - i1_1 + (FX_FLOAT)FXSYS_fabs(f2 - i1_1 - length);
    FX_FLOAT error2 = i1_2 - f1 + (FX_FLOAT)FXSYS_fabs(f2 - i1_2 - length);
    i1 = (error1 > error2) ? i1_2 : i1_1;
    i2 = i1 + length;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:9,代码来源:fx_basic_coords.cpp


示例7: GetX

FX_BOOL CBC_QRAlignmentPattern::AboutEquals(FX_FLOAT moduleSize,
                                            FX_FLOAT i,
                                            FX_FLOAT j) {
  if ((FXSYS_fabs(i - GetY()) <= moduleSize) &&
      (FXSYS_fabs(j - GetX()) <= moduleSize)) {
    FX_FLOAT moduleSizeDiff = FXSYS_fabs(moduleSize - m_moduleSize);
    return (moduleSizeDiff <= 1.0f) || (moduleSizeDiff / m_moduleSize <= 1.0f);
  }
  return FALSE;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:10,代码来源:BC_QRAlignmentPattern.cpp


示例8: FXSYS_fabs

void CFX_Matrix::MatchRect(const CFX_FloatRect& dest,
                           const CFX_FloatRect& src) {
    FX_FLOAT fDiff = src.left - src.right;
    a = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.left - dest.right) / fDiff;
    fDiff = src.bottom - src.top;
    d = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.bottom - dest.top) / fDiff;
    e = dest.left - src.left * a;
    f = dest.bottom - src.bottom * d;
    b = 0;
    c = 0;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:11,代码来源:fx_basic_coords.cpp


示例9: AddLines

void CFDE_Path::AddPolygon(const CFX_PointsF& points) {
  int32_t iCount = points.GetSize();
  if (iCount < 2)
    return;

  AddLines(points);
  const CFX_PointF* p = points.GetData();
  if (FXSYS_fabs(p[0].x - p[iCount - 1].x) < 0.01f ||
      FXSYS_fabs(p[0].y - p[iCount - 1].y) < 0.01f) {
    LineTo(p[0]);
  }
  CloseFigure();
}
开发者ID:gradescope,项目名称:pdfium,代码行数:13,代码来源:cfde_path.cpp


示例10: FXSYS_fabs

FX_BOOL CFX_ImageTransformer::Start() {
  CFX_FloatRect unit_rect = m_pMatrix->GetUnitRect();
  FX_RECT result_rect = unit_rect.GetClosestRect();
  FX_RECT result_clip = result_rect;
  if (m_pClip)
    result_clip.Intersect(*m_pClip);

  if (result_clip.IsEmpty())
    return FALSE;

  m_result = result_clip;
  if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 &&
      FXSYS_fabs(m_pMatrix->d) < FXSYS_fabs(m_pMatrix->c) / 20 &&
      FXSYS_fabs(m_pMatrix->a) < 0.5f && FXSYS_fabs(m_pMatrix->d) < 0.5f) {
    int dest_width = result_rect.Width();
    int dest_height = result_rect.Height();
    result_clip.Offset(-result_rect.left, -result_rect.top);
    result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height,
                                    m_pMatrix->c > 0, m_pMatrix->b < 0);
    m_Stretcher = WrapUnique(new CFX_ImageStretcher(
        &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags));
    m_Stretcher->Start();
    m_Status = 1;
    return TRUE;
  }
  if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 &&
      FXSYS_fabs(m_pMatrix->c) < FIX16_005) {
    int dest_width = m_pMatrix->a > 0 ? (int)FXSYS_ceil(m_pMatrix->a)
                                      : (int)FXSYS_floor(m_pMatrix->a);
    int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d)
                                       : (int)-FXSYS_floor(m_pMatrix->d);
    result_clip.Offset(-result_rect.left, -result_rect.top);
    m_Stretcher = WrapUnique(new CFX_ImageStretcher(
        &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags));
    m_Stretcher->Start();
    m_Status = 2;
    return TRUE;
  }
  int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b));
  int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d));
  CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
                          (FX_FLOAT)(stretch_height));
  stretch2dest.Concat(
      m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width,
      m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height,
      m_pMatrix->e, m_pMatrix->f);
  m_dest2stretch.SetReverse(stretch2dest);
  CFX_FloatRect clip_rect_f(result_clip);
  clip_rect_f.Transform(&m_dest2stretch);
  m_StretchClip = clip_rect_f.GetOuterRect();
  m_StretchClip.Intersect(0, 0, stretch_width, stretch_height);
  m_Stretcher = WrapUnique(new CFX_ImageStretcher(&m_Storer, m_pSrc,
                                                  stretch_width, stretch_height,
                                                  m_StretchClip, m_Flags));
  m_Stretcher->Start();
  m_Status = 3;
  return TRUE;
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:58,代码来源:fx_dib_transform.cpp


示例11: CanMerge

FX_BOOL CTextBaseLine::CanMerge(CTextBaseLine* pOther)
{
    FX_FLOAT inter_top, inter_bottom;
    if (!GetIntersection(m_Bottom, m_Top, pOther->m_Bottom, pOther->m_Top,
                         inter_bottom, inter_top)) {
        return FALSE;
    }
    FX_FLOAT inter_h = inter_top - inter_bottom;
    if (inter_h < (m_Top - m_Bottom) / 2 && inter_h < (pOther->m_Top - pOther->m_Bottom) / 2) {
        return FALSE;
    }
    FX_FLOAT dy = (FX_FLOAT)FXSYS_fabs(m_BaseLine - pOther->m_BaseLine);
    for (int i = 0; i < m_TextList.GetSize(); i ++) {
        CTextBox* pText = (CTextBox*)m_TextList.GetAt(i);
        for (int j = 0; j < pOther->m_TextList.GetSize(); j ++) {
            CTextBox* pOtherText = (CTextBox*)pOther->m_TextList.GetAt(j);
            FX_FLOAT inter_left, inter_right;
            if (!GetIntersection(pText->m_Left, pText->m_Right,
                                 pOtherText->m_Left, pOtherText->m_Right, inter_left, inter_right)) {
                continue;
            }
            FX_FLOAT inter_w = inter_right - inter_left;
            if (inter_w < pText->m_SpaceWidth / 2 && inter_w < pOtherText->m_SpaceWidth / 2) {
                continue;
            }
            if (dy >= (pText->m_Bottom - pText->m_Top) / 2 ||
                    dy >= (pOtherText->m_Bottom - pOtherText->m_Top) / 2) {
                return FALSE;
            }
        }
    }
    return TRUE;
}
开发者ID:151706061,项目名称:PDFium,代码行数:33,代码来源:fpdf_text.cpp


示例12: return

int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1,
                                      CBC_ResultPoint* p2) {
  if (p1 == NULL || p2 == NULL) {
    return Integer_MAX_VALUE;
  }
  return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX());
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:7,代码来源:BC_PDF417Reader.cpp


示例13: FXSYS_atan2

void CFDE_Path::ArcTo(FX_BOOL bStart,
                      const CFX_RectF& rect,
                      FX_FLOAT startAngle,
                      FX_FLOAT endAngle) {
  FX_FLOAT rx = rect.width / 2;
  FX_FLOAT ry = rect.height / 2;
  FX_FLOAT cx = rect.left + rx;
  FX_FLOAT cy = rect.top + ry;
  FX_FLOAT alpha =
      FXSYS_atan2(rx * FXSYS_sin(startAngle), ry * FXSYS_cos(startAngle));
  FX_FLOAT beta =
      FXSYS_atan2(rx * FXSYS_sin(endAngle), ry * FXSYS_cos(endAngle));
  if (FXSYS_fabs(beta - alpha) > FX_PI) {
    if (beta > alpha)
      beta -= 2 * FX_PI;
    else
      alpha -= 2 * FX_PI;
  }
  FX_FLOAT half_delta = (beta - alpha) / 2;
  FX_FLOAT bcp = 4.0f / 3 * (1 - FXSYS_cos(half_delta)) / FXSYS_sin(half_delta);
  FX_FLOAT sin_alpha = FXSYS_sin(alpha);
  FX_FLOAT sin_beta = FXSYS_sin(beta);
  FX_FLOAT cos_alpha = FXSYS_cos(alpha);
  FX_FLOAT cos_beta = FXSYS_cos(beta);
  if (bStart)
    MoveTo(CFX_PointF(cx + rx * cos_alpha, cy + ry * sin_alpha));

  BezierTo(CFX_PointF(cx + rx * (cos_alpha - bcp * sin_alpha),
                      cy + ry * (sin_alpha + bcp * cos_alpha)),
           CFX_PointF(cx + rx * (cos_beta + bcp * sin_beta),
                      cy + ry * (sin_beta - bcp * cos_beta)),
           CFX_PointF(cx + rx * cos_beta, cy + ry * sin_beta));
}
开发者ID:gradescope,项目名称:pdfium,代码行数:33,代码来源:cfde_path.cpp


示例14: FXSYS_fabs

void IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
  CFX_RectF rtOld = m_pProperties->m_rtWidget;
  m_pProperties->m_rtWidget = rect;
  if (IsChild()) {
    if (FXSYS_fabs(rtOld.width - rect.width) > 0.5f ||
        FXSYS_fabs(rtOld.height - rect.height) > 0.5f) {
      CFWL_EvtSizeChanged ev;
      ev.m_pSrcTarget = this;
      ev.m_rtOld = rtOld;
      ev.m_rtNew = rect;

      if (IFWL_WidgetDelegate* pDelegate = GetDelegate())
        pDelegate->OnProcessEvent(&ev);
    }
    return;
  }
  m_pWidgetMgr->SetWidgetRect_Native(this, rect);
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:18,代码来源:ifwl_widget.cpp


示例15: ArgbEncode

bool CPDF_ImageRenderer::StartBitmapAlpha() {
  if (m_pDIBSource->IsOpaqueImage()) {
    CFX_PathData path;
    path.AppendRect(0, 0, 1, 1);
    path.Transform(&m_ImageMatrix);
    uint32_t fill_color =
        ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha);
    m_pRenderStatus->m_pDevice->DrawPath(&path, nullptr, nullptr, fill_color, 0,
                                         FXFILL_WINDING);
    return false;
  }
  CFX_MaybeOwned<CFX_DIBSource> pAlphaMask;
  if (m_pDIBSource->IsAlphaMask())
    pAlphaMask = const_cast<CFX_DIBSource*>(m_pDIBSource);
  else
    pAlphaMask = m_pDIBSource->CloneAlphaMask();

  if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f ||
      FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) {
    int left;
    int top;
    std::unique_ptr<CFX_DIBitmap> pTransformed =
        pAlphaMask->TransformTo(&m_ImageMatrix, left, top);
    if (!pTransformed)
      return true;

    m_pRenderStatus->m_pDevice->SetBitMask(
        pTransformed.get(), left, top,
        ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
    return false;
  }
  CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
  FX_RECT image_rect = image_rect_f.GetOuterRect();
  int dest_width =
      m_ImageMatrix.a > 0 ? image_rect.Width() : -image_rect.Width();
  int dest_height =
      m_ImageMatrix.d > 0 ? -image_rect.Height() : image_rect.Height();
  int left = dest_width > 0 ? image_rect.left : image_rect.right;
  int top = dest_height > 0 ? image_rect.top : image_rect.bottom;
  m_pRenderStatus->m_pDevice->StretchBitMask(
      pAlphaMask.Get(), left, top, dest_width, dest_height,
      ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
  return false;
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:44,代码来源:cpdf_imagerenderer.cpp


示例16: FXSYS_fabs

void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str)
{
    if (NULL == m_pReflowed) {
        return;
    }
    CFX_AffineMatrix revMatrix;
    revMatrix.SetReverse(matrix);
    FX_FLOAT x1, y1;
    revMatrix.Transform((float)x, (float)y, x1, y1);
    int count = m_pReflowed->GetSize();
    FX_FLOAT dx = 1000, dy = 1000;
    FX_INT32 pos = 0;
    FX_INT32 i;
    for(i = 0; i < count; i++) {
        CRF_Data* pData = (*m_pReflowed)[i];
        FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);
        if(FXSYS_fabs(tempdy - dy) < 1) {
            continue;
        }
        CFX_FloatRect rect (0, pData->m_PosY + pData->m_Height, this->m_PageWidth, pData->m_PosY);
        if(rect.Contains(x1, y1)) {
            pos = i;
            dx = 0;
            dy = 0;
            break;
        } else if(tempdy < dy) {
            dy = tempdy;
            dx = FXSYS_fabs(pData->m_PosX - x1);
            pos = i;
        } else if (tempdy == dy) {
            FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);
            if(tempdx < dx) {
                dx = tempdx;
                pos = i;
            }
        } else if (tempdy > dy) {
            break;
        }
    }
    if(dx != 0 || dy != 0) {
        count = count < (pos + 10) ? count : (pos + 10);
        for(i = 0 > (pos - 10) ? 0 : (pos - 10); i < count; i++) {
            CRF_Data* pData = (*m_pReflowed)[i];
            FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);
            if(tempdy < dy) {
                dy = tempdy;
                dx = FXSYS_fabs(pData->m_PosX - x1);
                pos = i;
            } else if (tempdy == dy) {
                FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);
                if(tempdx < dx) {
                    dx = tempdx;
                    pos = i;
                }
            }
        }
    }
    str.Format("%d", pos);
}
开发者ID:151706061,项目名称:PDFium,代码行数:59,代码来源:reflowedpage.cpp


示例17: FXSYS_fabs

CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj,
                                             const FX_RECT& rect,
                                             int& left,
                                             int& top,
                                             FX_BOOL bBackAlphaRequired) {
  FX_RECT bbox = rect;
  bbox.Intersect(m_pDevice->GetClipBox());
  left = bbox.left;
  top = bbox.top;
  CFX_Matrix deviceCTM = m_pDevice->GetCTM();
  FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a);
  FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d);
  int width = FXSYS_round(bbox.Width() * scaleX);
  int height = FXSYS_round(bbox.Height() * scaleY);
  std::unique_ptr<CFX_DIBitmap> pBackdrop(new CFX_DIBitmap);
  if (bBackAlphaRequired && !m_bDropObjects)
    pBackdrop->Create(width, height, FXDIB_Argb);
  else
    m_pDevice->CreateCompatibleBitmap(pBackdrop.get(), width, height);

  if (!pBackdrop->GetBuffer())
    return nullptr;

  FX_BOOL bNeedDraw;
  if (pBackdrop->HasAlpha())
    bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT);
  else
    bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS);

  if (!bNeedDraw) {
    m_pDevice->GetDIBits(pBackdrop.get(), left, top);
    return pBackdrop.release();
  }

  CFX_Matrix FinalMatrix = m_DeviceMatrix;
  FinalMatrix.TranslateI(-left, -top);
  FinalMatrix.Scale(scaleX, scaleY);
  pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff);
  CFX_FxgeDevice device;
  device.Attach(pBackdrop.get(), false, nullptr, false);
  m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix);
  return pBackdrop.release();
}
开发者ID:gradescope,项目名称:pdfium,代码行数:43,代码来源:fpdf_render.cpp


示例18: IsVisible

FX_BOOL CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const {
  if (m_pNode == stroke.GetNode())
    return TRUE;
  if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f)
    return FALSE;
  if ((dwFlags & XFA_STROKE_SAMESTYLE_NoPresence) == 0 &&
      IsVisible() != stroke.IsVisible()) {
    return FALSE;
  }
  if (GetStrokeType() != stroke.GetStrokeType())
    return FALSE;
  if (GetColor() != stroke.GetColor())
    return FALSE;
  if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 &&
      FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) {
    return FALSE;
  }
  return TRUE;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:19,代码来源:cxfa_stroke.cpp


示例19:

CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() {
  FX_FLOAT det =
      a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g);
  if (FXSYS_fabs(det) < 0.0000001)
    return CFX_Matrix_3by3();

  return CFX_Matrix_3by3(
      (e * i - f * h) / det, -(b * i - c * h) / det, (b * f - c * e) / det,
      -(d * i - f * g) / det, (a * i - c * g) / det, -(a * f - c * d) / det,
      (d * h - e * g) / det, -(a * h - b * g) / det, (a * e - b * d) / det);
}
开发者ID:gradescope,项目名称:pdfium,代码行数:11,代码来源:fx_basic_util.cpp


示例20: Load

FX_BOOL CPDF_TilingPattern::Load()
{
    if (m_pForm != NULL) {
        return TRUE;
    }
    CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
    if (pDict == NULL) {
        return FALSE;
    }
    m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;
    m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("XStep")));
    m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("YStep")));
    if (m_pPatternObj->GetType() != PDFOBJ_STREAM) {
        return FALSE;
    }
    CPDF_Stream* pStream = (CPDF_Stream*)m_pPatternObj;
    m_pForm = FX_NEW CPDF_Form(m_pDocument, NULL, pStream);
    m_pForm->ParseContent(NULL, &m_ParentMatrix, NULL, NULL);
    m_BBox = pDict->GetRect(FX_BSTRC("BBox"));
    return TRUE;
}
开发者ID:151706061,项目名称:PDFium,代码行数:21,代码来源:fpdf_page_pattern.cpp



注:本文中的FXSYS_fabs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FXSYS_memcpy函数代码示例发布时间:2022-05-30
下一篇:
C++ FXSYS_assert函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap