virtual bool onEvent(const SkEvent& evt) {
        if (evt.isType(gReplaceTransitionEvt)) {
            SkView* prev = fPrev;
            prev->ref();

            fPrev->detachFromParent();
            fPrev = (SkView*)SkEventSink::FindSink(evt.getFast32());
            (void)SampleView::SetUsePipe(fPrev, SkOSMenu::kOffState);
            //attach the new fPrev and call unref to balance the ref in onDraw
            this->attachChildToBack(fPrev)->unref();
            this->inval(NULL);

            SkASSERT(1 == prev->getRefCnt());
            prev->unref();
            return true;
        }
        if (evt.isType("transition-done")) {
            fNext->setLoc(0, 0);
            fNext->setClipToBounds(false);
            SkEvent* evt = new SkEvent(gReplaceTransitionEvt,
                                       this->getParent()->getSinkID());
            evt->setFast32(fNext->getSinkID());
            //increate ref count of fNext so it survives detachAllChildren
            fNext->ref();
            this->detachAllChildren();
            evt->post();
            return true;
        }
        return this->INHERITED::onEvent(evt);
    }
Ejemplo n.º 2
0
void SkOSWindow::onHandleInval(const SkIRect&)
{
    SkEvent* evt = new SkEvent("inval-imageview");
    evt->post(getSinkID());
}
Ejemplo n.º 3
0
 void postAnimatingEvent() {
     if (fAnimating) {
         SkEvent* evt = new SkEvent(ANIMATING_EVENTTYPE);
         evt->post(this->getSinkID(), ANIMATING_DELAY);
     }
 }