Exemplo n.º 1
0
void ShellWindow::onSizeChange() {
    this->INHERITED::onSizeChange();

    SkView::F2BIter iter(this);
    SkView* view = iter.next();
    view->setSize(this->width(), this->height());
}
Exemplo n.º 2
0
void State::setViewport(int w, int h) {
    fViewport.set(w, h);
    if (fView) {
        fView->setSize(SkIntToScalar(w), SkIntToScalar(h));
    }
    resetGpuState();
}
Exemplo n.º 3
0
void SampleWindow::onSizeChange() {
    this->INHERITED::onSizeChange();

    SkView::F2BIter iter(this);
    SkView* view = iter.next();
    view->setSize(this->width(), this->height());

    // rebuild our clippath
    {
        const SkScalar W = this->width();
        const SkScalar H = this->height();

        fClipPath.reset();
#if 0
        for (SkScalar y = SK_Scalar1; y < H; y += SkIntToScalar(32)) {
            SkRect r;
            r.set(SK_Scalar1, y, SkIntToScalar(30), y + SkIntToScalar(30));
            for (; r.fLeft < W; r.offset(SkIntToScalar(32), 0))
                fClipPath.addRect(r);
        }
#else
        SkRect r;
        r.set(0, 0, W, H);
        fClipPath.addRect(r, SkPath::kCCW_Direction);
        r.set(W/4, H/4, W*3/4, H*3/4);
        fClipPath.addRect(r, SkPath::kCW_Direction);
#endif
    }

    this->updateTitle();    // to refresh our config
}
void SkFillViewLayout::onLayoutChildren(SkView* parent)
{
    SkView::B2FIter    iter(parent);
    SkView*            child;

    while ((child = iter.next()) != nullptr)
    {
        child->setLoc(fMargin.fLeft, fMargin.fTop);
        child->setSize(    parent->width() - fMargin.fRight - fMargin.fLeft,
                        parent->height() - fMargin.fBottom - fMargin.fTop);
    }
}
Exemplo n.º 5
0
void OverView::onSizeChange() {
    this->detachAllChildren();

    SkScalar locX = 0;
    SkScalar locY = 0;
    for (int i = 0; i < fCount; i++) {
        SkView* view = (*fFactories[i])();
        view->setVisibleP(true);
        this->attachChildToBack(view)->unref();
        view->setLoc(locX, locY);
        view->setSize(W, H);
        locX += W;
        if ((i % N) == N - 1) {
            locY += H;
            locX = 0;
        }
    }
}