HRESULT SymTypedef::GetDef( CString &Info ) { #ifdef DEBUG_PRINT SymbolInfoTable InfoTableDebug; SymBase::GetInfoTable(InfoTableDebug); #endif BSTR Name; HRESULT hr = Self()->get_name(&Name); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } IDiaSymbol *SymType; hr = Self()->get_type(&SymType); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } CString TypeStr; CAutoPtr<SymBase> SymSub(SymBase::SymNew(SymType)); hr = SymSub->GetDecl(TypeStr); ATLASSERT(HR_OK(hr)); Info = L"typedef "; Info += TypeStr + L" " + Name + L";"; return hr; }
HRESULT SymArray::GetDecl( CString &Info ) { #ifdef DEBUG_PRINT SymbolInfoTable InfoTableDebug; SymBase::GetInfoTable(InfoTableDebug); #endif IDiaSymbol *SymType; HRESULT hr = Self()->get_type(&SymType); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } CString TypeStr; CAutoPtr<SymBase> SymSub(SymBase::SymNew(SymType)); hr = SymSub->GetDecl(TypeStr); ATLASSERT(HR_OK(hr)); ULONG Count; CString ArrayCount; hr = Self()->get_count(&Count); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } ArrayCount.Format(L" [%d]", Count); Info = TypeStr + ArrayCount; return hr; }
void ImageView::SetCameraActor(CameraActor camera, float detailFactor) { Constraint constraint = Constraint::New<float>( mPropertyDetail, LocalSource( Actor::WORLD_POSITION ), Source( camera, Actor::WORLD_POSITION ), CameraDetailConstraint(detailFactor)); Self().RemoveConstraints(); Self().ApplyConstraint(constraint); }
void View::OnInitialize() { Self().SetAnchorPoint( AnchorPoint::CENTER ); Self().SetParentOrigin( ParentOrigin::CENTER ); if( mFullScreen ) { Self().SetSize( Stage::GetCurrent().GetSize() ); } }
void ImageView::SetImageDistanceField(const std::string& filename) { ImageAttributes attributes = Dali::ImageAttributes::NewDistanceField(1.0f, 1); const Vector3 size = Self().GetCurrentSize(); attributes.SetSize( size.x, size.y ); Image image = Image::NewDistanceField(filename, attributes); mImageActor.SetImage( image ); DistanceFieldEffect effect = DistanceFieldEffect::New(); Self().SetShaderEffect( effect ); }
void ShadowView::OnInitialize() { // root actor to parent all user added actors. Used as source actor for shadow render task. mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); mChildrenRoot.ApplyConstraint(Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() )); Vector2 stageSize = Stage::GetCurrent().GetSize(); mCameraActor = CameraActor::New(stageSize); mCameraActor.SetParentOrigin( ParentOrigin::CENTER ); // Target is constrained to point at the shadow plane origin mCameraActor.SetNearClippingPlane( 1.0f ); mCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Camera orientation constrained to point at shadow plane world position mCameraActor.SetRotation(Radian(Degree(180)), Vector3::YAXIS); mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION); mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE, Dali::GeometryType( GEOMETRY_TYPE_IMAGE ), ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_BLENDING )); // Create render targets needed for rendering from light's point of view mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ); mOutputImage = FrameBufferImage::New( stageSize.width * 0.5f, stageSize.height * 0.5f, Pixel::RGBA8888 ); ////////////////////////////////////////////////////// // Connect to actor tree Self().Add( mChildrenRoot ); Stage::GetCurrent().Add( mCameraActor ); mBlurFilter.SetRefreshOnDemand(false); mBlurFilter.SetInputImage(mSceneFromLightRenderTarget); mBlurFilter.SetOutputImage(mOutputImage); mBlurFilter.SetSize(stageSize * 0.5f); mBlurFilter.SetPixelFormat(Pixel::RGBA8888); mBlurRootActor = Actor::New(); // Turn off inheritance to ensure filter renders properly mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION); mBlurRootActor.SetInheritRotation(false); mBlurRootActor.SetInheritScale(false); mBlurRootActor.SetColorMode(USE_OWN_COLOR); Self().Add(mBlurRootActor); mBlurFilter.SetRootActor(mBlurRootActor); mBlurFilter.SetBackgroundColor(Vector4::ZERO); SetShaderConstants(); }
HRESULT SymFuncType::GetDef( CString &Info ) { #ifdef DEBUG_PRINT SymbolInfoTable InfoTableDebug; SymBase::GetInfoTable(InfoTableDebug); #endif CComPtr<IDiaSymbol> FuncBaseType; HRESULT hr = Self()->get_type(&FuncBaseType); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } CAutoPtr<SymBase> SubSym(SymBase::SymNew(FuncBaseType)); hr = SubSym->GetDecl(Info); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } Info += L" ("; ULONG CallConv; hr = Self()->get_callingConvention(&CallConv); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } Info += GetCallingConventionStr(CallConv); Info += L" *)"; IDiaEnumSymbols *SymChildren = GetEnum(SymTagFunctionArgType); Info += L"("; if (SymChildren != NULL) { SymEnumTool SymEnumInst(SymChildren); int i; for (i = 0; i < SymEnumInst.GetCount(); i++) { if (i != 0) { Info += L", "; } CString Tmp; CAutoPtr<SymBase> p(SymBase::SymNew(SymEnumInst.Item(i))); p->GetDecl(Tmp); Info += Tmp; } } Info += L")"; return S_OK; }
HRESULT SymFunc::GetDecl(CString &Info) { #ifdef DEBUG_PRINT SymbolInfoTable InfoTableDebug; SymBase::GetInfoTable(InfoTableDebug); #endif BSTR Name; HRESULT hr = Self()->get_name(&Name); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } CComPtr<IDiaSymbol> FuncType; hr = Self()->get_type(&FuncType); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } CString FuncTypeStr; CAutoPtr<SymBase> SubSym(SymBase::SymNew(FuncType)); hr = SubSym->GetDecl(FuncTypeStr); ATLASSERT(HR_OK(hr)); CString ArgsStr = L"("; IDiaEnumSymbols *SymChildren = GetEnum(SymTagData); if (SymChildren != NULL) { SymEnumTool SymEnumInst(SymChildren); int i; for (i = 0; i < SymEnumInst.GetCount(); i++) { CAutoPtr<SymBase> p(SymBase::SymNew(SymEnumInst.Item(i))); ULONG DataKind; CString ArgStr; hr = p->Self()->get_dataKind(&DataKind); if (HR_OK(hr) && DataKind == DataIsParam) { if (i != 0) { ArgsStr += L", "; } p->GetDecl(ArgStr); ArgsStr += ArgStr; } } } ArgsStr += L")"; Info = FuncTypeStr + L" " + Name + L" " + ArgsStr + L";"; return hr; }
void AiEntityPhysicsState::UpdateAreaNums() { const AiAasWorld *aasWorld = AiAasWorld::Instance(); this->currAasAreaNum = ( decltype( this->currAasAreaNum ) )aasWorld->FindAreaNum( Origin() ); // Use a computation shortcut when entity is on ground if( this->groundEntNum >= 0 ) { this->droppedToFloorOriginOffset = ( decltype( this->droppedToFloorOriginOffset ) )( -playerbox_stand_mins[2] ); this->droppedToFloorOriginOffset += 4.0f; SetHeightOverGround( 0 ); Vec3 droppedOrigin( Origin() ); droppedOrigin.Z() -= this->droppedToFloorOriginOffset; this->droppedToFloorAasAreaNum = ( decltype( this->droppedToFloorAasAreaNum ) )aasWorld->FindAreaNum( droppedOrigin ); return; } // Use a computation shortcut when the current area is grounded if( aasWorld->AreaSettings()[this->currAasAreaNum].areaflags & AREA_GROUNDED ) { float areaMinsZ = aasWorld->Areas()[this->currAasAreaNum].mins[2]; float selfZ = Self()->s.origin[2]; float heightOverGround_ = selfZ - areaMinsZ + playerbox_stand_maxs[2]; clamp_high( heightOverGround_, GROUND_TRACE_DEPTH ); SetHeightOverGround( heightOverGround_ ); this->droppedToFloorOriginOffset = ( decltype( this->droppedToFloorOriginOffset ) )( heightOverGround_ - 4.0f ); this->droppedToFloorAasAreaNum = this->currAasAreaNum; return; } // Try drop an origin from air to floor trace_t trace; edict_t *ent = const_cast<edict_t *>( Self() ); Vec3 traceEnd( Origin() ); traceEnd.Z() -= GROUND_TRACE_DEPTH; G_Trace( &trace, this->origin, ent->r.mins, ent->r.maxs, traceEnd.Data(), ent, MASK_PLAYERSOLID ); // Check not only whether there is a hit but test whether is it really a ground (and not a wall or obstacle) if( trace.fraction != 1.0f && Origin()[2] - trace.endpos[2] > -playerbox_stand_mins[2] ) { float heightOverGround_ = trace.fraction * GROUND_TRACE_DEPTH + playerbox_stand_mins[2]; this->droppedToFloorOriginOffset = ( decltype( this->droppedToFloorOriginOffset ) )( -playerbox_stand_mins[2] ); this->droppedToFloorOriginOffset -= heightOverGround_ - 4.0f; SetHeightOverGround( heightOverGround_ ); Vec3 droppedOrigin( Origin() ); droppedOrigin.Z() -= this->droppedToFloorOriginOffset; this->droppedToFloorAasAreaNum = ( decltype( this->droppedToFloorAasAreaNum ) )aasWorld->FindAreaNum( droppedOrigin ); return; } this->droppedToFloorOriginOffset = 0; SetHeightOverGround( std::numeric_limits<float>::infinity() ); this->droppedToFloorAasAreaNum = this->currAasAreaNum; }
void Magnifier::Update() { // TODO: Make Camera settings (fieldofview/aspectratio) as animatable constraints. // should be updated when: // Magnifier's world size/scale changes. Actor self(Self()); Vector3 worldSize = mActorSize * self.GetCurrentWorldScale(); // Adjust field of view to scale content // size.height / 2 // |------/ // |d / // |i / // |s / // |t / // |./ // |/ <--- fov/2 radians. // const float fov = atanf( 0.5f * worldSize.height / mDefaultCameraDistance / mMagnificationFactor) * 2.0f; mCameraActor.SetFieldOfView( fov ); // Adjust aspect ratio to compensate for rectangular viewports. mCameraActor.SetAspectRatio( worldSize.width / worldSize.height ); }
void Page::OnInitialize() { Actor self = Self(); mPropertyTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_TITLE, "", Property::READ_WRITE ); mPropertySubTitle = self.RegisterProperty( Dali::Toolkit::Page::PROPERTY_SUB_TITLE, "", Property::READ_WRITE ); }
void ShadowView::Activate() { DALI_ASSERT_ALWAYS( Self().OnStage() && "ShadowView should be on stage before calling Activate()\n" ); // make sure resources are allocated and start the render tasks processing CreateRenderTasks(); }
void ShadowView::SetShaderConstants() { CustomActor self = Self(); mShadowRenderShader.SetUniform( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY ); mShadowRenderShader.SetUniform( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY ); mShadowRenderShader.SetUniform( SHADER_SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor ); Property::Index lightCameraProjectionMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME); Property::Index lightCameraViewMatrixPropertyIndex = mShadowRenderShader.GetPropertyIndex(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME); Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraProjectionMatrixPropertyIndex, Source( mCameraActor, CameraActor::PROJECTION_MATRIX ), EqualToConstraintMatrix()); Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( lightCameraViewMatrixPropertyIndex, Source( mCameraActor, CameraActor::VIEW_MATRIX ), EqualToConstraintMatrix()); mShadowRenderShader.ApplyConstraint(projectionMatrixConstraint); mShadowRenderShader.ApplyConstraint(viewMatrixConstraint); // Register a property that the user can use to control the blur in the internal object mBlurStrengthPropertyIndex = self.RegisterProperty(BLUR_STRENGTH_PROPERTY_NAME, BLUR_STRENGTH_DEFAULT); mBlurFilter.GetHandleForAnimateBlurStrength().ApplyConstraint( Constraint::New<float>( mBlurFilter.GetBlurStrengthPropertyIndex() , Source( self, mBlurStrengthPropertyIndex), EqualToConstraint()) ); // Register a property that the user can use to control the color of the shadow. Property::Index index = mShadowRenderShader.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME); mShadowColorPropertyIndex = self.RegisterProperty(SHADOW_COLOR_PROPERTY_NAME, mCachedShadowColor); mShadowRenderShader.ApplyConstraint(Constraint::New<Dali::Vector4>( index, Source( self, mShadowColorPropertyIndex ), EqualToConstraint()) ); }
static NGS_String_v1 * ITF_Reference_v1_get_cmn_name ( const NGS_Reference_v1 * self, NGS_ErrBlock_v1 * err ) { HYBRID_FUNC_ENTRY ( rcSRA, rcRefcount, rcAccessing ); ON_FAIL ( struct NGS_String * ret = NGS_ReferenceGetCommonName ( Self ( self ), ctx ) ) { NGS_ErrBlockThrow ( err, ctx ); }
static NGS_String_v1 * NGS_ReadCollection_v1_get_name ( const NGS_ReadCollection_v1 * self, NGS_ErrBlock_v1 * err ) { HYBRID_FUNC_ENTRY ( rcSRA, rcRefcount, rcAccessing ); ON_FAIL ( NGS_String * ret = NGS_ReadCollectionGetName ( Self ( self ), ctx ) ) { NGS_ErrBlockThrow ( err, ctx ); }
void GaussianBlurView::OnSizeSet(const Vector3& targetSize) { mTargetSize = Vector2(targetSize); mChildrenRoot.SetSize(targetSize); if( !mBlurUserImage ) { mImageActorComposite.SetSize(targetSize); mTargetActor.SetSize(targetSize); // Children render camera must move when GaussianBlurView object is resized. This is since we cannot change render target size - so we need to remap the child actors' rendering // accordingly so they still exactly fill the render target. Note that this means the effective resolution of the child render changes as the GaussianBlurView object changes // size, this is the trade off for not being able to modify render target size // Change camera z position based on GaussianBlurView actor height float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f); mRenderFullSizeCamera.SetZ(mTargetSize.height * cameraPosConstraintScale); } // if we are already on stage, need to update render target sizes now to reflect the new size of this actor if(Self().OnStage()) { AllocateResources(); } }
static uint32_t NGS_Statistics_v1_get_type ( const NGS_Statistics_v1 * self, NGS_ErrBlock_v1 * err, const char * path ) { HYBRID_FUNC_ENTRY ( rcSRA, rcRefcount, rcAccessing ); ON_FAIL ( uint32_t ret = NGS_StatisticsGetValueType ( Self ( self ), ctx, path ) ) { NGS_ErrBlockThrow ( err, ctx ); }
void ShadowView::Deactivate() { DALI_ASSERT_ALWAYS( Self().OnStage() && "ShadowView should be on stage before calling Deactivate()\n" ) // stop render tasks processing // Note: render target resources are automatically freed since we set the Image::Unused flag RemoveRenderTasks(); }
namespace test_factorial { auto Fact = [](auto Self, unsigned n) -> unsigned { return !n ? 1 : Self(Self, n - 1) * n; }; auto six = Fact(Fact, 3); }
void ImageView::AddImage(ImageRequest& req, PropertyCondition condition) { Actor self = Self(); PropertyNotification notification = self.AddPropertyNotification( mPropertyDetail, condition ); notification.NotifySignal().Connect( this, &ImageView::OnDetailChange ); mNotifications[notification] = req; }
void CIoLog::Printf(TRefByValue<const TDesC> aFmt, ...) { TOverflowTruncate overflow; VA_LIST list; VA_START(list, aFmt); CIoLog& self = Self(); self.iScratchBuf.SetLength(0); self.iScratchBuf.AppendFormatList(aFmt, list, &overflow); Write(self.iScratchBuf); }
void CIoLog::LogCompletion(const RMsg& aMessage, TInt aError) { TFullName threadName(_L("unknown")); TRAP_IGNORE(threadName = ClientNameL(aMessage)); CIoLog& self = Self(); self.iScratchBuf.SetLength(0); TOverflowTruncate overflow; self.iScratchBuf.AppendFormat(_L("Completing %S's request (opcode: %S, message handle: %d) with %S(%d)"), &overflow, &threadName, StringifyOpcode(aMessage.Function()), static_cast<const RMessageAccess&>(aMessage).Handle(), StringifyError(aError), aError); self.Write(self.iScratchBuf); }
__kernel void initializeArrays(__global float *input_data, __global int *labels, __global float *F, __global float *kernelDiag, const int nPoints, const int dFeatures, const float paramA, const float paramB, const float paramC){ int gid = get_global_id(0); if(gid < nPoints){ __global float *vecA = input_data + gid *dFeatures; kernelDiag[gid] = ${kernelFunc}Self(vecA, dFeatures, paramA, paramB, paramC); F[gid] = - (float)labels[gid]; }
void ImageView::OnStageDisconnection() { if( mRenderer ) { CustomActor self = Self(); mRenderer.SetOffStage( self ); } Control::OnStageDisconnection(); }
HRESULT SymUDT::GetDecl( CString &Info ) { #ifdef DEBUG_PRINT SymbolInfoTable InfoTableDebug; SymBase::GetInfoTable(InfoTableDebug); #endif BSTR DeclName; HRESULT hr = Self()->get_name(&DeclName); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } CString Name(DeclName); if (Name == L"<unnamed-tag>") { hr = GetDef(Name); ATLASSERT(HR_OK(hr)); } ULONG UdtKind; CString UdtName; hr = Self()->get_udtKind(&UdtKind); ATLASSERT(HR_OK(hr)); if (HR_NOK(hr)) { return hr; } if (UdtKind == UdtStruct) { UdtName = L"struct"; } else if (UdtKind == UdtUnion) { UdtName = L"union"; } else { UdtName = L"class"; } Info = UdtName + L" " +Name; return S_OK; }
void Scrollable::RegisterCommonProperties() { Actor self = Self(); // Register properties. mPropertyRelativePosition = self.RegisterProperty(Toolkit::Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME, Vector3::ZERO); mPropertyPositionMin = self.RegisterProperty(Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME, Vector3::ZERO); mPropertyPositionMax = self.RegisterProperty(Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME, Vector3::ZERO); mPropertyScrollDirection = self.RegisterProperty(Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME, Vector3::ZERO); mPropertyCanScrollVertical = self.RegisterProperty(SCROLLABLE_CAN_SCROLL_VERTICAL, true); mPropertyCanScrollHorizontal = self.RegisterProperty(SCROLLABLE_CAN_SCROLL_HORIZONTAL, true); }
void CIoLog::StartServiceLC(const RMsg& aMessage) { CIoLog& self = Self(); ASSERT(!self.iInServiceL); self.iScratchBuf.SetLength(0); self.iScratchBuf = ClientNameL(aMessage); CleanupStack::PushL(TCleanupItem(EndService, &self)); TOverflowTruncate overflow; self.iScratchBuf.AppendFormat(_L(" requested %S (opcode: %d, message handle: %d)"), &overflow, StringifyOpcode(aMessage.Function()), aMessage.Function(), static_cast<const RMessageAccess&>(aMessage).Handle()); self.Write(self.iScratchBuf); self.iInServiceL = ETrue; }
void PileupEventItf :: reset ( NGS_PileupEvent_v1 * iself, NGS_ErrBlock_v1 * err ) { PileupEventItf * self = Self ( iself ); try { self -> resetPileupEvent (); } catch ( ... ) { ErrBlockHandleException ( err ); } }
void cTCPLinkImpl::cLinkTlsContext::StoreReceivedData(const char * a_Data, size_t a_NumBytes) { // Hold self alive for the duration of this function cLinkTlsContextPtr Self(m_Self); m_EncryptedData.append(a_Data, a_NumBytes); // Try to finish a pending handshake: TryFinishHandshaking(); // Flush any cleartext data that can be "received": FlushBuffers(); }
void ImageView::Initialize() { Actor self = Self(); // Register property that represents the level of detail. mPropertyDetail = self.RegisterProperty(Toolkit::ImageView::DETAIL_PROPERTY_NAME, 0.0f); // Create an empty image actor, filling the entire size of this ImageView. Image emptyImage; mImageActor = ImageActor::New( emptyImage ); self.Add( mImageActor ); mImageActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); mImageActor.SetParentOrigin( ParentOrigin::CENTER ); }