X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-toolkit%2Finternal%2Fvisuals%2Fnpatch%2Fnpatch-visual.cpp;h=b9e046a02e0793547a576806917df0e2dbc5ae9c;hb=57f2c014e61cff22236c0459757c41134fc7785f;hp=bb8571da9f19dda660cc8bf0984cefcd0b2e4476;hpb=9e5047cc2a965c85345363af3b511bcf6234b887;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp index bb8571d..b9e046a 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp @@ -153,10 +153,10 @@ void NPatchVisual::LoadImages() TextureManager& textureManager = mFactoryCache.GetTextureManager(); bool synchronousLoading = mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING; - if(mId == NPatchData::INVALID_NPATCH_DATA_ID && mImageUrl.IsLocalResource()) + if(mId == NPatchData::INVALID_NPATCH_DATA_ID && (mImageUrl.IsLocalResource() || mImageUrl.IsBufferResource())) { bool preMultiplyOnLoad = IsPreMultipliedAlphaEnabled() && !mImpl->mCustomShader ? true : false; - mId = mLoader.Load(textureManager, this, mImageUrl.GetUrl(), mBorder, preMultiplyOnLoad, synchronousLoading); + mId = mLoader.Load(textureManager, this, mImageUrl, mBorder, preMultiplyOnLoad, synchronousLoading); const NPatchData* data; if(mLoader.GetNPatchData(mId, data) && data->GetLoadingState() == NPatchData::LoadingState::LOAD_COMPLETE) @@ -165,7 +165,7 @@ void NPatchVisual::LoadImages() } } - if(!mAuxiliaryPixelBuffer && mAuxiliaryUrl.IsValid() && mAuxiliaryUrl.IsLocalResource()) + if(!mAuxiliaryPixelBuffer && mAuxiliaryUrl.IsValid() && (mAuxiliaryUrl.IsLocalResource() || mAuxiliaryUrl.IsBufferResource())) { // Load the auxiliary image auto preMultiplyOnLoading = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY; @@ -376,7 +376,10 @@ void NPatchVisual::OnInitialize() { // Get basic geometry and shader Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY); - Shader shader = mImageVisualShaderFactory.GetShader(mFactoryCache, false, true, false); + Shader shader = mImageVisualShaderFactory.GetShader( + mFactoryCache, + ImageVisualShaderFeature::FeatureBuilder() + ); mImpl->mRenderer = Renderer::New(geometry, shader); @@ -556,7 +559,14 @@ void NPatchVisual::ApplyTextureAndUniforms() DALI_LOG_ERROR("The N patch image '%s' is not a valid N patch image\n", mImageUrl.GetUrl().c_str()); textureSet = TextureSet::New(); - Texture croppedImage = mFactoryCache.GetBrokenVisualImage(); + Actor actor = mPlacementActor.GetHandle(); + Vector2 imageSize = Vector2::ZERO; + if(actor) + { + imageSize = actor.GetProperty(Actor::Property::SIZE).Get(); + } + mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize); + Texture croppedImage = mImpl->mRenderer.GetTextures().GetTexture(0); textureSet.SetTexture(0u, croppedImage); mImpl->mRenderer.RegisterProperty("uFixed[0]", Vector2::ZERO); mImpl->mRenderer.RegisterProperty("uFixed[1]", Vector2::ZERO); @@ -767,32 +777,34 @@ void NPatchVisual::SetResource() } } -void NPatchVisual::UploadComplete(bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied) +void NPatchVisual::LoadComplete(bool loadSuccess, TextureInformation textureInformation) { - EnablePreMultipliedAlpha(preMultiplied); - if(!loadSuccess) + if(textureInformation.returnType == TextureUploadObserver::ReturnType::TEXTURE) { - // Image loaded and ready to display - ResourceReady(Toolkit::Visual::ResourceStatus::FAILED); - } - - if(mAuxiliaryPixelBuffer || !mAuxiliaryUrl.IsValid()) - { - SetResource(); - } -} + EnablePreMultipliedAlpha(textureInformation.preMultiplied); + if(!loadSuccess) + { + // Image loaded and ready to display + ResourceReady(Toolkit::Visual::ResourceStatus::FAILED); + } -void NPatchVisual::LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied) -{ - if(loadSuccess && url.GetUrl() == mAuxiliaryUrl.GetUrl()) - { - mAuxiliaryPixelBuffer = pixelBuffer; - SetResource(); + if(mAuxiliaryPixelBuffer || !mAuxiliaryUrl.IsValid()) + { + SetResource(); + } } - else + else // for the ReturnType::PIXEL_BUFFER { - // Image loaded and ready to display - ResourceReady(Toolkit::Visual::ResourceStatus::FAILED); + if(loadSuccess && textureInformation.url == mAuxiliaryUrl.GetUrl()) + { + mAuxiliaryPixelBuffer = textureInformation.pixelBuffer; + SetResource(); + } + else + { + // Image loaded and ready to display + ResourceReady(Toolkit::Visual::ResourceStatus::FAILED); + } } }