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(); }
void setInputRule(Rule::Semantic inputRule, Rule const &rule) { releaseRef(inputRules[inputRule]); inputRules[inputRule] = holdRef(rule); updateForChangedInput(inputRule); }
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(); }
~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]); } }
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(); }
void MovieSprite::asyncDone() { addRef(); core::getMainThreadDispatcher().postCallback([ = ]() { _playing = false; Event ev(MovieSprite::COMPLETE); dispatchEvent(&ev); if (_detachWhenDone) detach(); releaseRef(); }); }
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(); }
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(); }
void clearInputRule(Rule::Semantic inputRule) { releaseRef(inputRules[inputRule]); updateForChangedInput(inputRule); }
void WebImage::error(Event* e) { dispatchEvent(e); releaseRef(); _http = 0; }
Error Surface::releaseTexImageFromTexture(const gl::Context *context) { ASSERT(mTexture); mTexture = nullptr; return releaseRef(context->getCurrentDisplay()); }