AsCommonCarShadow::AsCommonCarShadow(NeverhoodEngine *vm, AnimatedSprite *asCar, BaseSurface *shadowSurface, uint index) : AnimatedSprite(vm, 1100), _asCar(asCar), _index(index), _animFileHash(0) { SetUpdateHandler(&AsCommonCarShadow::update); createShadowSurface(shadowSurface, 211, 147, 100); updateShadow(); }
//每贞更新动画 void HeroBase::update(float ft) { if (m_BodyState==GameEnum::BodyState::Die) { return ; } //AI更新 heroAI->update(ft); //更新位置 updatePosition(ft); //更新阴影 updateShadow(ft); //技能时间更新 for (int i=0; i< 4; i++) { if(skills[i].CurrCDTime > 0) { skills[i].CurrCDTime-=ft; } if(skills[i].CurrCDTime < 0) { skills[i].CurrCDTime=0.0; } } }
void GLImageDrawable::shadowDirty() { // if(m_shadowDirtyBatchTimer.isActive()) // m_shadowDirtyBatchTimer.stop(); // // m_shadowDirtyBatchTimer.start(); updateShadow(); }
void Shadows::Private::updateShadows() { setupPixmaps(); QHash<const QWidget *, Plasma::FrameSvg::EnabledBorders>::const_iterator i; for (i = m_windows.constBegin(); i != m_windows.constEnd(); ++i) { updateShadow(i.key(), i.value()); } }
void MyTextItem::updateShadow(bool enabled, int blur, int xoffset, int yoffset, QColor color) { m_shadowOffset = QPoint(xoffset, yoffset); m_shadowBlur = blur; m_shadowColor = color; m_useShadow = enabled; updateShadow(); update(); }
void CWindowObject::setBackground(std::string filename) { OBJ_CONSTRUCTION_CAPTURING_ALL; delete background; background = createBg(filename, options & PLAYER_COLORED); if (background) pos = background->center(Point(pos.w/2 + pos.x, pos.h/2 + pos.y)); updateShadow(); }
void KMMailComponentContactArea::onActionRangeChange(int min, int max) { //Update the range first. m_scrollBar->setRange(min, max); //Update shadow opacity. updateShadow(min); //Update the scroll bar and shadow visible. bool scrollComponentValid=(min!=max); //Set visiblility components. m_scrollBar->setVisible(scrollComponentValid); m_topShadow->setVisible(scrollComponentValid); m_bottomShadow->setVisible(scrollComponentValid); }
void ShadowUpdateTask::executeTaskInBackgroundThread(Tasks::TaskExecutionContext& context) { for (auto& pageGeometry : mPageGeometries) { auto& page = pageGeometry->getPage(); if (page.getSurface()) { auto shadow = page.getSurface()->getShadow(); if (shadow) { auto& shadowTextureName = shadow->getShadowTextureName(); if (!shadowTextureName.empty()) { pageGeometry->repopulate(true); shadow->setLightDirection(mLightDirection); shadow->updateShadow(*pageGeometry.get()); } } } } }
void KWD::Decorator::changeShadowOptions (decor_shadow_options_t *aopt, decor_shadow_options_t *iopt) { bool changed = false; if (memcmp (aopt, &mActiveShadowOptions, sizeof (decor_shadow_options_t))) { mActiveShadowOptions = *aopt; changed = true; } if (memcmp (aopt, &mInactiveShadowOptions, sizeof (decor_shadow_options_t))) { mInactiveShadowOptions = *iopt; changed = true; } if (changed) updateShadow (); }
GLImageDrawable::GLImageDrawable(QString file, QObject *parent) : GLVideoDrawable(parent) , m_releasedImage(false) , m_allowAutoRotate(true) // Border attributes , m_borderColor(Qt::black) , m_borderWidth(0.0) // start off disabled // Shadow attributes , m_shadowEnabled(false) , m_shadowBlurRadius(16.0) , m_shadowOffset(3.0,3.0) , m_shadowColor(Qt::black) , m_shadowOpacity(1.0) , m_shadowDrawable(0) , m_hqXfadeEnabled(false) , m_hqXfadeActive(false) , m_fadeValue(0.) , m_fadeTimeStarted(false) { //setImage(QImage("dot.gif")); setCrossFadeMode(GLVideoDrawable::FrontAndBack); if(!file.isEmpty()) setImageFile(file); connect(&m_shadowDirtyBatchTimer, SIGNAL(timeout()), this, SLOT(updateShadow())); m_shadowDirtyBatchTimer.setSingleShot(true); m_shadowDirtyBatchTimer.setInterval(50); connect(&m_borderDirtyBatchTimer, SIGNAL(timeout()), this, SLOT(reapplyBorder())); m_borderDirtyBatchTimer.setSingleShot(true); m_borderDirtyBatchTimer.setInterval(50); connect(&m_fadeTick, SIGNAL(timeout()), this, SLOT(hqXfadeTick())); m_fadeTick.setInterval(1000/25); // TODO just for testing - future it should only be for overlays setHqXfadeEnabled(false); //setCrossFadeMode(GLVideoDrawable::JustFront); }
void MyTextItem::updateGeometry(int, int, int) { updateGeometry(); // update gradient if necessary QString gradientData = data(TitleDocument::Gradient).toString(); if (!gradientData.isEmpty()) { QTextCursor cursor = textCursor(); QTextCharFormat cformat; QRectF rect = boundingRect(); int position = textCursor().position(); QLinearGradient gr = GradientWidget::gradientFromString(gradientData, rect.width(), rect.height()); cursor.select(QTextCursor::Document); cformat.setForeground(QBrush(gr)); cursor.mergeCharFormat(cformat); cursor.clearSelection(); cursor.setPosition(position); // restore cursor position setTextCursor(cursor); } if (m_useShadow) { updateShadow(); } }
void KWD::Decorator::reconfigure (void) { unsigned long changed; mConfig->reparseConfiguration (); changed = mOptions->updateSettings (); if (mPlugins->reset (changed)) { QMap < WId, KWD::Window * >::ConstIterator it; updateShadow (); mDecorNormal->reloadDecoration (); mDecorActive->reloadDecoration (); for (it = mClients.constBegin (); it != mClients.constEnd (); it++) it.value ()->reloadDecoration (); mPlugins->destroyPreviousPlugin (); } }
void AsCommonCarShadow::update() { updateShadow(); AnimatedSprite::update(); }
void MyTextItem::loadShadow(QStringList info) { if (info.count() < 5) return; updateShadow((info.at(0).toInt() == true), info.at(2).toInt(), info.at(3).toInt(),info.at(4).toInt(), QColor(info.at(1))); }
bool KWD::Decorator::enableDecorations (Time timestamp) { QList <WId>::ConstIterator it; unsigned int nchildren; WId *children; WId root, parent; long int select; mDmSnTimestamp = timestamp; if (!pluginManager ()->loadPlugin ("")) return false; updateAllShadowOptions (); KWD::trapXError (); (void) QApplication::desktop (); // trigger creation of desktop widget KWD::popXError (); updateShadow (); /* FIXME: Implement proper decoration lists and remove this */ mDecorNormal = new KWD::Window (mCompositeWindow, QX11Info::appRootWindow (), 0, Window::Default); mDecorActive = new KWD::Window (mCompositeWindow, QX11Info::appRootWindow (), 0, Window::DefaultActive); mActiveId = KWindowSystem::activeWindow (); connect (KWindowSystem::self (), SIGNAL (windowAdded (WId)), SLOT (handleWindowAdded (WId))); connect (KWindowSystem::self (), SIGNAL (windowRemoved (WId)), SLOT (handleWindowRemoved (WId))); connect (KWindowSystem::self (), SIGNAL (activeWindowChanged (WId)), SLOT (handleActiveWindowChanged (WId))); connect (KWindowSystem::self (), SIGNAL (windowChanged (WId, const unsigned long *)), SLOT (handleWindowChanged (WId, const unsigned long *))); foreach (WId id, KWindowSystem::windows ()) handleWindowAdded (id); /* Find the switcher and add it too * FIXME: Doing XQueryTree and then * XGetWindowProperty on every window * like this is really expensive, surely * there is a better way to do this */ XQueryTree (QX11Info::display (), QX11Info::appRootWindow (), &root, &parent, &children, &nchildren); for (unsigned int i = 0; i < nchildren; i++) { if (KWD::readWindowProperty (children[i], Atoms::switchSelectWindow, &select)) { handleWindowAdded(children[i]); break; } } connect (Plasma::Theme::defaultTheme (), SIGNAL (themeChanged ()), SLOT (plasmaThemeChanged ())); // select for client messages XSelectInput (QX11Info::display (), QX11Info::appRootWindow (), SubstructureNotifyMask | StructureNotifyMask | PropertyChangeMask); return true; }
KMMailComponentContactArea::KMMailComponentContactArea(QWidget *parent) : QScrollArea(parent), m_mouseAnime(new QTimeLine(200, this)), m_scrollBar(new QScrollBar(this)), m_contactList(nullptr), m_topShadow(new KNSideShadowWidget(KNSideShadowWidget::TopShadow, this)), m_bottomShadow(new KNSideShadowWidget(KNSideShadowWidget::BottomShadow, this)) { //Set properties. setFrameStyle(QFrame::NoFrame); //Configure the scroll bar policies. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //Initial the scroll bar. //Configure the scroll bar. m_scrollBar->hide(); m_scrollBar->setStyle(KNSaoStyle::instance()); m_scrollBar->setSingleStep(27); m_scrollBar->setPageStep(27); m_scrollBar->setObjectName("MailComponentScrollBar"); connect(knTheme, &KNThemeManager::themeChange, [=] { //Get the new palette from theme manager, and set it. m_scrollBar->setPalette(knTheme->getPalette( m_scrollBar->objectName())); //Update the palette. onActionMouseInOut(0); }); //Update the validation. m_scrollBar->setPalette(knTheme->getPalette(m_scrollBar->objectName())); onActionMouseInOut(0); //Configure the shadow widget. m_topShadow->hide(); m_bottomShadow->hide(); //Update the single step. verticalScrollBar()->setSingleStep(27); connect(verticalScrollBar(), &QScrollBar::rangeChanged, this, &KMMailComponentContactArea::onActionRangeChange); connect(verticalScrollBar(), &QScrollBar::valueChanged, [=](int value) { //Block the signal. m_scrollBar->blockSignals(true); //Reset the value. m_scrollBar->setValue(value); //Release the block m_scrollBar->blockSignals(false); //Update shadow opacity. updateShadow(value); }); connect(m_scrollBar, &QScrollBar::valueChanged, verticalScrollBar(), &QScrollBar::setValue); //Configure the time line. m_mouseAnime->setEasingCurve(QEasingCurve::OutCubic); m_mouseAnime->setUpdateInterval(10); //Link the time line. connect(m_mouseAnime, &QTimeLine::frameChanged, this, &KMMailComponentContactArea::onActionMouseInOut); }
void GLImageDrawable::setImage(const QImage& image, bool insidePaint) { //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" mark1: insidePaint:"<<insidePaint; if(m_allocatedMemory > IMAGE_ALLOCATION_CAP_MB*1024*1024 && !liveStatus() && canReleaseImage()) { m_releasedImage = true; //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" NOT LOADING"; #ifdef DEBUG_MEMORY_USAGE qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" Allocated memory ("<<(m_allocatedMemory/1024/1024)<<"MB ) exceedes" << IMAGE_ALLOCATION_CAP_MB << "MB cap - delaying load until go-live"; #endif return; } m_releasedImage = false; //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" mark2"; //image.save("whitedebug.png"); if(m_frame && m_frame->isValid() && xfadeEnabled() && !insidePaint) { if(m_hqXfadeEnabled) { m_oldImage = m_image; hqXfadeStart(); } else { m_frame2 = m_frame; //sqDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" Starting crossfade with m_frame2"; //m_frame2 = VideoFramePtr(new VideoFrame(m_image,1000/30)); updateTexture(true); // true = read from m_frame2 xfadeStart(); } } // Take the memory off the list because when crossfade is done, the frame should get freed if(m_frame) { m_allocatedMemory -= m_frame->pointerLength(); #ifdef DEBUG_MEMORY_USAGE qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" Allocated memory down to:"<<(m_allocatedMemory/1024/1024)<<"MB"; #endif //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" mark4"; } QImage localImage; if(m_shadowEnabled || m_borderWidth > 0.001) localImage = applyBorder(image); else localImage = image; // QImage bgImage(QSize(1000,750), QImage::Format_ARGB32_Premultiplied); // QBrush bgTexture(QPixmap("ColorTile2.png")); // QPainter bgPainter(&bgImage); // bgPainter.fillRect(bgImage.rect(), bgTexture); // bgPainter.end(); // //bgImage = bgImage.convertToFormat(QImage::Format_RGB32); // // localImage = bgImage; //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" mark5"; if(1) { //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" Setting new m_frame"; m_frame = VideoFramePtr(new VideoFrame(localImage, 1000/30)); } else { m_frame = VideoFramePtr(new VideoFrame()); //m_frame->setPixelFormat(QVideoFrame::Format_RGB32); //m_frame->setCaptureTime(QTime::currentTime()); m_frame->setBufferType(VideoFrame::BUFFER_POINTER); m_frame->setHoldTime(1000/30); m_frame->setSize(localImage.size()); //m_frame->setDebugPtr(true); QImage::Format format = localImage.format(); m_frame->setPixelFormat( format == QImage::Format_ARGB32 ? QVideoFrame::Format_ARGB32 : format == QImage::Format_RGB32 ? QVideoFrame::Format_RGB32 : format == QImage::Format_RGB888 ? QVideoFrame::Format_RGB24 : format == QImage::Format_RGB16 ? QVideoFrame::Format_RGB565 : format == QImage::Format_RGB555 ? QVideoFrame::Format_RGB555 : //format == QImage::Format_ARGB32_Premultiplied ? QVideoFrame::Format_ARGB32_Premultiplied : // GLVideoDrawable doesn't support premultiplied - so the format conversion below will convert it to ARGB32 automatically QVideoFrame::Format_Invalid); if(m_frame->pixelFormat() == QVideoFrame::Format_Invalid) { qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<": image was not in an acceptable format, converting to ARGB32 automatically."; localImage = localImage.convertToFormat(QImage::Format_ARGB32); m_frame->setPixelFormat(QVideoFrame::Format_ARGB32); } memcpy(m_frame->allocPointer(localImage.byteCount()), (const uchar*)localImage.bits(), localImage.byteCount()); } m_allocatedMemory += localImage.byteCount(); m_image = image; // explicitly release the original image to see if that helps with memory... //image = QImage(); #ifdef DEBUG_MEMORY_USAGE qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" Allocated memory up to:"<<(m_allocatedMemory/1024/1024)<<"MB"; #endif //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" mark7"; // Don't updateTexture if m_hqXfadeActive because // we'll updateTexture inside hqXfadeTick with a blended image if(!m_hqXfadeActive) updateTexture(); // QString file = QString("debug-%1-%2.png").arg(metaObject()->className()).arg(QString().sprintf("%p",((void*)this))); // m_image.save(file); // qDebug() << "QImageDrawable::setImage: "<<(QObject*)this<<": Wrote: "<<file; if(fpsLimit() <= 0.0 && !insidePaint) { //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" mark8"; updateGL(); if(!liveStatus()) m_needUpdate = true; } updateShadow(); //qDebug() << "GLImageDrawable::setImage(): "<<(QObject*)this<<" Set image size:"<<m_frame->image().size(); // TODO reimp so this code works // if(m_visiblePendingFrame) // { // //qDebug() << "GLVideoDrawable::frameReady: "<<this<<", pending visible set, calling setVisible("<<m_tempVisibleValue<<")"; // m_visiblePendingFrame = false; // GLDrawable::setVisible(m_tempVisibleValue); // } }