コード例 #1
0
ファイル: Canvas.cpp プロジェクト: IlyaSkriblovsky/lx
void Canvas::copyRotatedCanvas(const Canvas* canvas, const Rect& src, const Point& origin)
{
    XTransform xform = {{
        { XDoubleToFixed(0), XDoubleToFixed(-1), XDoubleToFixed(0) },
        { XDoubleToFixed(1), XDoubleToFixed(0), XDoubleToFixed(0) },
        { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1) },
    }};
    XRenderSetPictureTransform(display()->xdisplay(), canvas->xpicture(), &xform);

    Point offset = absolutePosition();

    XRenderComposite(
        display()->xdisplay(), PictOpOver,
        canvas->xpicture(), None, xpicture(),
//        src.origin.x, src.origin.y,
//        0, 0,
//        origin.x + offset.x, origin.y + offset.y,
//        src.size.w, src.size.h
        src.origin.x, -src.size.w,
        0, 0,
        origin.x + offset.x, origin.y + offset.y,
        src.size.w, src.size.h
    );

    XTransform identity = {{
        { XDoubleToFixed(1), XDoubleToFixed(0), XDoubleToFixed(0) },
        { XDoubleToFixed(0), XDoubleToFixed(1), XDoubleToFixed(0) },
        { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1) },
    }};
    XRenderSetPictureTransform(display()->xdisplay(), canvas->xpicture(), &identity);
}
コード例 #2
0
ファイル: popupbutton.cpp プロジェクト: DanGroom/NanoguiBlock
void PopupButton::performLayout (NVGcontext * ctx)
{
   Widget::performLayout (ctx);
   const Window * parentWindow = window();
   mPopup->setAnchorPos (ivec2 (parentWindow->width() + 15,
                                   absolutePosition().y - parentWindow->position().y + mSize.y / 2));
}
コード例 #3
0
ファイル: Canvas.cpp プロジェクト: IlyaSkriblovsky/lx
void Canvas::copyCanvas(const Canvas* canvas, const Rect& src, const Point& origin, bool copyAlpha)
{
    Point offset = absolutePosition();

    if (
        (rgba() == false && canvas->rgba() == false) ||
        (rgba() == true && canvas->rgba() == true && copyAlpha)
       )
    {
        XCopyArea(
            display()->xdisplay(),
            canvas->xdrawable(), xdrawable(),
            xgc(),
            src.origin.x, src.origin.y,
            src.size.w, src.size.h,
            origin.x + offset.x, origin.y + offset.y
        );
    }
    else
    {
        XRenderComposite(
            display()->xdisplay(), PictOpOver,
            canvas->xpicture(), None, xpicture(),
            src.origin.x, src.origin.y,
            0, 0,
            origin.x + offset.x, origin.y + offset.y,
            src.size.w, src.size.h
        );
    }
}
コード例 #4
0
ファイル: RenderWidget.cpp プロジェクト: Gin-Rye/duibrowser
void RenderWidget::updateWidgetPosition()
{
    if (!m_widget)
        return;

    int x;
    int y;
    absolutePosition(x, y);
    x += borderLeft() + paddingLeft();
    y += borderTop() + paddingTop();

    int width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
    int height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();

    IntRect newBounds(x, y, width, height);
    IntRect oldBounds(m_widget->frameGeometry());
    if (newBounds != oldBounds) {
        // The widget changed positions.  Update the frame geometry.
        if (checkForRepaintDuringLayout()) {
            RenderView* v = view();
            if (!v->printing()) {
                v->repaintViewRectangle(oldBounds);
                v->repaintViewRectangle(newBounds);
            }
        }

        RenderArena* arena = ref();
        element()->ref();
        m_widget->setFrameGeometry(newBounds);
        element()->deref();
        deref(arena);
    }
}
コード例 #5
0
ファイル: button.cpp プロジェクト: dambito/kbattleship
void Button::updateEditor()
{
    if (m_editor) {
        const int SPACE = 9;
        m_editor->setGeometry(QRect(absolutePosition() + QPoint(textPos().x(), SPACE),
            QSize(m_size.width() - 10 - 10 - 32 - 10, m_size.height() - SPACE * 2)));
    }
}
コード例 #6
0
ファイル: Player.cpp プロジェクト: NoahKittleson/RPG-Engine
sf::FloatRect Player::getAbsBox() {
    auto position = getPosition();
    auto scale = getScale().x;
    sf::FloatRect absolutePosition (position.x + box.left * scale,
                                    position.y + box.top * scale,
                                    box.width * scale,
                                    box.height * scale);
    return absolutePosition;
}
コード例 #7
0
ファイル: Canvas.cpp プロジェクト: IlyaSkriblovsky/lx
void Canvas::fillRectangle(const Rect& rect, const Color& color)
{
    Point offset = absolutePosition();

    XSetForeground(display()->xdisplay(), xgc(), color.uint());

    XFillRectangle(
        display()->xdisplay(), xdrawable(), xgc(),
        rect.origin.x + offset.x, rect.origin.y + offset.y,
        rect.size.w, rect.size.h
    );
}
コード例 #8
0
ファイル: Canvas.cpp プロジェクト: IlyaSkriblovsky/lx
void Canvas::drawLine(const Point& a, const Point& b)
{
    XSetForeground(display()->xdisplay(), xgc(), 0xffffff);

    Point offset = absolutePosition();

    XDrawLine(
        display()->xdisplay(), xdrawable(), xgc(),
        a.x + offset.x, a.y + offset.y,
        b.x + offset.x, b.y + offset.y
    );
}
コード例 #9
0
IntRect RenderListMarker::selectionRect(bool clipToVisibleContent)
{
    ASSERT(!needsLayout());

    if (selectionState() == SelectionNone || !inlineBoxWrapper())
        return IntRect();

    RootInlineBox* root = inlineBoxWrapper()->root();
    IntRect rect(0, root->selectionTop() - yPos(), width(), root->selectionHeight());
            
    if (clipToVisibleContent)
        computeAbsoluteRepaintRect(rect);
    else {
        int absx, absy;
        absolutePosition(absx, absy);
        rect.move(absx, absy);
    }
    
    return rect;
}
/**
 void BasicRocketLauncher::fireRocket(Grenade *g)
 Removes the child and adds it as a projectile.
 */
