本文整理汇总了C++中TransformationMatrix类的典型用法代码示例。如果您正苦于以下问题:C++ TransformationMatrix类的具体用法?C++ TransformationMatrix怎么用?C++ TransformationMatrix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TransformationMatrix类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: convertToTransformationMatrix
void GLUtils::convertToTransformationMatrix(const float* matrix, TransformationMatrix& transformMatrix)
{
transformMatrix.setMatrix(
matrix[0], matrix[1], matrix[2], matrix[3],
matrix[4], matrix[5], matrix[6], matrix[7],
matrix[8], matrix[9], matrix[10], matrix[11],
matrix[12], matrix[13], matrix[14], matrix[15]);
}
开发者ID:ACSOP,项目名称:android_external_webkit,代码行数:8,代码来源:GLUtils.cpp
示例2: computeTransformedExtentViaMatrix
bool AnimationBase::computeTransformedExtentViaMatrix(const FloatRect& rendererBox, const RenderStyle& style, LayoutRect& bounds) const
{
TransformationMatrix transform;
style.applyTransform(transform, rendererBox, RenderStyle::IncludeTransformOrigin);
if (!transform.isAffine())
return false;
TransformationMatrix::Decomposed2Type fromDecomp;
transform.decompose2(fromDecomp);
// Any rotation prevents us from using a simple start/end rect union.
if (fromDecomp.angle)
return false;
bounds = LayoutRect(transform.mapRect(bounds));
return true;
}
开发者ID:robvogelaar,项目名称:WebKitForWayland,代码行数:17,代码来源:AnimationBase.cpp
示例3: x
FloatRect SVGSVGElement::viewport() const
{
double _x = 0.0;
double _y = 0.0;
if (!isOutermostSVG()) {
_x = x().value(this);
_y = y().value(this);
}
float w = width().value(this);
float h = height().value(this);
TransformationMatrix viewBox = viewBoxToViewTransform(w, h);
double wDouble = w;
double hDouble = h;
viewBox.map(_x, _y, _x, _y);
viewBox.map(w, h, wDouble, hDouble);
return FloatRect::narrowPrecision(_x, _y, wDouble, hDouble);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:17,代码来源:SVGSVGElement.cpp
示例4: contentToScreenSpaceTransform
static inline TransformationMatrix contentToScreenSpaceTransform(const LayerType* layer)
{
ASSERT(layerTransformsToScreenKnown(layer));
IntSize boundsInLayerSpace = layer->bounds();
IntSize boundsInContentSpace = layer->contentBounds();
TransformationMatrix transform = layer->screenSpaceTransform();
if (boundsInContentSpace.isEmpty())
return transform;
// Scale from content space to layer space
transform.scaleNonUniform(boundsInLayerSpace.width() / static_cast<double>(boundsInContentSpace.width()),
boundsInLayerSpace.height() / static_cast<double>(boundsInContentSpace.height()));
return transform;
}
开发者ID:xiaolu31,项目名称:webkit-node,代码行数:17,代码来源:CCOcclusionTracker.cpp
示例5: bindProgramTransformParameter
void CustomFilterRenderer::bindProgramTransformParameter(int uniformLocation, CustomFilterTransformParameter* transformParameter)
{
TransformationMatrix matrix;
if (m_contextSize.width() && m_contextSize.height()) {
// The viewport is a box with the size of 1 unit, so we are scaling up here to make sure that translations happen using real pixel
// units. At the end we scale back down in order to map it back to the original box. Note that transforms come in reverse order, because it is
// supposed to multiply to the left of the coordinates of the vertices.
// Note that the origin (0, 0) of the viewport is in the middle of the context, so there's no need to change the origin of the transform
// in order to rotate around the middle of mesh.
matrix.scale3d(1.0 / m_contextSize.width(), 1.0 / m_contextSize.height(), 1);
transformParameter->applyTransform(matrix, m_contextSize);
matrix.scale3d(m_contextSize.width(), m_contextSize.height(), 1);
}
float glMatrix[16];
matrix.toColumnMajorFloatArray(glMatrix);
m_context->uniformMatrix4fv(uniformLocation, 1, false, &glMatrix[0]);
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:17,代码来源:CustomFilterRenderer.cpp
示例6: blendWithOpacity
void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options)
{
if (!m_state.visible || !m_state.contentsVisible)
return;
// We apply the following transform to compensate for painting into a surface, and then apply the offset so that the painting fits in the target rect.
TransformationMatrix transform;
transform.translate(options.offset.width(), options.offset.height());
transform.multiply(options.transform);
transform.multiply(m_currentTransform.combined());
if (m_state.solidColor.isValid() && !m_state.contentsRect.isEmpty() && m_state.solidColor.alpha()) {
options.textureMapper->drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, options.opacity));
if (m_state.showDebugBorders)
options.textureMapper->drawBorder(m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
return;
}
options.textureMapper->setWrapMode(TextureMapper::StretchWrap);
options.textureMapper->setPatternTransform(TransformationMatrix());
if (m_backingStore) {
FloatRect targetRect = layerRect();
ASSERT(!targetRect.isEmpty());
m_backingStore->paintToTextureMapper(options.textureMapper, targetRect, transform, options.opacity);
if (m_state.showDebugBorders)
m_backingStore->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, targetRect, transform);
// Only draw repaint count for the main backing store.
if (m_state.showRepaintCounter)
m_backingStore->drawRepaintCounter(options.textureMapper, m_state.repaintCount, m_state.debugBorderColor, targetRect, transform);
}
if (!m_contentsLayer)
return;
if (!m_state.contentsTileSize.isEmpty()) {
computePatternTransformIfNeeded();
options.textureMapper->setWrapMode(TextureMapper::RepeatWrap);
options.textureMapper->setPatternTransform(m_patternTransform);
}
ASSERT(!layerRect().isEmpty());
m_contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, options.opacity);
if (m_state.showDebugBorders)
m_contentsLayer->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, m_state.contentsRect, transform);
}
开发者ID:boska,项目名称:webkit,代码行数:46,代码来源:TextureMapperLayer.cpp
示例7: drawTransform
TransformationMatrix TiledLayerChromium::tilingTransform() const
{
TransformationMatrix transform = drawTransform();
if (contentBounds().isEmpty())
return transform;
transform.scaleNonUniform(bounds().width() / static_cast<double>(contentBounds().width()),
bounds().height() / static_cast<double>(contentBounds().height()));
// Tiler draws with a different origin from other layers.
transform.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0);
transform.translate(-scrollPosition().x(), -scrollPosition().y());
return transform;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:17,代码来源:TiledLayerChromium.cpp
示例8: blendByUsingMatrixInterpolation
TransformOperations TransformOperations::blendByUsingMatrixInterpolation(const TransformOperations& from, double progress, const LayoutSize& size) const
{
TransformOperations result;
// Convert the TransformOperations into matrices
TransformationMatrix fromTransform;
TransformationMatrix toTransform;
from.apply(size, fromTransform);
apply(size, toTransform);
toTransform.blend(fromTransform, progress);
// Append the result
result.operations().append(Matrix3DTransformOperation::create(toTransform));
return result;
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:17,代码来源:TransformOperations.cpp
示例9: containsRotation
bool AnimationBase::computeTransformedExtentViaTransformList(const FloatRect& rendererBox, const RenderStyle& style, LayoutRect& bounds) const
{
FloatRect floatBounds = bounds;
FloatPoint transformOrigin;
bool applyTransformOrigin = containsRotation(style.transform().operations()) || style.transform().affectedByTransformOrigin();
if (applyTransformOrigin) {
float offsetX = style.transformOriginX().isPercent() ? rendererBox.x() : 0;
float offsetY = style.transformOriginY().isPercent() ? rendererBox.y() : 0;
transformOrigin.setX(floatValueForLength(style.transformOriginX(), rendererBox.width()) + offsetX);
transformOrigin.setY(floatValueForLength(style.transformOriginY(), rendererBox.height()) + offsetY);
// Ignore transformOriginZ because we'll bail if we encounter any 3D transforms.
floatBounds.moveBy(-transformOrigin);
}
for (const auto& operation : style.transform().operations()) {
if (operation->type() == TransformOperation::ROTATE) {
// For now, just treat this as a full rotation. This could take angle into account to reduce inflation.
floatBounds = boundsOfRotatingRect(floatBounds);
} else {
TransformationMatrix transform;
operation->apply(transform, rendererBox.size());
if (!transform.isAffine())
return false;
if (operation->type() == TransformOperation::MATRIX || operation->type() == TransformOperation::MATRIX_3D) {
TransformationMatrix::Decomposed2Type toDecomp;
transform.decompose2(toDecomp);
// Any rotation prevents us from using a simple start/end rect union.
if (toDecomp.angle)
return false;
}
floatBounds = transform.mapRect(floatBounds);
}
}
if (applyTransformOrigin)
floatBounds.moveBy(transformOrigin);
bounds = LayoutRect(floatBounds);
return true;
}
开发者ID:robvogelaar,项目名称:WebKitForWayland,代码行数:45,代码来源:AnimationBase.cpp
示例10: clipToTextMask
static inline TransformationMatrix clipToTextMask(GraphicsContext* context,
OwnPtr<ImageBuffer>& imageBuffer, const RenderObject* object,
const SVGPaintServerGradient* gradientServer)
{
FloatRect maskBBox = const_cast<RenderObject*>(findTextRootObject(object))->objectBoundingBox();
// Fixup transformations to be able to clip to mask
TransformationMatrix transform = object->absoluteTransform();
FloatRect textBoundary = transform.mapRect(maskBBox);
IntSize maskSize(lroundf(textBoundary.width()), lroundf(textBoundary.height()));
clampImageBufferSizeToViewport(object->view()->frameView(), maskSize);
textBoundary.setSize(textBoundary.size().shrunkTo(maskSize));
// Clip current context to mask image (gradient)
context->concatCTM(transform.inverse());
context->clipToImageBuffer(textBoundary, imageBuffer.get());
context->concatCTM(transform);
TransformationMatrix matrix;
if (gradientServer->boundingBoxMode()) {
matrix.translate(maskBBox.x(), maskBBox.y());
matrix.scaleNonUniform(maskBBox.width(), maskBBox.height());
}
matrix.multiply(gradientServer->gradientTransform());
return matrix;
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:27,代码来源:SVGPaintServerGradient.cpp
示例11: ASSERT
void ContentLayerChromium::calculateClippedUpdateRect(IntRect& dirtyRect, IntRect& drawRect) const
{
// For the given layer size and content rect, calculate:
// 1) The minimal texture space rectangle to be uploaded, returned in dirtyRect.
// 2) The rectangle to draw this texture in relative to the target render surface, returned in drawRect.
ASSERT(m_targetRenderSurface);
const IntRect clipRect = m_targetRenderSurface->contentRect();
TransformationMatrix layerOriginTransform = drawTransform();
layerOriginTransform.translate3d(-0.5 * m_bounds.width(), -0.5 * m_bounds.height(), 0);
// For now we apply the large layer treatment only for layers that are either untransformed
// or are purely translated. Their matrix is expected to be invertible.
ASSERT(layerOriginTransform.isInvertible());
TransformationMatrix targetToLayerMatrix = layerOriginTransform.inverse();
IntRect clipRectInLayerCoords = targetToLayerMatrix.mapRect(clipRect);
clipRectInLayerCoords.intersect(IntRect(0, 0, m_bounds.width(), m_bounds.height()));
dirtyRect = clipRectInLayerCoords;
// Map back to the target surface coordinate system.
drawRect = layerOriginTransform.mapRect(dirtyRect);
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:25,代码来源:ContentLayerChromium.cpp
示例12: ASSERT
void RenderGeometryMap::push(const RenderObject* renderer, const TransformationMatrix& t, bool accumulatingTransform, bool isNonUniform, bool isFixedPosition, bool hasTransform, LayoutSize offsetForFixedPosition)
{
ASSERT(m_insertionPosition != kNotFound);
ASSERT(!renderer->isRenderView() || !m_insertionPosition || m_mapCoordinatesFlags & TraverseDocumentBoundaries);
ASSERT(offsetForFixedPosition.isZero() || renderer->isRenderView());
m_mapping.insert(m_insertionPosition, RenderGeometryMapStep(renderer, accumulatingTransform, isNonUniform, isFixedPosition, hasTransform));
RenderGeometryMapStep& step = m_mapping[m_insertionPosition];
step.m_offsetForFixedPosition = offsetForFixedPosition;
if (!t.isIntegerTranslation())
step.m_transform = adoptPtr(new TransformationMatrix(t));
else
step.m_offset = LayoutSize(t.e(), t.f());
stepInserted(step);
}
开发者ID:coinpayee,项目名称:blink,代码行数:18,代码来源:RenderGeometryMap.cpp
示例13: setProjectionMatrix
void ShaderProgram::setProjectionMatrix(SkRect& geometry, GLint projectionMatrixHandle)
{
TransformationMatrix translate;
translate.translate3d(geometry.fLeft, geometry.fTop, 0.0);
TransformationMatrix scale;
scale.scale3d(geometry.width(), geometry.height(), 1.0);
TransformationMatrix total;
if (!m_alphaLayer)
total = m_projectionMatrix * m_repositionMatrix * m_webViewMatrix
* translate * scale;
else
total = m_projectionMatrix * translate * scale;
GLfloat projectionMatrix[16];
GLUtils::toGLMatrix(projectionMatrix, total);
glUniformMatrix4fv(projectionMatrixHandle, 1, GL_FALSE, projectionMatrix);
}
开发者ID:ACSOP,项目名称:android_external_webkit,代码行数:18,代码来源:ShaderProgram.cpp
示例14: getMax
void BoundingBox::getMax(float &x, float &y, float &z) const {
// Maximum, relative to the origin
if (_absolute) {
x = _max[0]; y = _max[1]; z = _max[2];
return;
}
TransformationMatrix min = _origin;
min.translate(_min[0], _min[1], _min[2]);
TransformationMatrix max = _origin;
max.translate(_max[0], _max[1], _max[2]);
x = MAX(min.getX(), max.getX());
y = MAX(min.getY(), max.getY());
z = MAX(min.getZ(), max.getZ());
}
开发者ID:bsmr-games,项目名称:xoreos,代码行数:18,代码来源:boundingbox.cpp
示例15: render
virtual void render(const RenderState& state)
{
TransformationMatrix renderMatrix;
if (pageNode()->devicePixelRatio() != 1.0) {
renderMatrix.scale(pageNode()->devicePixelRatio());
if (matrix())
renderMatrix.multiply(*matrix());
} else if (matrix())
renderMatrix = *matrix();
// When rendering to an intermediate surface, Qt will
// mirror the projection matrix to fit on the destination coordinate system.
const QMatrix4x4* projection = state.projectionMatrix;
bool mirrored = projection && (*projection)(0, 0) * (*projection)(1, 1) - (*projection)(0, 1) * (*projection)(1, 0) > 0;
// FIXME: Support non-rectangular clippings.
coordinatedGraphicsScene()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect(), mirrored ? TextureMapper::PaintingMirrored : 0);
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:18,代码来源:QtWebPageSGNode.cpp
示例16: glUseProgram
void ShaderProgram::drawQuadInternal(SkRect& geometry,
GLint textureId,
float opacity,
GLint program,
GLint projectionMatrixHandle,
GLint texSampler,
GLenum textureTarget,
GLint position,
GLint alpha,
GLint texFilter,
GLint contrast)
{
glUseProgram(program);
if (!geometry.isEmpty())
setProjectionMatrix(geometry, projectionMatrixHandle);
else {
TransformationMatrix matrix;
// Map x,y from (0,1) to (-1, 1)
matrix.scale3d(2, 2, 1);
matrix.translate3d(-0.5, -0.5, 0);
GLfloat projectionMatrix[16];
GLUtils::toGLMatrix(projectionMatrix, matrix);
glUniformMatrix4fv(projectionMatrixHandle, 1, GL_FALSE, projectionMatrix);
}
glActiveTexture(GL_TEXTURE0);
glUniform1i(texSampler, 0);
glBindTexture(textureTarget, textureId);
glTexParameteri(textureTarget, GL_TEXTURE_MIN_FILTER, texFilter);
glTexParameteri(textureTarget, GL_TEXTURE_MAG_FILTER, texFilter);
glTexParameteri(textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindBuffer(GL_ARRAY_BUFFER, m_textureBuffer[0]);
glEnableVertexAttribArray(position);
glVertexAttribPointer(position, 2, GL_FLOAT, GL_FALSE, 0, 0);
glUniform1f(alpha, opacity);
if (contrast != -1)
glUniform1f(contrast, m_contrast);
setBlendingState(opacity < 1.0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
开发者ID:ACSOP,项目名称:android_external_webkit,代码行数:44,代码来源:ShaderProgram.cpp
示例17: layoutObject
AffineTransform SVGGraphicsElement::calculateAnimatedLocalTransform() const
{
AffineTransform matrix;
const ComputedStyle* style = layoutObject() ? layoutObject()->style() : nullptr;
// If CSS property was set, use that, otherwise fallback to attribute (if set).
if (style && style->hasTransform()) {
TransformationMatrix transform;
float zoom = style->effectiveZoom();
// SVGTextElements need special handling for the text positioning code.
if (isSVGTextElement(this)) {
// Do not take into account SVG's zoom rules, transform-origin, or percentage values.
style->applyTransform(transform, LayoutSize(0, 0), ComputedStyle::ExcludeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
} else {
// CSS transforms operate with pre-scaled lengths. To make this work with SVG
// (which applies the zoom factor globally, at the root level) we
//
// * pre-scale the bounding box (to bring it into the same space as the other CSS values)
// * invert the zoom factor (to effectively compute the CSS transform under a 1.0 zoom)
//
// Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
// See the "Object bounding box units" section of http://dev.w3.org/csswg/css3-transforms/
if (zoom != 1) {
FloatRect scaledBBox = layoutObject()->objectBoundingBox();
scaledBBox.scale(zoom);
transform.scale(1 / zoom);
style->applyTransform(transform, scaledBBox, ComputedStyle::IncludeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
transform.scale(zoom);
} else {
style->applyTransform(transform, layoutObject()->objectBoundingBox(), ComputedStyle::IncludeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
}
}
// Flatten any 3D transform.
matrix = transform.toAffineTransform();
} else {
m_transform->currentValue()->concatenate(matrix);
}
if (hasSVGRareData())
return *svgRareData()->animateMotionTransform() * matrix;
return matrix;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:44,代码来源:SVGGraphicsElement.cpp
示例18: clipRect
void ThreadedCompositor::renderLayerTree()
{
if (!m_scene)
return;
if (!ensureGLContext())
return;
FloatRect clipRect(0, 0, m_viewportSize.width(), m_viewportSize.height());
TransformationMatrix viewportTransform;
FloatPoint scrollPostion = viewportController()->visibleContentsRect().location();
viewportTransform.scale(viewportController()->pageScaleFactor() * m_deviceScaleFactor);
viewportTransform.translate(-scrollPostion.x(), -scrollPostion.y());
m_scene->paintToCurrentGLContext(viewportTransform, 1, clipRect, Color::white, false, scrollPostion);
glContext()->swapBuffers();
}
开发者ID:runt18,项目名称:webkit,代码行数:19,代码来源:ThreadedCompositor.cpp
示例19: move
void TransformState::applyTransform(
const TransformationMatrix& transformFromContainer,
TransformAccumulation accumulate,
bool* wasClamped) {
if (wasClamped)
*wasClamped = false;
if (transformFromContainer.isIntegerTranslation()) {
move(LayoutSize(LayoutUnit(transformFromContainer.e()),
LayoutUnit(transformFromContainer.f())),
accumulate);
return;
}
applyAccumulatedOffset();
// If we have an accumulated transform from last time, multiply in this
// transform
if (m_accumulatedTransform) {
if (m_direction == ApplyTransformDirection)
m_accumulatedTransform = TransformationMatrix::create(
transformFromContainer * *m_accumulatedTransform);
else
m_accumulatedTransform->multiply(transformFromContainer);
} else if (accumulate == AccumulateTransform) {
// Make one if we started to accumulate
m_accumulatedTransform =
TransformationMatrix::create(transformFromContainer);
}
if (accumulate == FlattenTransform) {
if (m_forceAccumulatingTransform) {
m_accumulatedTransform->flattenTo2d();
} else {
const TransformationMatrix* finalTransform =
m_accumulatedTransform ? m_accumulatedTransform.get()
: &transformFromContainer;
flattenWithTransform(*finalTransform, wasClamped);
}
}
m_accumulatingTransform =
accumulate == AccumulateTransform || m_forceAccumulatingTransform;
}
开发者ID:mirror,项目名称:chromium,代码行数:43,代码来源:TransformState.cpp
示例20: setDrawTransform
void LayerCompositingThread::setDrawTransform(double scale, const TransformationMatrix& matrix)
{
m_drawTransform = matrix;
float bx = m_bounds.width() / 2.0;
float by = m_bounds.height() / 2.0;
if (sizeIsScaleInvariant()) {
bx /= scale;
by /= scale;
}
m_transformedBounds.setP1(matrix.mapPoint(FloatPoint(-bx, -by)));
m_transformedBounds.setP2(matrix.mapPoint(FloatPoint(-bx, by)));
m_transformedBounds.setP3(matrix.mapPoint(FloatPoint(bx, by)));
m_transformedBounds.setP4(matrix.mapPoint(FloatPoint(bx, -by)));
m_drawRect = m_transformedBounds.boundingBox();
}
开发者ID:jbat100,项目名称:webkit,代码行数:19,代码来源:LayerCompositingThread.cpp
注:本文中的TransformationMatrix类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论