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


C++ TransformationMatrix函数代码示例

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


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

示例1: TEST_F

TEST_F(DisplayItemPropertyTreeBuilderTest, TransformDisplayItemCreatesTransformNode)
{
    // 2D transform display items should create a transform node as well,
    // unless the transform is a 2D translation only.
    AffineTransform rotation;
    rotation.rotate(45);

    processDummyDisplayItem();
    auto transformClient = processBeginTransform(rotation);
    processDummyDisplayItem();
    processEndTransform(transformClient);
    processDummyDisplayItem();
    finishPropertyTrees();

    // There should be two transform nodes.
    ASSERT_EQ(2u, transformTree().nodeCount());
    EXPECT_TRUE(transformTree().nodeAt(0).isRoot());
    EXPECT_EQ(0u, transformTree().nodeAt(1).parentNodeIndex);
    EXPECT_TRANSFORMS_ALMOST_EQ(TransformationMatrix(rotation), transformTree().nodeAt(1).matrix);

    // There should be three range records, the middle one affected by the
    // rotation.
    EXPECT_THAT(rangeRecordsAsStdVector(), ElementsAre(
        AllOf(hasRange(0, 1), hasTransformNode(0)),
        AllOf(hasRange(2, 3), hasTransformNode(1)),
        AllOf(hasRange(4, 5), hasTransformNode(0))));
}
开发者ID:OctiumBrowser,项目名称:octium-main,代码行数:27,代码来源:DisplayItemPropertyTreeBuilderTest.cpp

示例2: toLayoutBoxModelObject

void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
    if (object.isBoxModelObject()) {
        // TODO(trchen): Eliminate PaintLayer dependency.
        PaintLayer* layer = toLayoutBoxModelObject(object).layer();
        if (!layer || !layer->paintsWithTransform(GlobalPaintNormalPhase))
            return;
    }

    if (context.paintOffset == LayoutPoint())
        return;

    // We should use the same subpixel paint offset values for snapping regardless of whether a
    // transform is present. If there is a transform we round the paint offset but keep around
    // the residual fractional component for the transformed content to paint with.
    // In spv1 this was called "subpixel accumulation". For more information, see
    // PaintLayer::subpixelAccumulation() and PaintLayerPainter::paintFragmentByApplyingTransform.
    IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset);
    LayoutPoint fractionalPaintOffset = LayoutPoint(context.paintOffset - roundedPaintOffset);

    RefPtr<TransformPaintPropertyNode> paintOffsetTranslation = TransformPaintPropertyNode::create(
        TransformationMatrix().translate(roundedPaintOffset.x(), roundedPaintOffset.y()),
        FloatPoint3D(), context.currentTransform);
    context.currentTransform = paintOffsetTranslation.get();
    context.paintOffset = fractionalPaintOffset;
    object.getMutableForPainting().ensureObjectPaintProperties().setPaintOffsetTranslation(paintOffsetTranslation.release());
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:27,代码来源:PaintPropertyTreeBuilder.cpp

示例3: paint

void RenderForeignObject::paint(PaintInfo& paintInfo, int parentX, int parentY)
{
    if (paintInfo.context->paintingDisabled())
        return;

    paintInfo.context->save();
    paintInfo.context->concatCTM(TransformationMatrix().translate(parentX, parentY));
    paintInfo.context->concatCTM(localTransform());
    paintInfo.context->concatCTM(translationForAttributes());
    paintInfo.context->clip(getClipRect(parentX, parentY));

    float opacity = style()->opacity();
    if (opacity < 1.0f)
        // FIXME: Possible optimization by clipping to bbox here, once relativeBBox is implemented & clip, mask and filter support added.
        paintInfo.context->beginTransparencyLayer(opacity);

    PaintInfo pi(paintInfo);
    pi.rect = absoluteTransform().inverse().mapRect(paintInfo.rect);
    RenderBlock::paint(pi, 0, 0);

    if (opacity < 1.0f)
        paintInfo.context->endTransparencyLayer();

    paintInfo.context->restore();
}
开发者ID:marshall,项目名称:webkit_titanium,代码行数:25,代码来源:RenderForeignObject.cpp

示例4: create

// Perform a concatenation of the matrices (this * secondMatrix)
PassRefPtrWillBeRawPtr<CSSMatrix> CSSMatrix::multiply(CSSMatrix* secondMatrix) const
{
    if (!secondMatrix)
        return nullptr;

    return CSSMatrix::create(TransformationMatrix(m_matrix).multiply(secondMatrix->m_matrix));
}
开发者ID:smil-in-javascript,项目名称:blink,代码行数:8,代码来源:CSSMatrix.cpp

