bool FBUpdateLowRes::preRotateExtDisplay(hwc_context_t *ctx, hwc_layer_1_t *layer, ovutils::Whf &info, hwc_rect_t& sourceCrop, ovutils::eMdpFlags& mdpFlags, int& rotFlags) { int extOrient = getExtOrientation(ctx); ovutils::eTransform orient = static_cast<ovutils::eTransform >(extOrient); if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) { mRot = ctx->mRotMgr->getNext(); if(mRot == NULL) return false; Whf origWhf(mAlignedFBWidth, mAlignedFBHeight, getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888)); //Configure rotator for pre-rotation if(configRotator(mRot, info, origWhf, mdpFlags, orient, 0) < 0) { ALOGE("%s: configRotator Failed!", __FUNCTION__); mRot = NULL; return false; } ctx->mLayerRotMap[mDpy]->add(layer, mRot); info.format = (mRot)->getDstFormat(); updateSource(orient, info, sourceCrop); rotFlags |= ovutils::ROT_PREROTATED; } return true; }
bool FBUpdateNonSplit::preRotateExtDisplay(hwc_context_t *ctx, hwc_layer_1_t *layer, ovutils::Whf &info, hwc_rect_t& sourceCrop, ovutils::eMdpFlags& mdpFlags, int& rotFlags) { int extOrient = getExtOrientation(ctx); ovutils::eTransform orient = static_cast<ovutils::eTransform >(extOrient); if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) { mRot = ctx->mRotMgr->getNext(); if(mRot == NULL) return false; ctx->mLayerRotMap[mDpy]->add(layer, mRot); // Composed FB content will have black bars, if the viewFrame of the // external is different from {0, 0, fbWidth, fbHeight}, so intersect // viewFrame with sourceCrop to avoid those black bars sourceCrop = getIntersection(sourceCrop, ctx->mViewFrame[mDpy]); //Configure rotator for pre-rotation if(configRotator(mRot, info, sourceCrop, mdpFlags, orient, 0) < 0) { ALOGE("%s: configRotator Failed!", __FUNCTION__); mRot = NULL; return false; } info.format = (mRot)->getDstFormat(); updateSource(orient, info, sourceCrop); rotFlags |= ovutils::ROT_PREROTATED; } return true; }
void SoundEmitter::initSound(RealWorldViewPoint* viewpoint) { InformationMessage("Sound", "SoundEmitter::initSound entering") ; m_viewpoint = viewpoint ; updateSource() ; InformationMessage("Sound", "SoundEmitter::initSound leaving") ; }
ScriptWidget::ScriptWidget(MazeScene *scene, Entity *entity) : m_scene(scene) , m_entity(entity) { new QVBoxLayout(this); m_statusView = new QLineEdit; m_statusView->setReadOnly(true); layout()->addWidget(m_statusView); m_sourceEdit = new QPlainTextEdit; layout()->addWidget(m_sourceEdit); QPushButton *compileButton = new QPushButton(QLatin1String("Compile")); layout()->addWidget(compileButton); QComboBox *combo = new QComboBox; layout()->addWidget(combo); combo->addItem(QLatin1String("Default")); combo->addItem(QLatin1String("Patrol")); combo->addItem(QLatin1String("Follow")); setPreset(0); connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(setPreset(int))); connect(compileButton, SIGNAL(clicked()), this, SLOT(updateSource())); m_engine = new QScriptEngine(this); QScriptValue entityObject = m_engine->newQObject(m_entity); m_engine->globalObject().setProperty("entity", entityObject); QScriptValue widgetObject = m_engine->newQObject(this); m_engine->globalObject().setProperty("script", widgetObject); m_engine->globalObject().setProperty("rand", m_engine->newFunction(qsRand)); m_engine->setProcessEventsInterval(5); resize(300, 400); updateSource(); startTimer(50); m_time.start(); }
// sets body as source for head if necessary. // PRE: value(body) != value_false // POST: source(head) != 0 void DefaultUnfoundedCheck::setSource(const AtomNodeP& head, const BodyNodeP& body) { assert(!solver_->isFalse(body.node->lit)); // For normal rules from not false B follows not false head, but // for choice rules this is not the case. Therefore, the // check for isFalse(head) is needed so that we do not inadvertantly // source a head that is currently false. if (!atoms_[head.id].hasSource() && !solver_->isFalse(head.node->lit)) { updateSource(atoms_[head.id], body); sourceQ_.push_back(head.id); } }
Status Config::update(const std::map<std::string, std::string>& config) { // A config plugin may call update from an extension. This will update // the config instance within the extension process and the update must be // reflected in the core. if (Registry::external()) { for (const auto& source : config) { PluginRequest request = { {"action", "update"}, {"source", source.first}, {"data", source.second}, }; // A "update" registry item within core should call the core's update // method. The config plugin call action handling must also know to // update. Registry::call("config", "update", request); } } // Iterate though each source and overwrite config data. // This will add/overwrite pack data, append to the schedule, change watched // files, set options, etc. // Before this occurs, take an opportunity to purge stale state. purge(); for (const auto& source : config) { auto status = updateSource(source.first, source.second); if (!status.ok()) { return status; } } if (loaded_) { // The config has since been loaded. // This update call is most likely a response to an async update request // from a config plugin. This request should request all plugins to update. for (const auto& registry : Registry::all()) { if (registry.first == "event_publisher" || registry.first == "event_subscriber") { continue; } registry.second->configure(); } // If events are enabled configure the subscribers before publishers. if (!FLAGS_disable_events) { Registry::registry("event_subscriber")->configure(); Registry::registry("event_publisher")->configure(); } } return Status(0, "OK"); }
void Session::assignSource(DataSource* source) { // connects signals from the source to the objects that consume packets m_dataSource = source; if (m_dataSource != NULL) { EnumerateDataSourceRegistration(&Session::ConnectNetworkSignalsCallback, this); connect(m_timer, SIGNAL(timeout()), this, SLOT(updateSource())); m_timer->start(m_delay); m_dataSource->start(); } }
bool MdpCtrl::setInfo(RotatorBase* r, const utils::PipeArgs& args, const utils::ScreenInfo& info) { // new request utils::Whf whf(args.whf); mOVInfo.id = MSMFB_NEW_REQUEST; updateSource(r, args, info); setUserData(0); mOVInfo.alpha = 0xff; mOVInfo.transp_mask = 0xffffffff; setZ(args.zorder); setFlags(args.mdpFlags); setWait(args.wait); setIsFg(args.isFg); mSize = whf.size; return true; }
void Shader::setSource(AbstractStringSource * source) { if (source == m_source) { return; } if (m_source) { m_source->deregisterListener(this); } m_source = source; if (m_source) { m_source->registerListener(this); } updateSource(); }
int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer, const int& dpy, eMdpFlags& mdpFlags, const eZorder& z, const eIsFg& isFg, const eDest& dest, Rotator **rot) { private_handle_t *hnd = (private_handle_t *)layer->handle; if(!hnd) { ALOGE("%s: layer handle is NULL", __FUNCTION__); return -1; } MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; hwc_rect_t crop = layer->sourceCrop; hwc_rect_t dst = layer->displayFrame; int transform = layer->transform; eTransform orient = static_cast<eTransform>(transform); int downscale = 0; int rotFlags = ovutils::ROT_FLAGS_NONE; Whf whf(getWidth(hnd), getHeight(hnd), getMdpFormat(hnd->format), hnd->size); bool forceRot = false; if(isYuvBuffer(hnd) && ctx->mMDP.version >= qdutils::MDP_V4_2 && ctx->mMDP.version < qdutils::MDSS_V5) { downscale = getDownscaleFactor( crop.right - crop.left, crop.bottom - crop.top, dst.right - dst.left, dst.bottom - dst.top); if(downscale) { rotFlags = ROT_DOWNSCALE_ENABLED; } unsigned int& prevWidth = ctx->mPrevWHF[dpy].w; unsigned int& prevHeight = ctx->mPrevWHF[dpy].h; if(prevWidth != (uint32_t)getWidth(hnd) || prevHeight != (uint32_t)getHeight(hnd)) { uint32_t prevBufArea = (prevWidth * prevHeight); if(prevBufArea) { forceRot = true; } prevWidth = (uint32_t)getWidth(hnd); prevHeight = (uint32_t)getHeight(hnd); } } setMdpFlags(layer, mdpFlags, downscale); trimLayer(ctx, dpy, transform, crop, dst); if(isYuvBuffer(hnd) && //if 90 component or downscale, use rot ((transform & HWC_TRANSFORM_ROT_90) || downscale || forceRot)) { *rot = ctx->mRotMgr->getNext(); if(*rot == NULL) return -1; //Configure rotator for pre-rotation Whf origWhf(hnd->width, hnd->height, getMdpFormat(hnd->format), hnd->size); if(configRotator(*rot, whf, origWhf, mdpFlags, orient, downscale) < 0) return -1; ctx->mLayerRotMap[dpy]->add(layer, *rot); whf.format = (*rot)->getDstFormat(); updateSource(orient, whf, crop); rotFlags |= ovutils::ROT_PREROTATED; } //For the mdp, since either we are pre-rotating or MDP does flips orient = OVERLAY_TRANSFORM_0; transform = 0; PipeArgs parg(mdpFlags, whf, z, isFg, static_cast<eRotFlags>(rotFlags), layer->planeAlpha, (ovutils::eBlending) getBlending(layer->blending)); if(configMdp(ctx->mOverlay, parg, orient, crop, dst, metadata, dest) < 0) { ALOGE("%s: commit failed for low res panel", __FUNCTION__); ctx->mLayerRotMap[dpy]->reset(); return -1; } return 0; }
int configureHighRes(hwc_context_t *ctx, hwc_layer_1_t *layer, const int& dpy, eMdpFlags& mdpFlagsL, const eZorder& z, const eIsFg& isFg, const eDest& lDest, const eDest& rDest, Rotator **rot) { private_handle_t *hnd = (private_handle_t *)layer->handle; if(!hnd) { ALOGE("%s: layer handle is NULL", __FUNCTION__); return -1; } MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; int hw_w = ctx->dpyAttr[dpy].xres; int hw_h = ctx->dpyAttr[dpy].yres; hwc_rect_t crop = layer->sourceCrop; hwc_rect_t dst = layer->displayFrame; int transform = layer->transform; eTransform orient = static_cast<eTransform>(transform); const int downscale = 0; int rotFlags = ROT_FLAGS_NONE; Whf whf(getWidth(hnd), getHeight(hnd), getMdpFormat(hnd->format), hnd->size); setMdpFlags(layer, mdpFlagsL); trimLayer(ctx, dpy, transform, crop, dst); if(isYuvBuffer(hnd) && (transform & HWC_TRANSFORM_ROT_90)) { (*rot) = ctx->mRotMgr->getNext(); if((*rot) == NULL) return -1; //Configure rotator for pre-rotation Whf origWhf(hnd->width, hnd->height, getMdpFormat(hnd->format), hnd->size); if(configRotator(*rot, whf, origWhf, mdpFlagsL, orient, downscale) < 0) return -1; ctx->mLayerRotMap[dpy]->add(layer, *rot); whf.format = (*rot)->getDstFormat(); updateSource(orient, whf, crop); rotFlags |= ROT_PREROTATED; } eMdpFlags mdpFlagsR = mdpFlagsL; setMdpFlags(mdpFlagsR, OV_MDSS_MDP_RIGHT_MIXER); hwc_rect_t tmp_cropL, tmp_dstL; hwc_rect_t tmp_cropR, tmp_dstR; if(lDest != OV_INVALID) { tmp_cropL = crop; tmp_dstL = dst; hwc_rect_t scissor = {0, 0, hw_w/2, hw_h }; qhwc::calculate_crop_rects(tmp_cropL, tmp_dstL, scissor, 0); } if(rDest != OV_INVALID) { tmp_cropR = crop; tmp_dstR = dst; hwc_rect_t scissor = {hw_w/2, 0, hw_w, hw_h }; qhwc::calculate_crop_rects(tmp_cropR, tmp_dstR, scissor, 0); } //When buffer is flipped, contents of mixer config also needs to swapped. //Not needed if the layer is confined to one half of the screen. //If rotator has been used then it has also done the flips, so ignore them. if((orient & OVERLAY_TRANSFORM_FLIP_V) && lDest != OV_INVALID && rDest != OV_INVALID && rot == NULL) { hwc_rect_t new_cropR; new_cropR.left = tmp_cropL.left; new_cropR.right = new_cropR.left + (tmp_cropR.right - tmp_cropR.left); hwc_rect_t new_cropL; new_cropL.left = new_cropR.right; new_cropL.right = tmp_cropR.right; tmp_cropL.left = new_cropL.left; tmp_cropL.right = new_cropL.right; tmp_cropR.left = new_cropR.left; tmp_cropR.right = new_cropR.right; } //For the mdp, since either we are pre-rotating or MDP does flips orient = OVERLAY_TRANSFORM_0; transform = 0; //configure left mixer if(lDest != OV_INVALID) { PipeArgs pargL(mdpFlagsL, whf, z, isFg, static_cast<eRotFlags>(rotFlags), layer->planeAlpha, (ovutils::eBlending) getBlending(layer->blending)); if(configMdp(ctx->mOverlay, pargL, orient, tmp_cropL, tmp_dstL, metadata, lDest) < 0) { ALOGE("%s: commit failed for left mixer config", __FUNCTION__); return -1; } } //configure right mixer if(rDest != OV_INVALID) { PipeArgs pargR(mdpFlagsR, whf, z, isFg, static_cast<eRotFlags>(rotFlags), layer->planeAlpha, (ovutils::eBlending) getBlending(layer->blending)); tmp_dstR.right = tmp_dstR.right - tmp_dstR.left; tmp_dstR.left = 0; if(configMdp(ctx->mOverlay, pargR, orient, tmp_cropR, tmp_dstR, metadata, rDest) < 0) { ALOGE("%s: commit failed for right mixer config", __FUNCTION__); return -1; } } return 0; }
void Shader::notifyChanged(const AbstractStringSource *) { updateSource(); }
// Configure bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, int fbZorder) { bool ret = false; hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; if (LIKELY(ctx->mOverlay)) { int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex; // ext only layer present.. if(extOnlyLayerIndex != -1) { layer = &list->hwLayers[extOnlyLayerIndex]; layer->compositionType = HWC_OVERLAY; } overlay::Overlay& ov = *(ctx->mOverlay); private_handle_t *hnd = (private_handle_t *)layer->handle; ovutils::Whf info(getWidth(hnd), getHeight(hnd), ovutils::getMdpFormat(hnd->format), hnd->size); //Request an RGB pipe ovutils::eDest dest = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy); if(dest == ovutils::OV_INVALID) { //None available ALOGE("%s: No pipes available to configure framebuffer", __FUNCTION__); return false; } mDest = dest; ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; ovutils::eIsFg isFg = ovutils::IS_FG_OFF; ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); hwc_rect_t sourceCrop = layer->sourceCrop; hwc_rect_t displayFrame = layer->displayFrame; int transform = layer->transform; int fbWidth = ctx->dpyAttr[mDpy].xres; int fbHeight = ctx->dpyAttr[mDpy].yres; int rotFlags = ovutils::ROT_FLAGS_NONE; ovutils::eTransform orient = static_cast<ovutils::eTransform>(transform); if(mDpy && ctx->mExtOrientation) { // If there is a external orientation set, use that transform = ctx->mExtOrientation; orient = static_cast<ovutils::eTransform >(ctx->mExtOrientation); } // Dont do wormhole calculation when extorientation is set on External if((!mDpy || (mDpy && !ctx->mExtOrientation)) && extOnlyLayerIndex == -1) { getNonWormholeRegion(list, sourceCrop); displayFrame = sourceCrop; } ovutils::Dim dpos(displayFrame.left, displayFrame.top, displayFrame.right - displayFrame.left, displayFrame.bottom - displayFrame.top); if(mDpy) { // Get Aspect Ratio for external getAspectRatioPosition(ctx, mDpy, ctx->mExtOrientation, dpos.x, dpos.y, dpos.w, dpos.h); // Calculate the actionsafe dimensions for External(dpy = 1 or 2) getActionSafePosition(ctx, mDpy, dpos.x, dpos.y, dpos.w, dpos.h); // Convert dim to hwc_rect_t displayFrame.left = dpos.x; displayFrame.top = dpos.y; displayFrame.right = dpos.w + displayFrame.left; displayFrame.bottom = dpos.h + displayFrame.top; } setMdpFlags(layer, mdpFlags, 0); // For External use rotator if there is a rotation value set if(mDpy && (ctx->mExtOrientation & HWC_TRANSFORM_ROT_90)) { mRot = ctx->mRotMgr->getNext(); if(mRot == NULL) return -1; //Configure rotator for pre-rotation if(configRotator(mRot, info, mdpFlags, orient, 0) < 0) { ALOGE("%s: configRotator Failed!", __FUNCTION__); mRot = NULL; return -1; } info.format = (mRot)->getDstFormat(); updateSource(orient, info, sourceCrop); rotFlags |= ovutils::ROT_PREROTATED; } //For the mdp, since either we are pre-rotating or MDP does flips orient = ovutils::OVERLAY_TRANSFORM_0; transform = 0; //XXX: FB layer plane alpha is currently sent as zero from //surfaceflinger ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg, static_cast<ovutils::eRotFlags>(rotFlags), ovutils::DEFAULT_PLANE_ALPHA, (ovutils::eBlending) getBlending(layer->blending)); ret = true; if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame, NULL, mDest) < 0) { ALOGE("%s: ConfigMdp failed for low res", __FUNCTION__); ret = false; } } return ret; }
MainWindow::MainWindow(QAction* actionQuit, QAction* actionNewTab, QAction* actionFullscreen, QAction* actionLoadSession, QAction* actionSaveSession, QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow), fetcher(new Fetcher), local(new LocalFetcher), source(IMAGE_SOURCE_UNKNOWN) { ui->setupUi(this); QStringList sources; sources.append("Google"); sources.append("Local file"); // sources.append("Picsearch"); ui->cbSource->addItems(sources); ui->cbSource->setCurrentIndex(IMAGE_SOURCE_GOOGLE); fetcher->hide(); local->hide(); ui->menuFile->addAction(actionNewTab); ui->menuFile->addAction(actionLoadSession); ui->menuFile->addAction(actionSaveSession); ui->menuFile->addAction(actionQuit); ui->menuView->insertAction(ui->actionResetTransforms,actionFullscreen); ui->tbFullScreen->setDefaultAction(actionFullscreen); ui->tbNewTab->setDefaultAction(actionNewTab); ui->tbResetTransform->setDefaultAction(ui->actionResetTransforms); ui->tbSave->setDefaultAction(actionSaveSession); ui->glTools->addWidget(fetcher,0,6,2,1); ui->glTools->addWidget(local,0,6,2,1); updateSource(); connect(ui->cbSource,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSource())); ui->actionViewOnlyMode->setShortcut(Qt::Key_Tab); QList<QKeySequence> keys; keys << Qt::Key_Delete << Qt::Key_Backspace; ui->actionDeleteSelected->setShortcuts(keys); // These are necessary if the actions are to remain accessible when the menubar is hidden: this->addAction(ui->actionViewOnlyMode); this->addAction(ui->actionResetTransforms); this->addAction(ui->actionZoomToFit); this->addAction(ui->actionIntroduction); this->addAction(ui->actionTips); this->addAction(ui->actionOpenDirectory); this->addAction(ui->actionOpenFile); this->addAction(ui->actionDeleteSelected); this->addAction(ui->actionUncropSelected); this->addAction(ui->actionCentreInView); this->addAction(ui->actionResetRotation); this->addAction(ui->actionResetScale); this->addAction(ui->actionScaleToFit); this->addAction(actionFullscreen); this->addAction(actionLoadSession); this->addAction(actionSaveSession); this->addAction(actionNewTab); this->addAction(actionQuit); connect(ui->actionIntroduction,SIGNAL(triggered()),this,SLOT(showHelp())); connect(ui->actionTips,SIGNAL(triggered()),this,SLOT(showTips())); connect(ui->actionViewOnlyMode,SIGNAL(triggered(bool)),this,SLOT(enterViewOnlyMode(bool))); connect(ui->actionPreferences,SIGNAL(triggered()),this,SLOT(showPreferences())); connect(fetcher,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString))); connect(fetcher,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool))); connect(local,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool))); connect(local,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString))); initBlacklistDocker(); initInfoDocker(); initView(parent); dlDir = QString(DEFAULT_DOWNLOAD_DIRECTORY); dlMgr = new QNetworkAccessManager(this); connect(ui->actionResetTransforms,SIGNAL(triggered()),gvMain,SLOT(resetTransforms())); connect(ui->actionZoomToFit,SIGNAL(triggered()),gvMain,SLOT(zoomToFit())); connect(ui->actionOpenDirectory,SIGNAL(triggered()),local,SLOT(selectDirectory())); connect(ui->actionOpenFile,SIGNAL(triggered()),local,SLOT(selectFile())); connect(ui->actionDeleteSelected,SIGNAL(triggered()),gsMain,SLOT(deleteSelected())); connect(ui->actionUncropSelected,SIGNAL(triggered()),gsMain,SLOT(uncropSelected())); connect(ui->actionCentreInView,SIGNAL(triggered()),gsMain,SLOT(centreSelection())); connect(ui->actionResetRotation,SIGNAL(triggered()),gsMain,SLOT(resetSelectionRotation())); connect(ui->actionResetScale,SIGNAL(triggered()),gsMain,SLOT(resetSelectionScale())); connect(ui->actionScaleToFit,SIGNAL(triggered()),this,SLOT(scaleSelectedToFit())); ui->verticalLayout->removeWidget(ui->toolWidget); ui->toolBar->addWidget(ui->toolWidget); setCentralWidget(gvMain); ui->thumbBar->addWidget(gvCarousel); ui->statusBar->addWidget(fetcher->getStatusText(),0); ui->statusBar->addWidget(fetcher->getProgressBar(),1); connect(this,SIGNAL(settingsChanged()),this,SLOT(loadSettings())); loadSettings(); }