X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbloom-view%2Fbloom-view-impl.cpp;h=df9b6ed97aa8f7deaff2ff9eaff39486e955dd1a;hp=0221785b481e4015c19cd0390b13d694781c2e7d;hb=cd7d41bc8e0a0816da28401207091344fbbe0b2c;hpb=2ec164cd618f93ccafe17b1d0b8ff16401ed4aef diff --git a/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp b/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp index 0221785..df9b6ed 100644 --- a/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp +++ b/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include #include #include #include @@ -459,18 +458,6 @@ void BloomView::Deactivate() } /** - * EqualToConstraintFloat - * - * f(current, property) = property - */ -struct EqualToConstraintFloat -{ - EqualToConstraintFloat(){} - - float operator()(const float current, const PropertyInput& property) {return property.GetFloat();} -}; - -/** * RecipOneMinusConstraint * * f(current, property) = property @@ -479,9 +466,9 @@ struct RecipOneMinusConstraint { RecipOneMinusConstraint(){} - float operator()(const float current, const PropertyInput& property) + void operator()( float& current, const PropertyInputContainer& inputs ) { - return 1.0f / (1.0f - property.GetFloat()); + current = 1.0f / ( 1.0f - inputs[0]->GetFloat() ); } }; @@ -502,13 +489,15 @@ void BloomView::SetupProperties() // Register a property that the user can control to change the bloom threshold mBloomThresholdPropertyIndex = self.RegisterProperty(BLOOM_THRESHOLD_PROPERTY_NAME, BLOOM_THRESHOLD_DEFAULT); Property::Index shaderBloomThresholdPropertyIndex = mBloomExtractShader.GetPropertyIndex(BLOOM_THRESHOLD_PROPERTY_NAME); - Constraint bloomThresholdConstraint = Constraint::New(shaderBloomThresholdPropertyIndex, Source(self, mBloomThresholdPropertyIndex), EqualToConstraintFloat()); - mBloomExtractShader.ApplyConstraint(bloomThresholdConstraint); + Constraint bloomThresholdConstraint = Constraint::New( mBloomExtractShader, shaderBloomThresholdPropertyIndex, EqualToConstraint()); + bloomThresholdConstraint.AddSource( Source(self, mBloomThresholdPropertyIndex) ); + bloomThresholdConstraint.Apply(); // precalc 1.0 / (1.0 - threshold) on CPU to save shader insns, using constraint to tie to the normal threshold property Property::Index shaderRecipOneMinusBloomThresholdPropertyIndex = mBloomExtractShader.GetPropertyIndex(RECIP_ONE_MINUS_BLOOM_THRESHOLD_PROPERTY_NAME); - Constraint thresholdConstraint = Constraint::New( shaderRecipOneMinusBloomThresholdPropertyIndex, LocalSource(shaderBloomThresholdPropertyIndex), RecipOneMinusConstraint()); - mBloomExtractShader.ApplyConstraint(thresholdConstraint); + Constraint thresholdConstraint = Constraint::New( mBloomExtractShader, shaderRecipOneMinusBloomThresholdPropertyIndex, RecipOneMinusConstraint()); + thresholdConstraint.AddSource( LocalSource(shaderBloomThresholdPropertyIndex) ); + thresholdConstraint.Apply(); //////////////////////////////////////////// @@ -516,8 +505,9 @@ void BloomView::SetupProperties() // Register a property that the user can control to fade the blur in / out via internal GaussianBlurView object mBlurStrengthPropertyIndex = self.RegisterProperty(BLOOM_BLUR_STRENGTH_PROPERTY_NAME, BLOOM_BLUR_STRENGTH_DEFAULT); - Constraint blurStrengthConstraint = Constraint::New( mGaussianBlurView.GetBlurStrengthPropertyIndex(), Source(self, mBlurStrengthPropertyIndex), EqualToConstraintFloat()); - mGaussianBlurView.ApplyConstraint(blurStrengthConstraint); + Constraint blurStrengthConstraint = Constraint::New( mGaussianBlurView, mGaussianBlurView.GetBlurStrengthPropertyIndex(), EqualToConstraint()); + blurStrengthConstraint.AddSource( Source(self, mBlurStrengthPropertyIndex) ); + blurStrengthConstraint.Apply(); //////////////////////////////////////////// @@ -527,8 +517,9 @@ void BloomView::SetupProperties() mBloomIntensityPropertyIndex = self.RegisterProperty(BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT); mCompositeShader.SetUniform( BLOOM_INTENSITY_PROPERTY_NAME, BLOOM_INTENSITY_DEFAULT ); Property::Index shaderBloomIntensityPropertyIndex = mCompositeShader.GetPropertyIndex(BLOOM_INTENSITY_PROPERTY_NAME); - Constraint bloomIntensityConstraint = Constraint::New( shaderBloomIntensityPropertyIndex, Source(self, mBloomIntensityPropertyIndex), EqualToConstraintFloat()); - mCompositeShader.ApplyConstraint(bloomIntensityConstraint); + Constraint bloomIntensityConstraint = Constraint::New( mCompositeShader, shaderBloomIntensityPropertyIndex, EqualToConstraint()); + bloomIntensityConstraint.AddSource( Source(self, mBloomIntensityPropertyIndex) ); + bloomIntensityConstraint.Apply(); //////////////////////////////////////////// @@ -538,8 +529,9 @@ void BloomView::SetupProperties() mBloomSaturationPropertyIndex = self.RegisterProperty(BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT); mCompositeShader.SetUniform( BLOOM_SATURATION_PROPERTY_NAME, BLOOM_SATURATION_DEFAULT ); Property::Index shaderBloomSaturationPropertyIndex = mCompositeShader.GetPropertyIndex(BLOOM_SATURATION_PROPERTY_NAME); - Constraint bloomSaturationConstraint = Constraint::New( shaderBloomSaturationPropertyIndex, Source(self, mBloomSaturationPropertyIndex), EqualToConstraintFloat()); - mCompositeShader.ApplyConstraint(bloomSaturationConstraint); + Constraint bloomSaturationConstraint = Constraint::New( mCompositeShader, shaderBloomSaturationPropertyIndex, EqualToConstraint()); + bloomSaturationConstraint.AddSource( Source(self, mBloomSaturationPropertyIndex) ); + bloomSaturationConstraint.Apply(); //////////////////////////////////////////// @@ -549,8 +541,9 @@ void BloomView::SetupProperties() mImageIntensityPropertyIndex = self.RegisterProperty(IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT); mCompositeShader.SetUniform( IMAGE_INTENSITY_PROPERTY_NAME, IMAGE_INTENSITY_DEFAULT ); Property::Index shaderImageIntensityPropertyIndex = mCompositeShader.GetPropertyIndex(IMAGE_INTENSITY_PROPERTY_NAME); - Constraint imageIntensityConstraint = Constraint::New( shaderImageIntensityPropertyIndex, Source(self, mImageIntensityPropertyIndex), EqualToConstraintFloat()); - mCompositeShader.ApplyConstraint(imageIntensityConstraint); + Constraint imageIntensityConstraint = Constraint::New( mCompositeShader, shaderImageIntensityPropertyIndex, EqualToConstraint()); + imageIntensityConstraint.AddSource( Source(self, mImageIntensityPropertyIndex) ); + imageIntensityConstraint.Apply(); //////////////////////////////////////////// @@ -560,8 +553,9 @@ void BloomView::SetupProperties() mImageSaturationPropertyIndex = self.RegisterProperty(IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT); mCompositeShader.SetUniform( IMAGE_SATURATION_PROPERTY_NAME, IMAGE_SATURATION_DEFAULT ); Property::Index shaderImageSaturationPropertyIndex = mCompositeShader.GetPropertyIndex(IMAGE_SATURATION_PROPERTY_NAME); - Constraint imageSaturationConstraint = Constraint::New( shaderImageSaturationPropertyIndex, Source(self, mImageSaturationPropertyIndex), EqualToConstraintFloat()); - mCompositeShader.ApplyConstraint(imageSaturationConstraint); + Constraint imageSaturationConstraint = Constraint::New( mCompositeShader, shaderImageSaturationPropertyIndex, EqualToConstraint()); + imageSaturationConstraint.AddSource( Source(self, mImageSaturationPropertyIndex) ); + imageSaturationConstraint.Apply(); } } // namespace Internal