void FPxScene::Render( FSceneNode* Frame ) { pxguard(FPxScene::Render); if( !mDebugRen || !GRenderDevice || !GPxPhysics.mDrawPhysX ) return; FPlane linecolor; // Render points { static const NxReal ps = 4.0f; const NxDebugPoint* Points = mDebugRen->getPoints(); NxU32 NbPoints = mDebugRen->getNbPoints(); while(NbPoints--) { linecolor = ToColor(Points->color); GRenderDevice->Draw3DLine( Frame, linecolor, 0, ToFVS(Points->p)-FVector(ps,0,0), ToFVS(Points->p)+FVector(ps,0,0) ); GRenderDevice->Draw3DLine( Frame, linecolor, 0, ToFVS(Points->p)-FVector(0,ps,0), ToFVS(Points->p)+FVector(0,ps,0) ); GRenderDevice->Draw3DLine( Frame, linecolor, 0, ToFVS(Points->p)-FVector(0,0,ps), ToFVS(Points->p)+FVector(0,0,ps) ); Points++; } } // Render lines { const NxDebugLine* Lines = mDebugRen->getLines(); NxU32 NbLines = mDebugRen->getNbLines(); while(NbLines--) { linecolor = ToColor(Lines->color); GRenderDevice->Draw3DLine( Frame, linecolor, 0, ToFVS(Lines->p0), ToFVS(Lines->p1) ); Lines++; } } // Render triangles { const NxDebugTriangle* Triangles = mDebugRen->getTriangles(); NxU32 NbTris = mDebugRen->getNbTriangles(); while(NbTris--) { linecolor = ToColor(Triangles->color); GRenderDevice->Draw3DLine( Frame, linecolor, 0, ToFVS(Triangles->p0), ToFVS(Triangles->p1) ); GRenderDevice->Draw3DLine( Frame, linecolor, 0, ToFVS(Triangles->p1), ToFVS(Triangles->p2) ); GRenderDevice->Draw3DLine( Frame, linecolor, 0, ToFVS(Triangles->p2), ToFVS(Triangles->p0) ); Triangles++; } } unguard; }
static void FillSurface(DrawTarget* aDT, const nsIntRegion& aRegion, const nsIntPoint& aOffset, const gfxRGBA& aColor) { nsIntRegionRectIterator iter(aRegion); const nsIntRect* r; while ((r = iter.Next()) != nullptr) { aDT->FillRect(Rect(r->x - aOffset.x, r->y - aOffset.y, r->width, r->height), ColorPattern(ToColor(aColor))); } }
void VSpanHandler::SetBackgroundColor(const VString& inValue) { RGBAColor color; VTextStyle* TheStyle = fStyles->GetData(); if(!TheStyle) return; bool doit = ToColor(inValue, color); if(doit) { TheStyle->SetBackGroundColor(color); TheStyle->SetTransparent(false); } }
void VSpanHandler::SetColor(const VString& inValue) { RGBAColor color; VTextStyle* TheStyle = fStyles->GetData(); if(!TheStyle) return; bool doit = ToColor(inValue, color); if(doit) { TheStyle->SetColor(color); TheStyle->SetHasForeColor(true); } }
// Paints the tabs that intersect the window's update rectangle. void Paint(HDC hdc, RECT& rc) { IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); // paint the background #if 0 bool isTranslucentMode = inTitlebar && dwm::IsCompositionEnabled(); if (isTranslucentMode) { PaintParentBackground(hwnd, hdc); } else { // note: not sure what color should be used here and painting // background works fine /*HBRUSH brush = CreateSolidBrush(colors.bar); FillRect(hdc, &rc, brush); DeleteObject(brush);*/ } #else PaintParentBackground(hwnd, hdc); #endif // TODO: GDI+ doesn't seem to cope well with SetWorldTransform XFORM ctm = {1.0, 0, 0, 1.0, 0, 0}; SetWorldTransform(hdc, &ctm); Graphics gfx(hdc); gfx.SetCompositingMode(CompositingModeSourceCopy); gfx.SetCompositingQuality(CompositingQualityHighQuality); gfx.SetSmoothingMode(SmoothingModeHighQuality); gfx.SetTextRenderingHint(TextRenderingHintClearTypeGridFit); gfx.SetPageUnit(UnitPixel); GraphicsPath shapes(data->Points, data->Types, data->Count); GraphicsPath shape; GraphicsPathIterator iterator(&shapes); SolidBrush br(Color(0, 0, 0)); Pen pen(&br, 2.0f); Font f(hdc, GetDefaultGuiFont()); // TODO: adjust these constant values for DPI? RectF layout((REAL)DpiScaleX(hwnd, 3), 1.0f, REAL(width - DpiScaleX(hwnd, 20)), (REAL)height); StringFormat sf(StringFormat::GenericDefault()); sf.SetFormatFlags(StringFormatFlagsNoWrap); sf.SetLineAlignment(StringAlignmentCenter); sf.SetTrimming(StringTrimmingEllipsisCharacter); REAL yPosTab = inTitlebar ? 0.0f : REAL(ClientRect(hwnd).dy - height - 1); for (int i = 0; i < Count(); i++) { gfx.ResetTransform(); gfx.TranslateTransform(1.f + (REAL)(width + 1) * i - (REAL)rc.left, yPosTab - (REAL)rc.top); if (!gfx.IsVisible(0, 0, width + 1, height + 1)) continue; // Get the correct colors based on the state and the current theme COLORREF bgCol = GetAppColor(AppColor::TabBackgroundBg); COLORREF textCol = GetAppColor(AppColor::TabBackgroundText); COLORREF xColor = GetAppColor(AppColor::TabBackgroundCloseX); COLORREF circleColor = GetAppColor(AppColor::TabBackgroundCloseCircle); if (selectedTabIdx == i) { bgCol = GetAppColor(AppColor::TabSelectedBg); textCol = GetAppColor(AppColor::TabSelectedText); xColor = GetAppColor(AppColor::TabSelectedCloseX); circleColor = GetAppColor(AppColor::TabSelectedCloseCircle); } else if (highlighted == i) { bgCol = GetAppColor(AppColor::TabHighlightedBg); textCol = GetAppColor(AppColor::TabHighlightedText); xColor = GetAppColor(AppColor::TabHighlightedCloseX); circleColor = GetAppColor(AppColor::TabHighlightedCloseCircle); } if (xHighlighted == i) { xColor = GetAppColor(AppColor::TabHoveredCloseX); circleColor = GetAppColor(AppColor::TabHoveredCloseCircle); } if (xClicked == i) { xColor = GetAppColor(AppColor::TabClickedCloseX); circleColor = GetAppColor(AppColor::TabClickedCloseCircle); } // paint tab's body gfx.SetCompositingMode(CompositingModeSourceCopy); iterator.NextMarker(&shape); br.SetColor(ToColor(bgCol)); Point points[4]; shape.GetPathPoints(points, 4); Rect body(points[0].X, points[0].Y, points[2].X - points[0].X, points[2].Y - points[0].Y); body.Inflate(0, 0); gfx.SetClip(body); body.Inflate(5, 5); gfx.FillRectangle(&br, body); gfx.ResetClip(); // draw tab's text gfx.SetCompositingMode(CompositingModeSourceOver); br.SetColor(ToColor(textCol)); gfx.DrawString(text.at(i), -1, &f, layout, &sf, &br); // paint "x"'s circle iterator.NextMarker(&shape); bool closeCircleEnabled = true; if ((xClicked == i || xHighlighted == i) && closeCircleEnabled) { br.SetColor(ToColor(circleColor)); gfx.FillPath(&br, &shape); } // paint "x" iterator.NextMarker(&shape); pen.SetColor(ToColor(xColor)); gfx.DrawPath(&pen, &shape); iterator.Rewind(); } }
void Variant::FromString(VariantType type, const char* value) { switch (type) { case VAR_INT: *this = ToInt(value); break; case VAR_BOOL: *this = ToBool(value); break; case VAR_FLOAT: *this = ToFloat(value); break; case VAR_VECTOR2: *this = ToVector2(value); break; case VAR_VECTOR3: *this = ToVector3(value); break; case VAR_VECTOR4: *this = ToVector4(value); break; case VAR_QUATERNION: *this = ToQuaternion(value); break; case VAR_COLOR: *this = ToColor(value); break; case VAR_STRING: *this = value; break; case VAR_BUFFER: { SetType(VAR_BUFFER); PODVector<unsigned char>& buffer = *(reinterpret_cast<PODVector<unsigned char>*>(&value_)); Vector<String> values = String::Split(value, ' '); buffer.Resize(values.Size()); for (unsigned i = 0; i < values.Size(); ++i) buffer[i] = ToInt(values[i]); } break; case VAR_PTR: *this = (void*)0; break; case VAR_RESOURCEREF: { Vector<String> values = String::Split(value, ';'); if (values.Size() == 2) { SetType(VAR_RESOURCEREF); ResourceRef& ref = *(reinterpret_cast<ResourceRef*>(&value_)); ref.type_ = ShortStringHash(values[0]); ref.id_ = StringHash(values[1]); } } break; case VAR_RESOURCEREFLIST: { Vector<String> values = String::Split(value, ';'); if (values.Size() >= 1) { SetType(VAR_RESOURCEREFLIST); ResourceRefList& refList = *(reinterpret_cast<ResourceRefList*>(&value_)); refList.type_ = ShortStringHash(values[0]); refList.ids_.Resize(values.Size() - 1); for (unsigned i = 1; i < values.Size(); ++i) refList.ids_[i - 1] = StringHash(values[i]); } } break; case VAR_INTRECT: *this = ToIntRect(value); break; case VAR_INTVECTOR2: *this = ToIntVector2(value); break; default: SetType(VAR_NONE); } }
bool AwakePlayerAttack(GameBase* gb, const T& collision, const Optional<ShimiColors>& col, int value) { const bool enemyHit = AnyOf(gb->m_EM.m_enemies, [gb, &collision](const std::shared_ptr<Enemy>& e) { const bool f = collision.intersects(Circle(e->m_pos, 30)); if (f) { if (!e->m_isDead) { EffectManager::I()->effect.add<VanishingEnemy>(e->m_pos.asPoint(), 25.0, 0.5, e->m_shimiColor); SoundAsset(L"EnemyVanish").playMulti(); } e->m_isDead = true; if (e->m_itemID && !gb->m_idb.isgot(e->m_itemID.value())) { const int index = e->m_itemID.value(); const int itemVal = gb->m_idb.m_list[index].m_value; const ShimiColors itemCol = gb->m_idb.m_list[index].m_color; gb->m_mv.addShotExp(gb->m_idb.m_list[index]); EffectManager::I()->effect.add<ItemGet>(gb, e->m_pos, itemCol, itemVal); gb->m_idb.got(index); } } return f; }); const bool bossHit = AnyOf(gb->m_bosses, [gb, &collision, &col, &value](const std::shared_ptr<Boss>& b) { const HitState hit = b->damage(collision, col, value);// collision.intersects(Circle(e.m_enemy->m_pos, 30)); switch (hit) { case HitState::Damage: SoundAsset(L"BossDamage").playMulti(); break; case HitState::NoDamage: SoundAsset(L"BossNoDamage").play(); break; default: break; } return hit != HitState::Avoid; }); const bool obsHit = AnyOf(gb->m_obstacles, [&collision, &col](const std::shared_ptr<ObstacleBase>& obs) { const bool isColled = obs->m_pols.intersects(collision); const bool isCrashed = obs->shotByColor(col) && isColled; if (isCrashed && !obs->m_isDead) { SoundAsset(L"BreakObstacle").playMulti(); obs->m_isDead = true; EffectManager::I()->effect.add<Vanishing>(obs->m_pols.boundingRect.center, 100, ToColor(col.value())); } return isCrashed; }); return enemyHit || bossHit || obsHit; }
Color ToColor(const String& source) { return ToColor(source.CString()); }
Color JSONValue::GetColor(const String& name) const { return ToColor(GetCString(name)); }
Color JSONValue::GetColor(unsigned index) const { return ToColor(GetCString(index)); }
Color EditorSettings::GetMaterialSpecularColor() { Vector4 colorVect = settings->GetVector4(String("materials.specular"), ToVector4(Color::White())); return ToColor(colorVect); }
Color EditorSettings::GetMaterialDiffuseColor() { Vector4 colorVect = settings->GetVector4(String("materials.diffuse"), ToVector4(Color::White())); return ToColor(colorVect); }
Color EditorSettings::GetMaterialAmbientColor() { Vector4 colorVect = settings->GetVector4(String("materials.ambient"), ToVector4(Color::White())); return ToColor(colorVect); }
// Paints the tabs that intersect the window's update rectangle. void Paint(HDC hdc, RECT &rc) { IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); // paint the background bool isTranslucentMode = inTitlebar && dwm::IsCompositionEnabled(); if (isTranslucentMode) PaintParentBackground(hwnd, hdc); else { HBRUSH brush = CreateSolidBrush(color.bar); FillRect(hdc, &rc, brush); DeleteObject(brush); } // TODO: GDI+ doesn't seem to cope well with SetWorldTransform XFORM ctm = { 1.0, 0, 0, 1.0, 0, 0 }; SetWorldTransform(hdc, &ctm); Graphics graphics(hdc); graphics.SetCompositingMode(CompositingModeSourceCopy); graphics.SetCompositingQuality(CompositingQualityHighQuality); graphics.SetSmoothingMode(SmoothingModeHighQuality); graphics.SetTextRenderingHint(TextRenderingHintClearTypeGridFit); graphics.SetPageUnit(UnitPixel); GraphicsPath shapes(data->Points, data->Types, data->Count); GraphicsPath shape; GraphicsPathIterator iterator(&shapes); SolidBrush br(Color(0, 0, 0)); Pen pen(&br, 2.0f); Font f(hdc, GetDefaultGuiFont()); // TODO: adjust these constant values for DPI? RectF layout((REAL)DpiScaleX(hwnd,3), 1.0f, REAL(width - DpiScaleX(hwnd,20)), (REAL)height); StringFormat sf(StringFormat::GenericDefault()); sf.SetFormatFlags(StringFormatFlagsNoWrap); sf.SetLineAlignment(StringAlignmentCenter); sf.SetTrimming(StringTrimmingEllipsisCharacter); REAL yPosTab = inTitlebar ? 0.0f : REAL(ClientRect(hwnd).dy - height - 1); for (int i = 0; i < Count(); i++) { graphics.ResetTransform(); graphics.TranslateTransform(1.f + (REAL)(width + 1) * i - (REAL)rc.left, yPosTab - (REAL)rc.top); if (!graphics.IsVisible(0, 0, width + 1, height + 1)) continue; // in firefox style we only paint current and highlighed tabs // all other tabs only show bool onlyText = g_FirefoxStyle && !((current == i) || (highlighted == i)); if (onlyText) { #if 0 // we need to first paint the background with the same color as caption, // otherwise the text looks funny (because is transparent?) // TODO: what is the damn bg color of caption? bar is too light, outline is too dark Color bgColTmp; bgColTmp.SetFromCOLORREF(color.bar); { SolidBrush bgBr(bgColTmp); graphics.FillRectangle(&bgBr, layout); } bgColTmp.SetFromCOLORREF(color.outline); { SolidBrush bgBr(bgColTmp); graphics.FillRectangle(&bgBr, layout); } #endif // TODO: this is a hack. If I use no background and cleartype, the // text looks funny (is bold). // CompositingModeSourceCopy doesn't work with clear type // another option is to draw background before drawing text, but // I can't figure out what is the actual color of caption graphics.SetTextRenderingHint(TextRenderingHintAntiAliasGridFit); graphics.SetCompositingMode(CompositingModeSourceCopy); //graphics.SetCompositingMode(CompositingModeSourceOver); br.SetColor(ToColor(color.text)); graphics.DrawString(text.At(i), -1, &f, layout, &sf, &br); graphics.SetTextRenderingHint(TextRenderingHintClearTypeGridFit); continue; } COLORREF bgCol = color.background;; if (current == i) { bgCol = color.current; } else if (highlighted == i) { bgCol = color.highlight; } // ensure contrast between text and background color // TODO: adjust threshold (and try adjusting both current/background tabs) COLORREF textCol = color.text; float bgLight = GetLightness(bgCol), textLight = GetLightness(textCol); if (textLight < bgLight ? bgLight < 0x70 : bgLight > 0x90) textCol = textLight ? AdjustLightness(textCol, 255.0f / textLight - 1.0f) : RGB(255, 255, 255); if (fabs(textLight - bgLight) < 0x40) textCol = bgLight < 0x80 ? RGB(255, 255, 255) : RGB(0, 0, 0); // paint tab's body graphics.SetCompositingMode(CompositingModeSourceCopy); iterator.NextMarker(&shape); br.SetColor(ToColor(bgCol)); graphics.FillPath(&br, &shape); // draw tab's text graphics.SetCompositingMode(CompositingModeSourceOver); br.SetColor(ToColor(textCol)); graphics.DrawString(text.At(i), -1, &f, layout, &sf, &br); // paint "x"'s circle iterator.NextMarker(&shape); if (xClicked == i || xHighlighted == i) { br.SetColor(ToColor(i == xClicked ? color.x_click : color.x_highlight)); graphics.FillPath(&br, &shape); } // paint "x" iterator.NextMarker(&shape); if (xClicked == i || xHighlighted == i) pen.SetColor(ToColor(color.x_line)); else pen.SetColor(ToColor(color.outline)); graphics.DrawPath(&pen, &shape); iterator.Rewind(); } }
void TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer, const gfxRGBA* aBackgroundColor, EffectChain& aEffectChain, float aOpacity, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, nsIntRegion aVisibleRegion, gfx::Matrix4x4 aTransform) { if (!mCompositor) { NS_WARNING("Can't render tiled content host - no compositor"); return; } float resolution = aLayerBuffer.GetResolution(); gfx::Size layerScale(1, 1); // We assume that the current frame resolution is the one used in our high // precision layer buffer. Compensate for a changing frame resolution when // rendering the low precision buffer. if (aLayerBuffer.GetFrameResolution() != mTiledBuffer.GetFrameResolution()) { const CSSToParentLayerScale2D& layerResolution = aLayerBuffer.GetFrameResolution(); const CSSToParentLayerScale2D& localResolution = mTiledBuffer.GetFrameResolution(); layerScale.width = layerResolution.xScale / localResolution.xScale; layerScale.height = layerResolution.yScale / localResolution.yScale; aVisibleRegion.ScaleRoundOut(layerScale.width, layerScale.height); } // Make sure we don't render at low resolution where we have valid high // resolution content, to avoid overdraw and artifacts with semi-transparent // layers. nsIntRegion maskRegion; if (resolution != mTiledBuffer.GetResolution()) { maskRegion = mTiledBuffer.GetValidRegion(); // XXX This should be ScaleRoundIn, but there is no such function on // nsIntRegion. maskRegion.ScaleRoundOut(layerScale.width, layerScale.height); } // Make sure the resolution and difference in frame resolution are accounted // for in the layer transform. aTransform.PreScale(1/(resolution * layerScale.width), 1/(resolution * layerScale.height), 1); DiagnosticFlags componentAlphaDiagnostic = DiagnosticFlags::NO_DIAGNOSTIC; nsIntRegion compositeRegion = aLayerBuffer.GetValidRegion(); compositeRegion.AndWith(aVisibleRegion); compositeRegion.SubOut(maskRegion); IntRect visibleRect = aVisibleRegion.GetBounds(); if (compositeRegion.IsEmpty()) { return; } if (aBackgroundColor) { nsIntRegion backgroundRegion = compositeRegion; backgroundRegion.ScaleRoundOut(resolution, resolution); EffectChain effect; effect.mPrimaryEffect = new EffectSolidColor(ToColor(*aBackgroundColor)); nsIntRegionRectIterator it(backgroundRegion); for (const IntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) { Rect graphicsRect(rect->x, rect->y, rect->width, rect->height); mCompositor->DrawQuad(graphicsRect, aClipRect, effect, 1.0, aTransform); } } for (size_t i = 0; i < aLayerBuffer.GetTileCount(); ++i) { TileHost& tile = aLayerBuffer.GetTile(i); if (tile.IsPlaceholderTile()) { continue; } TileIntPoint tilePosition = aLayerBuffer.GetPlacement().TilePosition(i); // A sanity check that catches a lot of mistakes. MOZ_ASSERT(tilePosition.x == tile.mTilePosition.x && tilePosition.y == tile.mTilePosition.y); IntPoint tileOffset = aLayerBuffer.GetTileOffset(tilePosition); nsIntRegion tileDrawRegion = IntRect(tileOffset, aLayerBuffer.GetScaledTileSize()); tileDrawRegion.AndWith(compositeRegion); if (tileDrawRegion.IsEmpty()) { continue; } tileDrawRegion.ScaleRoundOut(resolution, resolution); RenderTile(tile, aEffectChain, aOpacity, aTransform, aFilter, aClipRect, tileDrawRegion, tileOffset * resolution, aLayerBuffer.GetTileSize(), gfx::Rect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height)); if (tile.mTextureHostOnWhite) { componentAlphaDiagnostic = DiagnosticFlags::COMPONENT_ALPHA; } } gfx::Rect rect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height); GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTENT | componentAlphaDiagnostic, rect, aClipRect, aTransform, mFlashCounter); }
void Variant::FromString(VariantType type, const char* value) { switch (type) { case VAR_INT: *this = ToInt(value); break; case VAR_INT64: *this = ToInt64(value); break; case VAR_BOOL: *this = ToBool(value); break; case VAR_FLOAT: *this = ToFloat(value); break; case VAR_VECTOR2: *this = ToVector2(value); break; case VAR_VECTOR3: *this = ToVector3(value); break; case VAR_VECTOR4: *this = ToVector4(value); break; case VAR_QUATERNION: *this = ToQuaternion(value); break; case VAR_COLOR: *this = ToColor(value); break; case VAR_STRING: *this = value; break; case VAR_BUFFER: { SetType(VAR_BUFFER); PODVector<unsigned char>& buffer = *(reinterpret_cast<PODVector<unsigned char>*>(&value_)); StringToBuffer(buffer, value); } break; case VAR_VOIDPTR: // From string to void pointer not supported, set to null *this = (void*)0; break; case VAR_RESOURCEREF: { StringVector values = String::Split(value, ';'); if (values.Size() == 2) { SetType(VAR_RESOURCEREF); ResourceRef& ref = *(reinterpret_cast<ResourceRef*>(&value_)); ref.type_ = values[0]; ref.name_ = values[1]; } } break; case VAR_RESOURCEREFLIST: { StringVector values = String::Split(value, ';', true); if (values.Size() >= 1) { SetType(VAR_RESOURCEREFLIST); ResourceRefList& refList = *(reinterpret_cast<ResourceRefList*>(&value_)); refList.type_ = values[0]; refList.names_.Resize(values.Size() - 1); for (unsigned i = 1; i < values.Size(); ++i) refList.names_[i - 1] = values[i]; } } break; case VAR_INTRECT: *this = ToIntRect(value); break; case VAR_INTVECTOR2: *this = ToIntVector2(value); break; case VAR_INTVECTOR3: *this = ToIntVector3(value); break; case VAR_PTR: // From string to RefCounted pointer not supported, set to null *this = (RefCounted*)0; break; case VAR_MATRIX3: *this = ToMatrix3(value); break; case VAR_MATRIX3X4: *this = ToMatrix3x4(value); break; case VAR_MATRIX4: *this = ToMatrix4(value); break; case VAR_DOUBLE: *this = ToDouble(value); break; case VAR_RECT: *this = ToRect(value); break; default: SetType(VAR_NONE); } }
void TiledContentHost::RenderTile(const TileHost& aTile, const gfxRGBA* aBackgroundColor, EffectChain& aEffectChain, float aOpacity, const gfx::Matrix4x4& aTransform, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, const nsIntRegion& aScreenRegion, const nsIntPoint& aTextureOffset, const nsIntSize& aTextureBounds) { if (aTile.IsPlaceholderTile()) { // This shouldn't ever happen, but let's fail semi-gracefully. No need // to warn, the texture update would have already caught this. return; } if (aBackgroundColor) { aEffectChain.mPrimaryEffect = new EffectSolidColor(ToColor(*aBackgroundColor)); nsIntRegionRectIterator it(aScreenRegion); for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) { Rect graphicsRect(rect->x, rect->y, rect->width, rect->height); mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, 1.0, aTransform); } } AutoLockTextureHost autoLock(aTile.mTextureHost); AutoLockTextureHost autoLockOnWhite(aTile.mTextureHostOnWhite); if (autoLock.Failed() || autoLockOnWhite.Failed()) { NS_WARNING("Failed to lock tile"); return; } RefPtr<TextureSource> source = aTile.mTextureHost->GetTextureSources(); RefPtr<TextureSource> sourceOnWhite = aTile.mTextureHostOnWhite ? aTile.mTextureHostOnWhite->GetTextureSources() : nullptr; if (!source || (aTile.mTextureHostOnWhite && !sourceOnWhite)) { return; } RefPtr<TexturedEffect> effect = CreateTexturedEffect(source, sourceOnWhite, aFilter, true); if (!effect) { return; } aEffectChain.mPrimaryEffect = effect; nsIntRegionRectIterator it(aScreenRegion); for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) { Rect graphicsRect(rect->x, rect->y, rect->width, rect->height); Rect textureRect(rect->x - aTextureOffset.x, rect->y - aTextureOffset.y, rect->width, rect->height); effect->mTextureCoords = Rect(textureRect.x / aTextureBounds.width, textureRect.y / aTextureBounds.height, textureRect.width / aTextureBounds.width, textureRect.height / aTextureBounds.height); mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, aOpacity, aTransform); } mCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT | DiagnosticFlags::TILE, aScreenRegion, aClipRect, aTransform, mFlashCounter); }
Color XMLElement::GetColor(const ea::string& name) const { return ToColor(GetAttribute(name)); }
void QtPropertyDataDavaVariant::SetValueInternal(const QVariant &value) { switch(curVariantValue.type) { case DAVA::VariantType::TYPE_BOOLEAN: curVariantValue.SetBool(value.toBool()); break; case DAVA::VariantType::TYPE_FLOAT: curVariantValue.SetFloat(value.toFloat()); break; case DAVA::VariantType::TYPE_INT32: curVariantValue.SetInt32(value.toInt()); break; case DAVA::VariantType::TYPE_INT64: curVariantValue.SetInt64(value.toLongLong()); break; case DAVA::VariantType::TYPE_UINT32: curVariantValue.SetUInt32(value.toUInt()); break; case DAVA::VariantType::TYPE_UINT64: curVariantValue.SetUInt64(value.toULongLong()); break; case DAVA::VariantType::TYPE_KEYED_ARCHIVE: ToKeyedArchive(value); break; case DAVA::VariantType::TYPE_STRING: curVariantValue.SetString(value.toString().toStdString()); break; case DAVA::VariantType::TYPE_MATRIX2: ToMatrix2(value); break; case DAVA::VariantType::TYPE_MATRIX3: ToMatrix3(value); break; case DAVA::VariantType::TYPE_MATRIX4: ToMatrix4(value); break; case DAVA::VariantType::TYPE_VECTOR2: ToVector2(value); break; case DAVA::VariantType::TYPE_VECTOR3: ToVector3(value); break; case DAVA::VariantType::TYPE_VECTOR4: ToVector4(value); break; case DAVA::VariantType::TYPE_COLOR: ToColor(value); break; case DAVA::VariantType::TYPE_FASTNAME: curVariantValue.SetFastName(DAVA::FastName(value.toString().toStdString().c_str())); break; case DAVA::VariantType::TYPE_AABBOX3: ToAABBox3(value); break; case DAVA::VariantType::TYPE_BYTE_ARRAY: default: break; } }