Exemplo n.º 1
0
void RevoluteJoint::Create(b2World &world,
                           const BasicShape &joinedBody1,
                           const BasicShape &joinedBody2,
                           const b2Vec2 &anchor1,
                           const b2Vec2 &anchor2,
                           const bool collideConnected,
                           const float lowerAngle,
                           const float upperAngle,
                           const bool enableLimit,
                           const float maxMotorTorque,
                           const float motorSpeed,
                           const bool enableMotor,
                           const float referenceAngle)
{
    b_ptrJoinedBody1 = const_cast<b2Body*>(joinedBody1.GetBody());
    b_ptrJoinedBody2 = const_cast<b2Body*>(joinedBody2.GetBody());

    //b2RevoluteJointDef revoluteJointDefinition;
    _revoluteJointDefinition.bodyA = b_ptrJoinedBody1;
    _revoluteJointDefinition.bodyB = b_ptrJoinedBody2;
    _revoluteJointDefinition.localAnchorA = anchor1;
    _revoluteJointDefinition.localAnchorB = anchor2;
    _revoluteJointDefinition.collideConnected = collideConnected;
    _revoluteJointDefinition.lowerAngle = lowerAngle;
    _revoluteJointDefinition.upperAngle = upperAngle;
    _revoluteJointDefinition.enableLimit = enableLimit;
    _revoluteJointDefinition.maxMotorTorque = maxMotorTorque;
    _revoluteJointDefinition.motorSpeed = motorSpeed;
    _revoluteJointDefinition.enableMotor = enableMotor;
    _revoluteJointDefinition.referenceAngle = referenceAngle;

    b_ptrJoint = world.CreateJoint(&_revoluteJointDefinition);
}
Exemplo n.º 2
0
bool ExclusionShapeInsideInfo::isExclusionShapeInsideInfoEnabledForRenderBlock(const RenderBlock* block)
{
    // FIXME: Bug 89707: Enable shape inside for non-rectangular shapes
    ExclusionShapeValue* shapeValue = block->style()->shapeInside();
    BasicShape* shape = (shapeValue && shapeValue->type() == ExclusionShapeValue::SHAPE) ? shapeValue->shape() : 0;
    return shape && (shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE || shape->type() == BasicShape::BASIC_SHAPE_POLYGON);
}
Exemplo n.º 3
0
bool ExclusionShapeInsideInfo::isEnabledFor(const RenderBlock* renderer)
{
    ExclusionShapeValue* shapeValue = renderer->style()->resolvedShapeInside();
    if (!shapeValue || shapeValue->type() != ExclusionShapeValue::Shape)
        return false;

    BasicShape* shape = shapeValue->shape();
    return shape && shape->type() != BasicShape::BasicShapeInsetRectangleType;
}
Exemplo n.º 4
0
bool WrapShapeInfo::isWrapShapeInfoEnabledForRenderBlock(const RenderBlock* block)
{
    // FIXME: Bug 89705: Enable shape inside for vertical writing modes
    if (!block->isHorizontalWritingMode())
        return false;

    // FIXME: Bug 89707: Enable shape inside for non-rectangular shapes
    BasicShape* shape = block->style()->wrapShapeInside();
    return (shape && shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE);
}
Exemplo n.º 5
0
bool BasicShapeCircle::canBlend(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    return radius().canBlend(downcast<BasicShapeCircle>(other).radius());
}
Exemplo n.º 6
0
bool BasicShapePath::operator==(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    auto& otherPath = downcast<BasicShapePath>(other);
    return m_windRule == otherPath.m_windRule && *m_byteStream == *otherPath.m_byteStream;
}
Exemplo n.º 7
0
bool BasicShapePath::canBlend(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    auto& otherPath = downcast<BasicShapePath>(other);
    return windRule() == otherPath.windRule() && canBlendSVGPathByteStreams(*m_byteStream, *otherPath.pathData());
}
Exemplo n.º 8
0
bool BasicShapePolygon::canBlend(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    auto& otherPolygon = downcast<BasicShapePolygon>(other);
    return values().size() == otherPolygon.values().size() && windRule() == otherPolygon.windRule();
}
Exemplo n.º 9
0
bool BasicShapeEllipse::canBlend(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    auto& otherEllipse = downcast<BasicShapeEllipse>(other);
    return radiusX().canBlend(otherEllipse.radiusX()) && radiusY().canBlend(otherEllipse.radiusY());
}
Exemplo n.º 10
0
bool BasicShapePolygon::operator==(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    auto& otherPolygon = downcast<BasicShapePolygon>(other);
    return m_windRule == otherPolygon.m_windRule
        && m_values == otherPolygon.m_values;
}
Exemplo n.º 11
0
bool BasicShapeCircle::operator==(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    auto& otherCircle = downcast<BasicShapeCircle>(other);
    return m_centerX == otherCircle.m_centerX
        && m_centerY == otherCircle.m_centerY
        && m_radius == otherCircle.m_radius;
}
Exemplo n.º 12
0
 VGImage::StyleType VGImage::getCorrectStrokeStyle(StrokeStyle *s, const BasicShape& shape)
 {
   if(shape.hasOwnStrokeStyle())
   {
     *s = shape.getStrokeStyle();
     if(!s->getColor().isClear())
       return SHAPE;
     else
       return CLEAR;
   }
   else if(defaults->useSS)
   {
     *s = defaults->strokeStyle;
     if(!s->getColor().isClear())
       return DEFAULT;
     else
       return CLEAR;
   }
   return NONE;
 }
