+void NPatchVisual::SetResource()
+{
+ const NPatchData* data;
+ if( mImpl->mRenderer && mLoader.GetNPatchData( mId, data ) )
+ {
+ Geometry geometry = CreateGeometry();
+ Shader shader = CreateShader();
+
+ mImpl->mRenderer.SetGeometry( geometry );
+ mImpl->mRenderer.SetShader( shader );
+
+ Actor actor = mPlacementActor.GetHandle();
+ if( actor )
+ {
+ ApplyTextureAndUniforms();
+ actor.AddRenderer( mImpl->mRenderer );
+ mPlacementActor.Reset();
+
+ // npatch loaded and ready to display
+ ResourceReady( Toolkit::Visual::ResourceStatus::READY );
+ }
+ }
+}
+
+void NPatchVisual::UploadComplete( bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied )
+{
+ EnablePreMultipliedAlpha( preMultiplied );
+ if(!loadSuccess)
+ {
+ // Image loaded and ready to display
+ ResourceReady( Toolkit::Visual::ResourceStatus::FAILED );
+ }
+
+ if( mAuxiliaryPixelBuffer || !mAuxiliaryUrl.IsValid() )
+ {
+ SetResource();
+ }
+}
+
+void NPatchVisual::LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied )
+{
+ if( loadSuccess && url.GetUrl() == mAuxiliaryUrl.GetUrl() )
+ {
+ mAuxiliaryPixelBuffer = pixelBuffer;
+ SetResource();
+ }
+ else
+ {
+ // Image loaded and ready to display
+ ResourceReady( Toolkit::Visual::ResourceStatus::FAILED );
+ }
+}
+