void BasicRocketLauncher::fireRocket(Grenade *g) {
	Vec3d pos=absolutePosition();

	Vec3d ang=absoluteAngle();

	g->init(pos, ang, Vec3d(0,0,0), 5, 5);
	g->parent=NULL;
	g->activate();
	g->setAnimation(NULL);

	for(int i=0;i<model->numAttachPoints;i++) {
		if(children[i]==g) {
			children[i]=NULL;
			attachPointsFilled[i]=false;
			numChildren--;
		}
	}

	addLaser(g, player);
}
コード例 #11
0
ファイル: RenderSVGText.cpp プロジェクト: acss/owb-mirror
void RenderSVGText::absoluteRects(Vector<IntRect>& rects, int, int, bool)
{
    RenderSVGRoot* root = findSVGRootObject(parent());
    if (!root)
        return;

    int x, y;
    absolutePosition(x, y);

    AffineTransform htmlParentCtm = root->RenderContainer::absoluteTransform();
 
    // Don't use relativeBBox here, as it's unites the selection rects. Makes it hard
    // to spot errors, if there are any using WebInspector. Individually feed them into 'rects'.
    for (InlineRunBox* runBox = firstLineBox(); runBox; runBox = runBox->nextLineBox()) {
        ASSERT(runBox->isInlineFlowBox());

        InlineFlowBox* flowBox = static_cast<InlineFlowBox*>(runBox);
        for (InlineBox* box = flowBox->firstChild(); box; box = box->nextOnLine()) {
            FloatRect boxRect(box->xPos(), box->yPos(), box->width(), box->height());
            boxRect.move(narrowPrecisionToFloat(x - htmlParentCtm.e()), narrowPrecisionToFloat(y - htmlParentCtm.f()));
            rects.append(enclosingIntRect(absoluteTransform().mapRect(boxRect)));
        }
    }
}
コード例 #12
0
ファイル: Canvas.cpp プロジェクト: IlyaSkriblovsky/lx
void Canvas::copyScaleCanvas(const Canvas* canvas, const Rect& src, const Rect& dst)
{
    if (src.size == dst.size)
    {
        copyCanvas(canvas, src, dst.origin);
        return;
    }

    if (dst.size.w <= 0 || dst.size.h <= 0)
        return;

    XTransform xform = {{
        { XDoubleToFixed((double)src.size.w / dst.size.w), XDoubleToFixed(0), XDoubleToFixed(src.origin.x) },
        { XDoubleToFixed(0), XDoubleToFixed((double)src.size.h / dst.size.h), XDoubleToFixed(src.origin.y) },
        { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1) },
    }};
    XRenderSetPictureTransform(display()->xdisplay(), canvas->xpicture(), &xform);

    Point offset = absolutePosition();

    XRenderComposite(
        display()->xdisplay(), PictOpOver,
        canvas->xpicture(), None, xpicture(),
        0, 0,
        0, 0,
        dst.origin.x + offset.x, dst.origin.y + offset.y,
        dst.size.w, dst.size.h
    );

    XTransform identity = {{
        { XDoubleToFixed(1), XDoubleToFixed(0), XDoubleToFixed(0) },
        { XDoubleToFixed(0), XDoubleToFixed(1), XDoubleToFixed(0) },
        { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1) },
    }};
    XRenderSetPictureTransform(display()->xdisplay(), canvas->xpicture(), &identity);
}
コード例 #13
0
ファイル: TextArea.cpp プロジェクト: dvdbrink/gdl
void TextArea::absolutePositionChanged()
{
    _rect.position(absolutePosition());
}