Exemplo n.º 13
0
Ref<BasicShape> BasicShapeCircle::blend(const BasicShape& other, double progress) const
{
    ASSERT(type() == other.type());
    auto& otherCircle = downcast<BasicShapeCircle>(other);
    auto result =  BasicShapeCircle::create();

    result->setCenterX(m_centerX.blend(otherCircle.centerX(), progress));
    result->setCenterY(m_centerY.blend(otherCircle.centerY(), progress));
    result->setRadius(m_radius.blend(otherCircle.radius(), progress));
    return WTFMove(result);
}
Exemplo n.º 14
0
bool BasicShapeEllipse::operator==(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    auto& otherEllipse = downcast<BasicShapeEllipse>(other);
    return m_centerX == otherEllipse.m_centerX
        && m_centerY == otherEllipse.m_centerY
        && m_radiusX == otherEllipse.m_radiusX
        && m_radiusY == otherEllipse.m_radiusY;
}
Exemplo n.º 15
0
Ref<BasicShape> BasicShapePath::blend(const BasicShape& from, double progress) const
{
    ASSERT(type() == from.type());

    auto& fromPath = downcast<BasicShapePath>(from);

    auto resultingPathBytes = std::make_unique<SVGPathByteStream>();
    buildAnimatedSVGPathByteStream(*fromPath.m_byteStream, *m_byteStream, *resultingPathBytes, progress);

    auto result = BasicShapePath::create(WTFMove(resultingPathBytes));
    result->setWindRule(windRule());
    return WTFMove(result);
}
Exemplo n.º 16
0
bool BasicShapeInset::operator==(const BasicShape& other) const
{
    if (type() != other.type())
        return false;

    auto& otherInset = downcast<BasicShapeInset>(other);
    return m_right == otherInset.m_right
        && m_top == otherInset.m_top
        && m_bottom == otherInset.m_bottom
        && m_left == otherInset.m_left
        && m_topLeftRadius == otherInset.m_topLeftRadius
        && m_topRightRadius == otherInset.m_topRightRadius
        && m_bottomRightRadius == otherInset.m_bottomRightRadius
        && m_bottomLeftRadius == otherInset.m_bottomLeftRadius;
}
Exemplo n.º 17
0
Ref<BasicShape> BasicShapeInset::blend(const BasicShape& other, double progress) const
{
    ASSERT(type() == other.type());

    auto& otherInset = downcast<BasicShapeInset>(other);
    auto result =  BasicShapeInset::create();
    result->setTop(m_top.blend(otherInset.top(), progress));
    result->setRight(m_right.blend(otherInset.right(), progress));
    result->setBottom(m_bottom.blend(otherInset.bottom(), progress));
    result->setLeft(m_left.blend(otherInset.left(), progress));

    result->setTopLeftRadius(m_topLeftRadius.blend(otherInset.topLeftRadius(), progress));
    result->setTopRightRadius(m_topRightRadius.blend(otherInset.topRightRadius(), progress));
    result->setBottomRightRadius(m_bottomRightRadius.blend(otherInset.bottomRightRadius(), progress));
    result->setBottomLeftRadius(m_bottomLeftRadius.blend(otherInset.bottomLeftRadius(), progress));

    return WTFMove(result);
}
Exemplo n.º 18
0
Ref<BasicShape> BasicShapeEllipse::blend(const BasicShape& other, double progress) const
{
    ASSERT(type() == other.type());
    auto& otherEllipse = downcast<BasicShapeEllipse>(other);
    auto result = BasicShapeEllipse::create();

    if (m_radiusX.type() != BasicShapeRadius::Value || otherEllipse.radiusX().type() != BasicShapeRadius::Value
        || m_radiusY.type() != BasicShapeRadius::Value || otherEllipse.radiusY().type() != BasicShapeRadius::Value) {
        result->setCenterX(otherEllipse.centerX());
        result->setCenterY(otherEllipse.centerY());
        result->setRadiusX(otherEllipse.radiusX());
        result->setRadiusY(otherEllipse.radiusY());
        return WTFMove(result);
    }

    result->setCenterX(m_centerX.blend(otherEllipse.centerX(), progress));
    result->setCenterY(m_centerY.blend(otherEllipse.centerY(), progress));
    result->setRadiusX(m_radiusX.blend(otherEllipse.radiusX(), progress));
    result->setRadiusY(m_radiusY.blend(otherEllipse.radiusY(), progress));
    return WTFMove(result);
}
Exemplo n.º 19
0
Ref<BasicShape> BasicShapePolygon::blend(const BasicShape& other, double progress) const
{
    ASSERT(type() == other.type());

    auto& otherPolygon = downcast<BasicShapePolygon>(other);
    ASSERT(m_values.size() == otherPolygon.values().size());
    ASSERT(!(m_values.size() % 2));

    size_t length = m_values.size();
    auto result = BasicShapePolygon::create();
    if (!length)
        return WTFMove(result);

    result->setWindRule(otherPolygon.windRule());

    for (size_t i = 0; i < length; i = i + 2) {
        result->appendPoint(m_values.at(i).blend(otherPolygon.values().at(i), progress),
            m_values.at(i + 1).blend(otherPolygon.values().at(i + 1), progress));
    }

    return WTFMove(result);
}
Exemplo n.º 20
0
bool BasicShapeInset::canBlend(const BasicShape& other) const
{
    return type() == other.type();
}