Пример #1
0
    void WebImage::loaded(Event* e)
    {
        if (_ref_counter <= 1)//if it is already dead
        {
            releaseRef();
            return;
        }


        dispatchEvent(e);

        file::buffer bf;
        _http->getResponseSwap(bf.data);

        Image mt;
        if (mt.init(bf, true))
        {
            _rs.init(&mt);
            _image->setResAnim(&_rs);

            fit();
        }

        _http = 0;
        releaseRef();
    }
 void HttpRequestEmscriptenTask::_onload(void* data, unsigned size)
 {
     log::messageln("HttpRequestEmscriptenTask::_onload");
     _response.assign((char*)data, (char*)data + size);
     onComplete();
     releaseRef();
 }
Пример #3
0
    void setInputRule(Rule::Semantic inputRule, Rule const &rule)
    {
        releaseRef(inputRules[inputRule]);
        inputRules[inputRule] = holdRef(rule);

        updateForChangedInput(inputRule);
    }
Пример #4
0
Error Surface::setIsCurrent(const gl::Context *context, bool isCurrent)
{
    if (isCurrent)
    {
        mRefCount++;
        return NoError();
    }

    return releaseRef(context->getCurrentDisplay());
}
 void HttpRequestEmscriptenTask::_onload(void* data, unsigned size)
 {
     log::messageln("HttpRequestEmscriptenTask::_onload");
     _response.assign((char*)data, (char*)data + size);
     if (!_fname.empty())
     {
         file::write(_fname.c_str(), data, size);
     }
     onComplete();
     releaseRef();
 }
Пример #6
0
 ~Instance()
 {
     for(int i = 0; i < int(Rule::MAX_SEMANTICS); ++i)
     {
         connectInputToOutputs(Rule::Semantic(i), false);
     }
     for(int i = 0; i < int(MAX_OUTPUT_RULES); ++i)
     {
         outputRules[i]->setSource(0);
         releaseRef(outputRules[i]);
     }
 }
Пример #7
0
    void MovieSprite::asyncDone()
    {
        addRef();
        core::getMainThreadMessages().postCallback([ = ]()
        {
            _playing = false;

            Event ev(MovieSprite::COMPLETE);
            dispatchEvent(&ev);

            releaseRef();
        });
    }
    void HttpRequestJavaTask::complete_(jbyteArray ar)
    {
        if (ar)
        {
            JNIEnv* env = jniGetEnv();
            jbyte* data = env->GetByteArrayElements(ar, 0);
            jint len = env->GetArrayLength(ar);
            _response.assign((char*)data, (char*)data + len);
            env->ReleaseByteArrayElements(ar, data, 0);
        }

        onComplete();
        releaseRef();
    }
Пример #9
0
    void MovieSprite::asyncDone()
    {
        addRef();
        core::getMainThreadDispatcher().postCallback([ = ]()
        {
            _playing = false;

            Event ev(MovieSprite::COMPLETE);
            dispatchEvent(&ev);

            if (_detachWhenDone)
                detach();

            releaseRef();
        });
    }
Пример #10
0
    void WebImage::loaded(Event* e)
    {
        dispatchEvent(e);

        file::buffer bf;
        _http->getResponseSwap(bf.data);

        Image mt;
        if (mt.init(bf, true))
        {
            ResAnim rs;
            rs.init(&mt);
            float w = (float)rs.getFrame(0, 0).getWidth();
            if (w != 0.0f)
                _image->setScale(getWidth() / w);
            _image->setAnimFrame(&rs);
        }

        _http = 0;
        releaseRef();
    }
Пример #11
0
 void AsyncTask::_threadCB(const ThreadDispatcher::message& msg)
 {
     switch (msg.msgid)
     {
         case successID:
             _complete();
             break;
         case errorID:
             _error();
             break;
         case runID:
             _run();
             break;
         case customID:
             _custom(msg);
             break;
         default:
             break;
     }
     if (msg.msgid != customID)
         releaseRef();
 }
 void HttpRequestJavaTask::error_()
 {
     onError();
     releaseRef();
 }
 void HttpRequestEmscriptenTask::_onerror(int, const char*)
 {
     log::messageln("HttpRequestEmscriptenTask::_onerror");
     onError();
     releaseRef();
 }
Пример #14
0
    void clearInputRule(Rule::Semantic inputRule)
    {
        releaseRef(inputRules[inputRule]);

        updateForChangedInput(inputRule);
    }
Пример #15
0
 void WebImage::error(Event* e)
 {
     dispatchEvent(e);
     releaseRef();
     _http = 0;
 }
Пример #16
0
Error Surface::releaseTexImageFromTexture(const gl::Context *context)
{
    ASSERT(mTexture);
    mTexture = nullptr;
    return releaseRef(context->getCurrentDisplay());
}