示例5: create

// Perform a concatenation of the matrices (this * secondMatrix)
PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::multiply(WebKitCSSMatrix* secondMatrix) const
{
    if (!secondMatrix)
        return 0;

    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).multiply(secondMatrix->m_matrix));
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:8,代码来源:WebKitCSSMatrix.cpp

示例6: ASSERT

void TextureMapperNode::paintSurface(const TexmapPaintOptions& options)
{
    if (m_layerType == RootLayer || m_layerType == DefaultLayer || m_layerType == ScissorLayer)
        return;

    RefPtr<BitmapTexture> maskTexture;
    if (TextureMapperNode* mask = m_state.maskLayer)
        maskTexture = mask->m_texture;

    ASSERT(m_surface);
    BitmapTexture& texture = *m_surface.get();
    if (maskTexture)
        maskTexture->unpack();
    texture.unpack();

    if (paintReplica(options))
        return;

    options.textureMapper->bindSurface(options.surface);
    options.textureMapper->drawTexture(texture,
                             m_layerType == TransparencyLayer ? IntRect(IntPoint(0, 0), options.surface->size()) :
                             targetRect(),
                             m_layerType == TransparencyLayer ? TransformationMatrix() : m_transforms.target,
                             options.opacity, maskTexture.get());
    options.cache->mark(&texture);
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:26,代码来源:TextureMapperNode.cpp

示例7: replicaRect

void TextureMapperNode::paintSelf(const TexmapPaintOptions& options)
{
    if (m_size.isEmpty() || (!m_state.drawsContent && m_currentContent.contentType == HTMLContentType))
        return;

    RefPtr<BitmapTexture> replicaMaskTexture;
    m_texture->unpack();

    RefPtr<BitmapTexture> maskTexture = m_state.maskLayer ? m_state.maskLayer->m_texture : 0;
    if (m_state.replicaLayer && m_state.replicaLayer->m_state.maskLayer)
        replicaMaskTexture = m_state.replicaLayer->m_state.maskLayer->m_texture;

    if (maskTexture)
        maskTexture->unpack();

    if (replicaMaskTexture)
        replicaMaskTexture->unpack();

    const float opacity = options.isSurface ? 1 : options.opacity;

    if (m_state.replicaLayer && !options.isSurface)
        options.textureMapper->drawTexture(*m_texture.get(), replicaRect(), m_transforms.replica,
                         opacity * m_state.replicaLayer->m_state.opacity,
                         replicaMaskTexture ? replicaMaskTexture.get() : maskTexture.get());

    const IntRect rect = m_layerType == ClipLayer ? entireRect() : targetRect();
    const TransformationMatrix transform = m_layerType == ClipLayer ? TransformationMatrix() : m_transforms.target;
    options.textureMapper->drawTexture(*m_texture.get(), rect, transform, opacity, options.isSurface ? 0 : maskTexture.get());
    options.cache->mark(m_texture.get());
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:30,代码来源:TextureMapperNode.cpp

示例8: DCHECK

// SVG does not use the general transform update of |updateTransform|, instead
// creating a transform node for SVG-specific transforms without 3D.
void PaintPropertyTreeBuilder::updateTransformForNonRootSVG(
    const LayoutObject& object,
    PaintPropertyTreeBuilderContext& context) {
  DCHECK(object.isSVG() && !object.isSVGRoot());
  // SVG (other than SVGForeignObject) does not use paint offset internally.
  DCHECK(object.isSVGForeignObject() ||
         context.current.paintOffset == LayoutPoint());

  // TODO(pdr): Refactor this so all non-root SVG objects use the same
  // transform function.
  const AffineTransform& transform = object.isSVGForeignObject()
                                         ? object.localSVGTransform()
                                         : object.localToSVGParentTransform();
  // TODO(pdr): Check for the presence of a transform instead of the value.
  // Checking for an identity matrix will cause the property tree structure
  // to change during animations if the animation passes through the
  // identity matrix.
  if (!transform.isIdentity()) {
    // The origin is included in the local transform, so leave origin empty.
    object.getMutableForPainting().ensurePaintProperties().updateTransform(
        context.current.transform, TransformationMatrix(transform),
        FloatPoint3D());
  } else {
    if (auto* properties = object.getMutableForPainting().paintProperties())
      properties->clearTransform();
  }

  if (object.paintProperties() && object.paintProperties()->transform()) {
    context.current.transform = object.paintProperties()->transform();
    context.current.shouldFlattenInheritedTransform = false;
    context.current.renderingContextID = 0;
  }
}
开发者ID:mirror,项目名称:chromium,代码行数:35,代码来源:PaintPropertyTreeBuilder.cpp

示例9: mapScrollOffset

FloatSize TextureMapperLayer::mapScrollOffset(const FloatSize& offset)
{
    double zeroX, zeroY, offsetX, offsetY;
    TransformationMatrix transform = m_currentTransform.combined().inverse().valueOr(TransformationMatrix());
    transform.map(0, 0, zeroX, zeroY);
    transform.map(offset.width(), offset.height(), offsetX, offsetY);
    return FloatSize(offsetX - zeroX, offsetY - zeroY);
}
开发者ID:reaven15,项目名称:webkit,代码行数:8,代码来源:TextureMapperLayer.cpp

示例10: TransformationMatrix

TransformationMatrix CCRenderSurface::computeDeviceTransform(LayerRendererChromium* layerRenderer, const TransformationMatrix& drawTransform) const
{
    TransformationMatrix renderTransform = drawTransform;
    // Apply a scaling factor to size the quad from 1x1 to its intended size.
    renderTransform.scale3d(m_contentRect.width(), m_contentRect.height(), 1);
    TransformationMatrix deviceTransform = TransformationMatrix(layerRenderer->windowMatrix() * layerRenderer->projectionMatrix() * renderTransform).to2dTransform();
    return deviceTransform;
}
开发者ID:Moondee,项目名称:Artemis,代码行数:8,代码来源:CCRenderSurface.cpp

示例11: TransformationMatrix

void GraphicsContextPlatformPrivate::scale(const FloatSize& size)
{
    if (!m_hdc)
        return;

    XFORM xform = TransformationMatrix().scaleNonUniform(size.width(), size.height());
    ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:8,代码来源:GraphicsContextWin.cpp

示例12: TEST_F

TEST_F(PaintPropertyTreeBuilderTest, FrameScrollingTraditional)
{
    setBodyInnerHTML("<style> body { height: 10000px; } </style>");

    document().domWindow()->scrollTo(0, 100);

    FrameView* frameView = document().view();
    frameView->updateAllLifecyclePhases();
    EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix());
    EXPECT_EQ(nullptr, frameView->preTranslation()->parent());
    EXPECT_EQ(TransformationMatrix().translate(0, -100), frameView->scrollTranslation()->matrix());
    EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->parent());

    LayoutView* layoutView = document().layoutView();
    ObjectPaintProperties* layoutViewProperties = layoutView->objectPaintProperties();
    EXPECT_EQ(nullptr, layoutViewProperties);
}
开发者ID:azureplus,项目名称:chromium,代码行数:17,代码来源:PaintPropertyTreeBuilderTest.cpp

示例13: Test_Matrix_TransformationMatrix

const bool Test_Matrix_TransformationMatrix()
{
	const TVector3d kTranslate_d{1.0, 2.0, 3.0};
	const TVector3d kAxis_d = Normalize(TVector3d(), TVector3d{1.0, 1.0, 1.0});
	const double kdAngle = s_kdTau / 8.0;
	const TVector4d kQuatOrient_d = AxisAngleQuaternion(TVector4d(), kAxis_d, kdAngle);
	const double kdScale = 2.0;

	const TMatrix4d kTranslation_d = TranslationMatrix(TMatrix4d(), kTranslate_d);
	const TMatrix4d kOrientation_d = RotationMatrix(TMatrix4d(), kQuatOrient_d);
	const TMatrix4d kScaling_d = ScalingMatrix(TMatrix4d(), kdScale, kdScale, kdScale);
	const TMatrix4d kTransformA_d = Multiply(TMatrix4d(), kScaling_d, kOrientation_d);
	const TMatrix4d kTransformB_d = Multiply(TMatrix4d(), kTranslation_d, kTransformA_d);

	const TVector3d kBasisX_d = QuaternionRotate(TVector3d(), TVector3d{kdScale, 0.0, 0.0}, kQuatOrient_d);
	const TVector3d kBasisY_d = QuaternionRotate(TVector3d(), TVector3d{0.0, kdScale, 0.0}, kQuatOrient_d);
	const TVector3d kBasisZ_d = QuaternionRotate(TVector3d(), TVector3d{0.0, 0.0, kdScale}, kQuatOrient_d);

	const TMatrix4d kTransformC_d = TransformationMatrix(TMatrix4d(), kBasisX_d, kBasisY_d, kBasisZ_d, kTranslate_d);

	const bool kbPass_d = Equal(kTransformC_d, kTransformB_d, s_kdEpsilon);

	//
	const TVector3f kTranslate_f{1.0f, 2.0f, 3.0f};
	const TVector3f kAxis_f = Normalize(TVector3f(), TVector3f{1.0f, 1.0f, 1.0f});
	const float kfAngle = s_kfTau / 8.0f;
	const TVector4f kQuatOrient_f = AxisAngleQuaternion(TVector4f(), kAxis_f, kfAngle);
	const float kfScale = 2.0f;

	const TMatrix4f kTranslation_f = TranslationMatrix(TMatrix4f(), kTranslate_f);
	const TMatrix4f kOrientation_f = RotationMatrix(TMatrix4f(), kQuatOrient_f);
	const TMatrix4f kScaling_f = ScalingMatrix(TMatrix4f(), kfScale, kfScale, kfScale);
	const TMatrix4f kTransformA_f = Multiply(TMatrix4f(), kScaling_f, kOrientation_f);
	const TMatrix4f kTransformB_f = Multiply(TMatrix4f(), kTranslation_f, kTransformA_f);

	const TVector3f kBasisX_f = QuaternionRotate(TVector3f(), TVector3f{kfScale, 0.0f, 0.0f}, kQuatOrient_f);
	const TVector3f kBasisY_f = QuaternionRotate(TVector3f(), TVector3f{0.0f, kfScale, 0.0f}, kQuatOrient_f);
	const TVector3f kBasisZ_f = QuaternionRotate(TVector3f(), TVector3f{0.0f, 0.0f, kfScale}, kQuatOrient_f);

	const TMatrix4f kTransformC_f = TransformationMatrix(TMatrix4f(), kBasisX_f, kBasisY_f, kBasisZ_f, kTranslate_f);

	const bool kbPass_f = Equal(kTransformC_f, kTransformB_f, s_kfEpsilon);

	return(kbPass_d && kbPass_f);
}
开发者ID:chronokun,项目名称:CkMath,代码行数:45,代码来源:tests_matrix.cpp

示例14: irect

WebBitmap* Frame::imageFromRect(const FloatRect& rect) const
{
    // We should not try to create a bitmap of zero height or width as it is not supported.
	IntRect irect(rect);
    if(irect.size().width() == 0 || irect.size().height() == 0) 
        return NULL;

    FrameLoaderClientApollo* const clientApollo = FrameLoaderClientApollo::clientApollo(this);
    WebHost* webHost = clientApollo->webHost();
    ASSERT(webHost);

    WebBitmap* resultBitmap = webHost->m_pVTable->createBitmap(webHost, irect.size().width(), irect.size().height());
    
	// clear pixels with transparent black (0)
	void *pixelData = resultBitmap->m_pVTable->getPixelData(resultBitmap);
    unsigned long stride = resultBitmap->m_pVTable->getStride(resultBitmap);
    memset( pixelData, 0, stride * irect.height() );
	

	// now, paint the selection in a graphics context
	WebIntRect sourceRect;
		
	sourceRect.m_left = 0; 
	sourceRect.m_top = 0; 
	sourceRect.m_right = irect.width();
	sourceRect.m_bottom = irect.height();
	
	GraphicsContext gc (resultBitmap,&sourceRect);

	IntSize offset = view()->scrollOffset();
    irect.move(-offset.width(), -offset.height());
    irect = view()->convertToContainingWindow(irect);

#if OS(WINDOWS) ||  OS(DARWIN)
	// changing origin from top-left to bottom-left 
	gc.concatCTM(TransformationMatrix(1, 0, 0, -1, 0, irect.height()).toAffineTransform());
#endif 

	// this transformation moves the clip into the origin of the user space
	gc.concatCTM(TransformationMatrix().translate(-irect.x(), -irect.y()).toAffineTransform());
	
	view()->paint(&gc,irect);
	
    return resultBitmap;
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:45,代码来源:FrameApollo.cpp

示例15: ASSERT

TransformationMatrix TransformationMatrix::rectToRect(const FloatRect& from, const FloatRect& to)
{
    ASSERT(!from.isEmpty());
    return TransformationMatrix(to.width() / from.width(),
                                0, 0,
                                to.height() / from.height(),
                                to.x() - from.x(),
                                to.y() - from.y());
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:9,代码来源:TransformationMatrix.cpp


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