+void NPatchVisual::SetResource()
+{
+ const NPatchLoader::Data* 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::LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied )
+{
+ if( url.GetUrl() == mAuxiliaryUrl.GetUrl() )
+ {
+ mAuxiliaryPixelBuffer = pixelBuffer;
+ const NPatchLoader::Data* data;
+ if( mLoader.GetNPatchData( mId, data ) && data->loadCompleted )
+ {
+ SetResource();
+ }
+ }
+ else
+ {
+ if( loadSuccess )
+ {
+ mLoader.SetNPatchData( mId, pixelBuffer );
+ EnablePreMultipliedAlpha( preMultiplied );
+ }
+
+ if( mAuxiliaryPixelBuffer || !mAuxiliaryUrl.IsValid() )
+ {
+ SetResource();
+ }
+ }
+}
+