void Java_java_lang_Class_newInstance(void) { INSTANCE_CLASS currentClass = getFP()->thisMethod->ofClass; CLASS clazz = topStackAsType(CLASS); if (IS_ARRAY_CLASS(clazz) || ((clazz->accessFlags & (ACC_INTERFACE | ACC_ABSTRACT)) != 0)) { raiseException("java/lang/InstantiationException"); return; } if (classHasAccessToClass(currentClass, clazz)) { METHOD method = lookupMethod(clazz, initNameAndType, currentClass); if ( (method != NULL) && (method->ofClass == (INSTANCE_CLASS)clazz) /* I don't understand why, but we're not allowed access to * a protected <init> method of a superclass. */ && classHasAccessToMember(currentClass, (method->accessFlags & ~ACC_PROTECTED), (INSTANCE_CLASS)clazz, (INSTANCE_CLASS)clazz) ) { START_TEMPORARY_ROOTS DECLARE_TEMPORARY_ROOT(INSTANCE, object, instantiate((INSTANCE_CLASS)clazz)); if (object != NULL) { /* Put the result back on the stack */ topStackAsType(INSTANCE) = object; /* Will get the result */ /* We now need to call the initializer. We'd like to just * push a second copy of the object onto the stack, and then * do pushFrame(method). But we can't, because that would * not necessarily coincide with the stack map of the * current method. */ pushFrame(RunCustomCodeMethod); pushStackAsType(CustomCodeCallbackFunction, newInstanceReturnObject); pushStackAsType(INSTANCE, object); /* pushFrame may signal a stack overflow. */ pushFrame(method); } else { /* We will already have thrown an appropriate error */ } END_TEMPORARY_ROOTS return; } }
/* void mainInit(char* className, Interpretador* interpretador, int paramsNumber, char** cmdLineParams) { char* methodName = "main", methodDescriptor = "([Ljava/lang/String;)V"; ClassFile* cFile = loadClass(interpretador, className); pushFrame(&(interpretador->topStackFrame)); frameInit(interpretador->initClass, *cFile, interpretador->topStackFrame, methodName, methodDescriptor); } */ void methodInit(char* className, char* methodName, char* methodDescriptor, Interpretador* interpretador, int paramsNumber, int print) { int i; ClassFile* cFile = loadClass(interpretador, className); printf("FEZ LOAD\n"); if (print) printClass(cFile, className); pushFrame(&(interpretador->topStackFrame)); printf("\n\nPUSHOUFRAME\n"); frameInit(interpretador->initClass, *cFile, interpretador->topStackFrame, methodName, methodDescriptor); printf("\n\nINITIOUFRAME\n"); if (interpretador->topStackFrame->nextFrame != NULL) { /*if (interpretador->topStackFrame->nextFrame != NULL) {*/ for (i = countSlots(interpretador->topStackFrame->nextFrame->frame->topOperand, paramsNumber) - 1; i >= 0; i--) { if (interpretador->topStackFrame->nextFrame->frame->topOperand->operand.type32_64 == CAT2) i--; interpretador->topStackFrame->frame->localVarArray[i] = (int)&(interpretador->topStackFrame->nextFrame->frame->topOperand); } } printf("\n\nSAIU DA METHOD INIT\n"); /*}*/ }
void callFunc(int funcIdx, int paramCount, int requireRetN) { auto stack = LuaVM::instance()->getCurrentStack(); auto func = stack->values()[funcIdx].getFunction(); if (func->funcType == Function::FT_Lua) { auto stack = LuaVM::instance()->getCurrentStack(); auto lfunc = static_cast<LuaFunction*>(func); int paramBase = funcIdx + 1; { int reqParamCount = lfunc->meta->argCount; if (paramCount < reqParamCount) { stack->reserveValueSpace(paramBase + reqParamCount); for (int i = paramCount; i < reqParamCount; ++i) { stack->values()[paramBase + i] = LuaValue::NIL; } paramCount = reqParamCount; } } stack->pushFrame(lfunc, paramBase, paramCount, requireRetN); } else if (func->funcType == Function::FT_C) { auto stack = LuaVM::instance()->getCurrentStack(); auto &values = stack->values(); vector<LuaValue> args(values.begin() + funcIdx + 1, values.begin() + funcIdx + 1 + paramCount); vector<LuaValue> rets; static_cast<CFunction*>(func)->func(args, rets); if (requireRetN > 0) rets.resize(requireRetN, LuaValue::NIL); if (rets.empty()) rets.push_back(LuaValue::NIL); stack->reserveValueSpace(funcIdx + (int)rets.size()); std::copy(rets.begin(), rets.end(), values.begin() + funcIdx); stack->topFrame()->setExtCount((int)rets.size()); } else { ASSERT(0); } }
void CanonCamera::saveFrame() { Surface sf = mCanon.getLiveSurface(); float h = sf.getWidth() * 9.0f / 16.0f; Surface frame(sf.getWidth(),h,false); frame.copyFrom( sf, Area(0,0,sf.getWidth(), h) ); pushFrame( frame ); }
void Animation::addTileFrame(Image *pImage, const Rect &tileRect) { AnimationFrame *pFrame = new AnimationFrame(pImage, tileRect, Vec(0.0f, 0.0f)); pushFrame(pFrame); }
int SGSVirtualMachine::runStatement(SGSStatement* statement) { SGSStatementStackFrameBase* frame=statement->getStackFrame(); frame->setParentFrame(&getFrameStackTop()); pushFrame(frame); int result=statement->run(); popFrame(); return result; }
JSVM::JSVM() { GCObjectManager::createInstance(); JSStringManager::createInstance(); m_frames.reserve(1024); m_values.reserve(1024 * 64); m_values.push_back(JSValue::NIL); pushFrame(NULL, &m_values[0]); }
void Animation::addFrame(Image *pImage, const Vec &m_alignPoint) { AnimationFrame *pFrame = new AnimationFrame(pImage, Rect(0.0f, 0.0f, (float)pImage->width() - 1.0f, (float)pImage->height() - 1.0f), m_alignPoint); pushFrame(pFrame); }
AnimatedSprite::AnimatedSprite(sf::Sprite initialFrame) :sf::Drawable(), sf::Transformable(), m_numFrames(0), m_frameLength(1.0f/24.0f), m_totalLength(0), m_loop(false), m_playing(false), m_resetOnPlay(false), m_timer(), m_pauseTimer(), m_totalTimePaused(), m_frameTimeOffset(), m_color(sf::Color::White), m_spriteBlendMode(sf::BlendMultiply) { pushFrame(initialFrame); GotoFrame(0); }
void Animation::addFrame(Image *pImage) { AnimationFrame *pFrame = new AnimationFrame(pImage, Rect(0.0f, 0.0f, (float)pImage->width() - 1.0f, (float)pImage->height() - 1.0f), Vec(0.0f, 0.0f)); pushFrame(pFrame); }
void VideoDecoder::convertAndPushPicture(const AVFrame* frame) { // Allocate a picture to hold the YUV data AVFrame* yuvFrame = av_frame_alloc(); av_frame_copy(yuvFrame, frame); yuvFrame->format = DESTINATION_FORMAT; av_image_alloc(yuvFrame->data, yuvFrame->linesize, m_status->videoCodecPars.width, m_status->videoCodecPars.height, DESTINATION_FORMAT, 1); std::unique_ptr<FFMPEGVideoFrame> videoFramePtr(new FFMPEGVideoFrame()); if (m_status->videoCodecPars.pixel_format == DESTINATION_FORMAT) { av_image_copy(yuvFrame->data, yuvFrame->linesize, (const uint8_t**) (frame->data), frame->linesize, DESTINATION_FORMAT, m_status->videoCodecPars.width, m_status->videoCodecPars.height); } else { // Convert frame to YUV sws_scale( m_swsCtx, (uint8_t const* const*) frame->data, frame->linesize, 0, m_status->videoCodecPars.height, yuvFrame->data, yuvFrame->linesize ); } videoFramePtr->id = ++m_frameId; #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 3, 102) videoFramePtr->frameTime = getFrameTime(frame->best_effort_timestamp, m_status->videoStream->time_base); #else videoFramePtr->frameTime = getFrameTime(av_frame_get_best_effort_timestamp(frame), m_status->videoStream->time_base); #endif videoFramePtr->frame = yuvFrame; videoFramePtr->ySize.height = static_cast<size_t>(m_status->videoCodecPars.height); videoFramePtr->ySize.width = static_cast<size_t>(m_status->videoCodecPars.width); videoFramePtr->ySize.stride = static_cast<size_t>(yuvFrame->linesize[0]); // 420P means that the UV channels have half the width and height videoFramePtr->uvSize.height = static_cast<size_t>(m_status->videoCodecPars.height / 2); videoFramePtr->uvSize.width = static_cast<size_t>(m_status->videoCodecPars.width / 2); videoFramePtr->uvSize.stride = static_cast<size_t>(yuvFrame->linesize[1]); pushFrame(VideoFramePtr(videoFramePtr.release())); }
tChyba PROM() { int analyza; int ret; //TItem *pt; //PROM->id TERM2 if(token.stav == s_identifikator) { if(byla_funkce == false) { //pokud nejsme v definici funkce vytvori se lokalni ramec ret = pushFrame(); if(ret != S_BEZ_CHYB) { return ret; } } if(byla_funkce == false) { //ukazatel na id v tabulce TFunction *tmp = searchFuncTable( token.data ); if( !tmp ){ return S_SEMANTICKA_CHYBA_NEDEF; } //kopirovani dat z tabulky definice funkce do nove vznikleho lokalniho ramce ret = copyTable( tmp);//, ptrhtLocal ); if(ret != S_BEZ_CHYB) { return ret; } } token = getNextToken(); if(token.stav == s_lex_error) { return S_LEXIKALNI_CHYBA; } //volani funkce na zpracovani argumentu analyza = TERM2(); if(analyza != S_BEZ_CHYB) { return analyza; } else { if(byla_funkce == false) { //pokud nejsme v definici funkce musime na konci vypopnout ukazatel na lokalni ramec popFrame(); } return S_BEZ_CHYB; } return S_SYNTAKTICKA_CHYBA; } return S_SYNTAKTICKA_CHYBA; }
void AudioDecoder::flushAudioBuffer() { if (m_audioBuffer.empty()) { // Nothing to do here return; } AudioFramePtr audioFrame(new AudioFrame()); audioFrame->channels = OUT_NUM_CHANNELS; audioFrame->rate = OUT_SAMPLE_RATE; audioFrame->audioData.assign(m_audioBuffer.begin(), m_audioBuffer.end()); pushFrame(std::move(audioFrame)); m_audioBuffer.clear(); }
SGSValue SGSVirtualMachine::runFunction(SGSFunction* function,SGSArguments *args) { SGSStatementStackFrameBase* frame=new SGSFunctionStackFrame(); frame->setParentFrame(&getFrameStackTop()); int sumMax=std::max(args->count(),function->getParameter()->count()); for (int i=0; i<sumMax; ++i) { SGSValue result=this->runExpression((*args)[i]); if (i==0) frame->registerValue(m_analyzer.getIdentifierId("function"),result); frame->registerValue((*function->getParameter())[i],result); } pushFrame(frame); SGSValue result=function->run(); popFrame(); return result; }
bool StreamOutputWidget::event(QEvent* event) { if (event->type() == QEvent::User) { SeparatedSourceEvent* sepEvent = dynamic_cast<SeparatedSourceEvent*>(event); if (sepEvent) { //qDebug("Writing to stack..."); if(m_enabled) { pushFrame(sepEvent->m_data); notify(); } return true; } return false; } return false; }
//------------------------------------------------------------------------------ void ofxIpVideoServerRoute::pushFrame(ofImage& img) { pushFrame(img.getPixelsRef()); }
/** * @fn void Player::createAnimation() * * @brief Creates the animations. * */ void Player::createAnimation() { m_animation = std::shared_ptr<Animation>(new Animation(100, false, false, 0.05f)); //On charge l'image et on découpe toutes les animations dedans sf::Image m_image; m_image = MediaManager<sf::Image>::getInstance().getMedia("../JIN4/media/player.png"); int imgSize{ 90 };//Taille de chaque image en pixel //quand on avance auto idleAnim = std::make_shared<Anim>("idle"); idleAnim->pushFrame(Frame(m_image, sf::Rect<int>(0, 0, imgSize, imgSize))); //Quand on saute auto jumpAnim = std::make_shared<Anim>("jump"); jumpAnim->pushFrame(Frame(m_image, sf::Rect<int>(imgSize, 0, imgSize, imgSize))); jumpAnim->pushFrame(Frame(m_image, sf::Rect<int>(imgSize, imgSize, imgSize, imgSize))); //Quand on ralenti, en haut du saut auto onTop = std::make_shared<Anim>("onTop"); onTop->pushFrame(Frame(m_image, sf::Rect<int>(imgSize, 0, imgSize, imgSize))); onTop->pushFrame(Frame(m_image, sf::Rect<int>(0, 0, imgSize, imgSize))); //Quand on arrive en bas auto onBottom = std::make_shared<Anim>("onBottom"); onBottom->pushFrame(Frame(m_image, sf::Rect<int>(imgSize, 0, imgSize, imgSize))); onBottom->pushFrame(Frame(m_image, sf::Rect<int>(0, 0, imgSize, imgSize))); onBottom->pushFrame(Frame(m_image, sf::Rect<int>(2 * imgSize, 0, imgSize, imgSize))); onBottom->pushFrame(Frame(m_image, sf::Rect<int>(0, 0, imgSize, imgSize))); m_image = MediaManager<sf::Image>::getInstance().getMedia("../JIN4/media/PlayerCrouch.png"); //Quand on se baisse auto crouchAnim = std::make_shared<Anim>("crouch"); crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(0, 0, imgSize, imgSize))); //crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(imgSize, 0, imgSize, imgSize))); crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(imgSize, 0, imgSize, imgSize))); crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(2 * imgSize, 0, imgSize, imgSize))); //crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(0, imgSize, imgSize, imgSize))); crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(0, imgSize, imgSize, imgSize))); crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(imgSize, imgSize, imgSize, imgSize))); //crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(2 * imgSize, imgSize, imgSize, imgSize))); crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(2 * imgSize, imgSize, imgSize, imgSize))); crouchAnim->pushFrame(Frame(m_image, sf::Rect<int>(0, 0, imgSize, imgSize))); //On les rajoute à l'animation m_animation->addAnim("onBottom", onBottom); m_animation->addAnim("onTop", onTop); m_animation->addAnim("jump", jumpAnim); m_animation->addAnim("crouch", crouchAnim); m_animation->addAnim("idle", idleAnim); m_animation->setAnim("idle", true); AnimationManager::getInstance().addAnimation(m_animation); m_animation->setPosition(sf::Vector2f(m_box.left, m_box.top)); }
void Animation::addTileFrame(Image *pImage, const Rect &tileRect, const Vec &m_alignPoint) { AnimationFrame *pFrame = new AnimationFrame(pImage, tileRect, m_alignPoint); pushFrame(pFrame); }