当前位置: 首页>>代码示例>>C++>>正文


C++ SVGPaintServer::isTransformDependent方法代码示例

本文整理汇总了C++中SVGPaintServer::isTransformDependent方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGPaintServer::isTransformDependent方法的具体用法?C++ SVGPaintServer::isTransformDependent怎么用?C++ SVGPaintServer::isTransformDependent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SVGPaintServer的用法示例。


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

示例1: updateGraphicsContext

bool SVGLayoutSupport::updateGraphicsContext(const PaintInfo& paintInfo, GraphicsContextStateSaver& stateSaver, const ComputedStyle& style, LayoutObject& layoutObject, LayoutSVGResourceMode resourceMode, const AffineTransform* additionalPaintServerTransform)
{
    ASSERT(paintInfo.context == stateSaver.context());

    GraphicsContext& context = *paintInfo.context;
    if (paintInfo.isRenderingClipPathAsMaskImage()) {
        if (resourceMode == ApplyToStrokeMode)
            return false;
        context.setFillColor(SVGComputedStyle::initialFillPaintColor());
        return true;
    }

    SVGPaintServer paintServer = SVGPaintServer::requestForLayoutObject(layoutObject, style, resourceMode);
    if (!paintServer.isValid())
        return false;

    if (additionalPaintServerTransform && paintServer.isTransformDependent())
        paintServer.prependTransform(*additionalPaintServerTransform);

    const SVGComputedStyle& svgStyle = style.svgStyle();
    float paintAlpha = resourceMode == ApplyToFillMode ? svgStyle.fillOpacity() : svgStyle.strokeOpacity();
    paintServer.apply(context, resourceMode, paintAlpha, stateSaver);

    if (resourceMode == ApplyToFillMode)
        context.setFillRule(svgStyle.fillRule());
    else
        applyStrokeStyleToContext(context, style, layoutObject);

    return true;
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:30,代码来源:SVGLayoutSupport.cpp

示例2: updateGraphicsContext

bool SVGRenderSupport::updateGraphicsContext(const PaintInfo& paintInfo, GraphicsContextStateSaver& stateSaver, RenderStyle* style, RenderObject& renderer, RenderSVGResourceMode resourceMode, const AffineTransform* additionalPaintServerTransform)
{
    ASSERT(style);
    ASSERT(paintInfo.context == stateSaver.context());

    GraphicsContext* context = paintInfo.context;
    if (paintInfo.isRenderingClipPathAsMaskImage()) {
        if (resourceMode == ApplyToStrokeMode)
            return false;
        context->setAlphaAsFloat(1);
        context->setFillColor(SVGRenderStyle::initialFillPaintColor());
        return true;
    }

    SVGPaintServer paintServer = SVGPaintServer::requestForRenderer(renderer, style, resourceMode);
    if (!paintServer.isValid())
        return false;

    if (additionalPaintServerTransform && paintServer.isTransformDependent())
        paintServer.prependTransform(*additionalPaintServerTransform);

    paintServer.apply(*context, resourceMode, &stateSaver);

    const SVGRenderStyle& svgStyle = style->svgStyle();

    if (resourceMode == ApplyToFillMode) {
        context->setAlphaAsFloat(svgStyle.fillOpacity());
        context->setFillRule(svgStyle.fillRule());
    } else {
        context->setAlphaAsFloat(svgStyle.strokeOpacity());
        applyStrokeStyleToContext(context, style, &renderer);
    }
    return true;
}
开发者ID:kjthegod,项目名称:WebKit,代码行数:34,代码来源:SVGRenderSupport.cpp

示例3: paintForLayoutObject

bool SVGPaintContext::paintForLayoutObject(
    const PaintInfo& paintInfo,
    const ComputedStyle& style,
    const LayoutObject& layoutObject,
    LayoutSVGResourceMode resourceMode,
    SkPaint& paint,
    const AffineTransform* additionalPaintServerTransform) {
  if (paintInfo.isRenderingClipPathAsMaskImage()) {
    if (resourceMode == ApplyToStrokeMode)
      return false;
    paint.setColor(SVGComputedStyle::initialFillPaintColor().rgb());
    paint.setShader(nullptr);
    return true;
  }

  SVGPaintServer paintServer =
      SVGPaintServer::requestForLayoutObject(layoutObject, style, resourceMode);
  if (!paintServer.isValid())
    return false;

  if (additionalPaintServerTransform && paintServer.isTransformDependent())
    paintServer.prependTransform(*additionalPaintServerTransform);

  const SVGComputedStyle& svgStyle = style.svgStyle();
  float paintAlpha = resourceMode == ApplyToFillMode ? svgStyle.fillOpacity()
                                                     : svgStyle.strokeOpacity();
  paintServer.applyToSkPaint(paint, paintAlpha);

  // We always set filter quality to 'low' here. This value will only have an
  // effect for patterns, which are SkPictures, so using high-order filter
  // should have little effect on the overall quality.
  paint.setFilterQuality(kLow_SkFilterQuality);

  // TODO(fs): The color filter can set when generating a picture for a mask -
  // due to color-interpolation. We could also just apply the
  // color-interpolation property from the the shape itself (which could mean
  // the paintserver if it has it specified), since that would be more in line
  // with the spec for color-interpolation. For now, just steal it from the GC
  // though.
  // Additionally, it's not really safe/guaranteed to be correct, as
  // something down the paint pipe may want to farther tweak the color
  // filter, which could yield incorrect results. (Consider just using
  // saveLayer() w/ this color filter explicitly instead.)
  paint.setColorFilter(sk_ref_sp(paintInfo.context.getColorFilter()));
  return true;
}
开发者ID:,项目名称:,代码行数:46,代码来源:


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