コード例 #1
0
static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpaceQuad, LayoutObject* targetRenderer, const LayoutBoxModelObject* paintInvalidationContainer, FloatQuad& compositedSpaceQuad)
{
    ASSERT(targetRenderer);
    ASSERT(paintInvalidationContainer);
    for (unsigned i = 0; i < 4; ++i) {
        IntPoint point;
        switch (i) {
        case 0: point = roundedIntPoint(targetSpaceQuad.p1()); break;
        case 1: point = roundedIntPoint(targetSpaceQuad.p2()); break;
        case 2: point = roundedIntPoint(targetSpaceQuad.p3()); break;
        case 3: point = roundedIntPoint(targetSpaceQuad.p4()); break;
        }

        // FIXME: this does not need to be absolute, just in the paint invalidation container's space.
        point = targetRenderer->frame()->view()->contentsToRootFrame(point);
        point = paintInvalidationContainer->frame()->view()->rootFrameToContents(point);
        FloatPoint floatPoint = paintInvalidationContainer->absoluteToLocal(point, UseTransforms);
        DeprecatedPaintLayer::mapPointToPaintBackingCoordinates(paintInvalidationContainer, floatPoint);

        switch (i) {
        case 0: compositedSpaceQuad.setP1(floatPoint); break;
        case 1: compositedSpaceQuad.setP2(floatPoint); break;
        case 2: compositedSpaceQuad.setP3(floatPoint); break;
        case 3: compositedSpaceQuad.setP4(floatPoint); break;
        }
    }
}
コード例 #2
0
ファイル: LinkHighlight.cpp プロジェクト: junmin-zhu/blink
static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpaceQuad, RenderObject* targetRenderer, RenderObject* compositedRenderer, FloatQuad& compositedSpaceQuad)
{
    ASSERT(targetRenderer);
    ASSERT(compositedRenderer);

    for (unsigned i = 0; i < 4; ++i) {
        IntPoint point;
        switch (i) {
        case 0: point = roundedIntPoint(targetSpaceQuad.p1()); break;
        case 1: point = roundedIntPoint(targetSpaceQuad.p2()); break;
        case 2: point = roundedIntPoint(targetSpaceQuad.p3()); break;
        case 3: point = roundedIntPoint(targetSpaceQuad.p4()); break;
        }

        point = targetRenderer->frame()->view()->contentsToWindow(point);
        point = compositedRenderer->frame()->view()->windowToContents(point);
        FloatPoint floatPoint = compositedRenderer->absoluteToLocal(point, UseTransforms);

        switch (i) {
        case 0: compositedSpaceQuad.setP1(floatPoint); break;
        case 1: compositedSpaceQuad.setP2(floatPoint); break;
        case 2: compositedSpaceQuad.setP3(floatPoint); break;
        case 3: compositedSpaceQuad.setP4(floatPoint); break;
        }
    }
}
コード例 #3
0
FloatQuad TransformationMatrix::projectQuad(const FloatQuad& q) const
{
    FloatQuad projectedQuad;
    projectedQuad.setP1(projectPoint(q.p1()));
    projectedQuad.setP2(projectPoint(q.p2()));
    projectedQuad.setP3(projectPoint(q.p3()));
    projectedQuad.setP4(projectPoint(q.p4()));
    return projectedQuad;
}
コード例 #4
0
ファイル: InspectorOverlay.cpp プロジェクト: aosm/WebCore
static void contentsQuadToCoordinateSystem(const FrameView* mainView, const FrameView* view, FloatQuad& quad, InspectorOverlay::CoordinateSystem coordinateSystem)
{
    quad.setP1(view->contentsToRootView(roundedIntPoint(quad.p1())));
    quad.setP2(view->contentsToRootView(roundedIntPoint(quad.p2())));
    quad.setP3(view->contentsToRootView(roundedIntPoint(quad.p3())));
    quad.setP4(view->contentsToRootView(roundedIntPoint(quad.p4())));

    if (coordinateSystem == InspectorOverlay::CoordinateSystem::View)
        quad += mainView->scrollOffset();
}
コード例 #5
0
static FloatQuad getTransformedRect(const IntSize& bounds, const IntRect& rect, const TransformationMatrix& drawTransform)
{
    float x = -bounds.width() / 2.0 + rect.x();
    float y = -bounds.height() / 2.0 + rect.y();
    float w = rect.width();
    float h = rect.height();
    FloatQuad result;
    result.setP1(drawTransform.mapPoint(FloatPoint(x, y)));
    result.setP2(drawTransform.mapPoint(FloatPoint(x, y + h)));
    result.setP3(drawTransform.mapPoint(FloatPoint(x + w, y + h)));
    result.setP4(drawTransform.mapPoint(FloatPoint(x + w, y)));

    return result;
}
コード例 #6
0
FloatQuad LayerGLES2::getTransformedHolePunchRect() const
{
    float x = -m_bounds.width()/2.0 + m_holePunchRect.x();
    float y = -m_bounds.height()/2.0 + m_holePunchRect.y();
    float w = m_holePunchRect.width();
    float h = m_holePunchRect.height();
    FloatQuad result;
    result.setP1(m_drawTransform.mapPoint(FloatPoint(x, y)));
    result.setP2(m_drawTransform.mapPoint(FloatPoint(x, y+h)));
    result.setP3(m_drawTransform.mapPoint(FloatPoint(x+w, y+h)));
    result.setP4(m_drawTransform.mapPoint(FloatPoint(x+w, y)));

    return result;
}
コード例 #7
0
FloatRect LayerRendererSurface::drawRect() const
{
    float bx = m_size.width() / 2.0;
    float by = m_size.height() / 2.0;

    FloatQuad transformedBounds;
    transformedBounds.setP1(m_drawTransform.mapPoint(FloatPoint(-bx, -by)));
    transformedBounds.setP2(m_drawTransform.mapPoint(FloatPoint(-bx, by)));
    transformedBounds.setP3(m_drawTransform.mapPoint(FloatPoint(bx, by)));
    transformedBounds.setP4(m_drawTransform.mapPoint(FloatPoint(bx, -by)));

    FloatRect rect = transformedBounds.boundingBox();

    if (m_ownerLayer->replicaLayer()) {
        FloatQuad bounds;
        bounds.setP1(m_replicaDrawTransform.mapPoint(FloatPoint(-bx, -by)));
        bounds.setP2(m_replicaDrawTransform.mapPoint(FloatPoint(-bx, by)));
        bounds.setP3(m_replicaDrawTransform.mapPoint(FloatPoint(bx, by)));
        bounds.setP4(m_replicaDrawTransform.mapPoint(FloatPoint(bx, -by)));
        rect.unite(bounds.boundingBox());
    }

    return rect;
}
コード例 #8
0
FloatQuad AffineTransform::mapQuad(const FloatQuad& q) const
{
    if (isIdentityOrTranslation()) {
        FloatQuad mappedQuad(q);
        mappedQuad.move(narrowPrecisionToFloat(m_transform[4]), narrowPrecisionToFloat(m_transform[5]));
        return mappedQuad;
    }

    FloatQuad result;
    result.setP1(mapPoint(q.p1()));
    result.setP2(mapPoint(q.p2()));
    result.setP3(mapPoint(q.p3()));
    result.setP4(mapPoint(q.p4()));
    return result;
}
コード例 #9
0
ファイル: AffineTransform.cpp プロジェクト: dslab-epfl/warr
FloatRect AffineTransform::mapRect(const FloatRect& rect) const
{
    if (isIdentityOrTranslation()) {
        FloatRect mappedRect(rect);
        mappedRect.move(narrowPrecisionToFloat(m_transform[4]), narrowPrecisionToFloat(m_transform[5]));
        return mappedRect;
    }

    FloatQuad result;
    result.setP1(mapPoint(rect.location()));
    result.setP2(mapPoint(FloatPoint(rect.right(), rect.y())));
    result.setP3(mapPoint(FloatPoint(rect.right(), rect.bottom())));
    result.setP4(mapPoint(FloatPoint(rect.x(), rect.bottom())));
    return result.boundingBox();
}
コード例 #10
0
static FloatQuad projectQuad(const TransformationMatrix& transform, const FloatQuad& q, bool& clamped)
{
    FloatQuad projectedQuad;
    bool clampedPoint;
    projectedQuad.setP1(transform.projectPoint(q.p1(), &clampedPoint));
    clamped = clampedPoint;
    projectedQuad.setP2(transform.projectPoint(q.p2(), &clampedPoint));
    clamped |= clampedPoint;
    projectedQuad.setP3(transform.projectPoint(q.p3(), &clampedPoint));
    clamped |= clampedPoint;
    projectedQuad.setP4(transform.projectPoint(q.p4(), &clampedPoint));
    clamped |= clampedPoint;

    return projectedQuad;
}
コード例 #11
0
FloatQuad TransformationMatrix::mapQuad(const FloatQuad& q) const
{
    if (isIdentityOrTranslation()) {
        FloatQuad mappedQuad(q);
        mappedQuad.move(static_cast<float>(m_matrix[3][0]), static_cast<float>(m_matrix[3][1]));
        return mappedQuad;
    }

    FloatQuad result;
    result.setP1(mapPoint(q.p1()));
    result.setP2(mapPoint(q.p2()));
    result.setP3(mapPoint(q.p3()));
    result.setP4(mapPoint(q.p4()));
    return result;
}