2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/visuals/npatch/npatch-visual.h>
22 #include <dali/devel-api/adaptor-framework/image-loading.h>
23 #include <dali/devel-api/common/stage.h>
24 #include <dali/devel-api/rendering/renderer-devel.h>
25 #include <dali/integration-api/debug.h>
28 #include <dali-toolkit/devel-api/utility/npatch-helper.h>
29 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
30 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
31 #include <dali-toolkit/internal/visuals/image-atlas-manager.h>
32 #include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
33 #include <dali-toolkit/internal/visuals/npatch-loader.h>
34 #include <dali-toolkit/internal/visuals/rendering-addon.h>
35 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
36 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
37 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
38 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
39 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
40 #include <dali-toolkit/public-api/visuals/visual-properties.h>
50 const int CUSTOM_PROPERTY_COUNT(5); // fixed(3),stretch,aux
53 /////////////////NPatchVisual////////////////
55 NPatchVisualPtr NPatchVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties)
57 NPatchVisualPtr nPatchVisual(new NPatchVisual(factoryCache, shaderFactory));
58 nPatchVisual->mImageUrl = imageUrl;
59 nPatchVisual->SetProperties(properties);
60 nPatchVisual->Initialize();
64 NPatchVisualPtr NPatchVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl)
66 NPatchVisualPtr nPatchVisual(new NPatchVisual(factoryCache, shaderFactory));
67 nPatchVisual->mImageUrl = imageUrl;
68 nPatchVisual->Initialize();
72 void NPatchVisual::LoadImages()
74 TextureManager& textureManager = mFactoryCache.GetTextureManager();
75 bool synchronousLoading = mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
77 if(mId == NPatchData::INVALID_NPATCH_DATA_ID && (mImageUrl.IsLocalResource() || mImageUrl.IsBufferResource()))
79 bool preMultiplyOnLoad = IsPreMultipliedAlphaEnabled() && !mImpl->mCustomShader ? true : false;
80 mId = mLoader.Load(textureManager, this, mImageUrl, mBorder, preMultiplyOnLoad, synchronousLoading);
82 const NPatchData* data;
83 if(mLoader.GetNPatchData(mId, data) && data->GetLoadingState() == NPatchData::LoadingState::LOAD_COMPLETE)
85 EnablePreMultipliedAlpha(data->IsPreMultiplied());
89 if(mAuxiliaryTextureId == TextureManager::INVALID_TEXTURE_ID && mAuxiliaryUrl.IsValid() && (mAuxiliaryUrl.IsLocalResource() || mAuxiliaryUrl.IsBufferResource()))
91 auto preMultiplyOnLoad = IsPreMultipliedAlphaEnabled() && !mImpl->mCustomShader
92 ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
93 : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
95 TextureManager::MaskingDataPointer maskingDataPtr = nullptr;
96 ImageAtlasManagerPtr imageAtlasManagerPtr = nullptr;
98 bool atlasing = false;
99 auto atlasRect = Vector4::ZERO;
100 auto atlasRectSize = Dali::ImageDimensions();
102 bool loadingStatus = false;
104 // Load the auxiliary image
105 mAuxiliaryTextureSet = textureManager.LoadTexture(mAuxiliaryUrl, Dali::ImageDimensions(), FittingMode::DEFAULT, SamplingMode::BOX_THEN_LINEAR, maskingDataPtr, synchronousLoading, mAuxiliaryTextureId, atlasRect, atlasRectSize, atlasing, loadingStatus, this, nullptr, imageAtlasManagerPtr, true, TextureManager::ReloadPolicy::CACHED, preMultiplyOnLoad);
107 if(mAuxiliaryTextureSet)
109 Sampler sampler = Sampler::New();
110 sampler.SetWrapMode(WrapMode::DEFAULT, WrapMode::DEFAULT);
111 mAuxiliaryTextureSet.SetSampler(0u, sampler);
114 // If synchronousLoading is true, we can check the auxiliaryResource's status now.
115 if(synchronousLoading)
117 mAuxiliaryResourceStatus = (mAuxiliaryTextureSet && mAuxiliaryTextureSet.GetTextureCount() > 0u) ? Toolkit::Visual::ResourceStatus::READY : Toolkit::Visual::ResourceStatus::FAILED;
122 void NPatchVisual::GetNaturalSize(Vector2& naturalSize)
127 // load now if not already loaded
128 const NPatchData* data;
129 if(mLoader.GetNPatchData(mId, data) && data->GetLoadingState() != NPatchData::LoadingState::LOADING)
131 naturalSize.x = data->GetCroppedWidth();
132 naturalSize.y = data->GetCroppedHeight();
136 if(mImageUrl.IsValid())
138 ImageDimensions dimensions = Dali::GetOriginalImageSize(mImageUrl.GetUrl());
139 if(dimensions != ImageDimensions(0, 0))
141 naturalSize.x = dimensions.GetWidth();
142 naturalSize.y = dimensions.GetHeight();
147 if(mAuxiliaryTextureSet && mAuxiliaryTextureSet.GetTextureCount() > 0u)
149 naturalSize.x = std::max(naturalSize.x, float(mAuxiliaryTextureSet.GetTexture(0u).GetWidth()));
150 naturalSize.y = std::max(naturalSize.y, float(mAuxiliaryTextureSet.GetTexture(0u).GetHeight()));
154 void NPatchVisual::DoSetProperties(const Property::Map& propertyMap)
156 // URL is already passed in via constructor
158 Property::Value* borderOnlyValue = propertyMap.Find(Toolkit::ImageVisual::Property::BORDER_ONLY, BORDER_ONLY);
161 borderOnlyValue->Get(mBorderOnly);
164 Property::Value* borderValue = propertyMap.Find(Toolkit::ImageVisual::Property::BORDER, BORDER);
165 if(borderValue && !borderValue->Get(mBorder)) // If value exists and is rect, just set mBorder
167 // Not a rect so try vector4
169 if(borderValue->Get(border))
171 mBorder.left = static_cast<int>(border.x);
172 mBorder.right = static_cast<int>(border.y);
173 mBorder.bottom = static_cast<int>(border.z);
174 mBorder.top = static_cast<int>(border.w);
178 Property::Value* auxImage = propertyMap.Find(Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE, AUXILIARY_IMAGE_NAME);
182 if(auxImage->Get(url))
188 Property::Value* auxImageAlpha = propertyMap.Find(Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA, AUXILIARY_IMAGE_ALPHA_NAME);
191 auxImageAlpha->Get(mAuxiliaryImageAlpha);
194 Property::Value* synchronousLoading = propertyMap.Find(Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, SYNCHRONOUS_LOADING);
195 if(synchronousLoading)
198 synchronousLoading->Get(sync);
201 mImpl->mFlags |= Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
205 mImpl->mFlags &= ~Impl::IS_SYNCHRONOUS_RESOURCE_LOADING;
209 Property::Value* releasePolicy = propertyMap.Find(Toolkit::ImageVisual::Property::RELEASE_POLICY, RELEASE_POLICY_NAME);
212 releasePolicy->Get(mReleasePolicy);
216 void NPatchVisual::DoSetOnScene(Actor& actor)
218 // load when first go on stage
221 // Set mPlacementActor now, because some case, LoadImages can use this information in LoadComplete API.
222 // at this case, we try to SetResouce to mPlaceActor twice. so, we should avoid that case.
223 mPlacementActor = actor;
225 const NPatchData* data;
226 if(mImpl->mRenderer && mLoader.GetNPatchData(mId, data) && data->GetLoadingState() != NPatchData::LoadingState::LOADING)
228 // If mAuxiliaryUrl need to be loaded, we should wait it until LoadComplete called.
229 if(!mAuxiliaryUrl.IsValid() || mAuxiliaryResourceStatus != Toolkit::Visual::ResourceStatus::PREPARING)
236 void NPatchVisual::DoSetOffScene(Actor& actor)
238 if(mReleasePolicy == Toolkit::ImageVisual::ReleasePolicy::DETACHED)
240 if(mId != NPatchData::INVALID_NPATCH_DATA_ID)
242 mLoader.Remove(mId, this);
243 mImpl->mResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING;
244 mId = NPatchData::INVALID_NPATCH_DATA_ID;
246 if(mAuxiliaryTextureId != TextureManager::INVALID_TEXTURE_ID)
248 TextureManager& textureManager = mFactoryCache.GetTextureManager();
249 textureManager.RequestRemove(mAuxiliaryTextureId, this);
250 mAuxiliaryTextureId = TextureManager::INVALID_TEXTURE_ID;
251 mAuxiliaryResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING;
252 mAuxiliaryTextureSet.Reset();
256 actor.RemoveRenderer(mImpl->mRenderer);
257 mPlacementActor.Reset();
260 void NPatchVisual::OnSetTransform()
264 mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
268 void NPatchVisual::DoCreatePropertyMap(Property::Map& map) const
271 bool sync = IsSynchronousLoadingRequired();
272 map.Insert(Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, sync);
273 map.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::N_PATCH);
274 map.Insert(Toolkit::ImageVisual::Property::URL, mImageUrl.GetUrl());
275 map.Insert(Toolkit::ImageVisual::Property::BORDER_ONLY, mBorderOnly);
276 map.Insert(Toolkit::ImageVisual::Property::BORDER, mBorder);
277 map.Insert(Toolkit::ImageVisual::Property::RELEASE_POLICY, mReleasePolicy);
279 if(mAuxiliaryUrl.IsValid())
281 map.Insert(Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE, mAuxiliaryUrl.GetUrl());
282 map.Insert(Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA, mAuxiliaryImageAlpha);
286 void NPatchVisual::DoCreateInstancePropertyMap(Property::Map& map) const
288 if(mAuxiliaryUrl.IsValid())
290 map.Insert(Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE, mAuxiliaryUrl.GetUrl());
291 map.Insert(Toolkit::DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA, mAuxiliaryImageAlpha);
295 NPatchVisual::NPatchVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory)
296 : Visual::Base(factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::N_PATCH),
298 mLoader(factoryCache.GetNPatchLoader()),
299 mImageVisualShaderFactory(shaderFactory),
302 mId(NPatchData::INVALID_NPATCH_DATA_ID),
303 mAuxiliaryTextureSet(),
304 mAuxiliaryTextureId(TextureManager::INVALID_TEXTURE_ID),
305 mAuxiliaryResourceStatus(Toolkit::Visual::ResourceStatus::PREPARING),
308 mAuxiliaryImageAlpha(0.0f),
309 mReleasePolicy(Toolkit::ImageVisual::ReleasePolicy::DETACHED)
311 EnablePreMultipliedAlpha(mFactoryCache.GetPreMultiplyOnLoad());
314 NPatchVisual::~NPatchVisual()
316 if(Stage::IsInstalled())
318 if(mReleasePolicy != Toolkit::ImageVisual::ReleasePolicy::NEVER)
320 if(mId != NPatchData::INVALID_NPATCH_DATA_ID)
322 mLoader.Remove(mId, this);
323 mId = NPatchData::INVALID_NPATCH_DATA_ID;
325 if(mAuxiliaryTextureId != TextureManager::INVALID_TEXTURE_ID)
327 TextureManager& textureManager = mFactoryCache.GetTextureManager();
329 textureManager.RequestRemove(mAuxiliaryTextureId, this);
330 mAuxiliaryTextureId = TextureManager::INVALID_TEXTURE_ID;
331 mAuxiliaryTextureSet.Reset();
337 void NPatchVisual::OnInitialize()
339 // Get basic geometry and shader
340 Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
341 Shader shader = mImageVisualShaderFactory.GetShader(
343 ImageVisualShaderFeature::FeatureBuilder());
345 mImpl->mRenderer = VisualRenderer::New(geometry, shader);
346 mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
348 //Register transform properties
349 mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
352 Geometry NPatchVisual::CreateGeometry()
355 const NPatchData* data;
356 if(mLoader.GetNPatchData(mId, data) && data->GetLoadingState() == NPatchData::LoadingState::LOAD_COMPLETE)
358 if(data->GetStretchPixelsX().Size() == 1 && data->GetStretchPixelsY().Size() == 1)
360 if(DALI_UNLIKELY(mBorderOnly))
362 geometry = GetNinePatchGeometry(VisualFactoryCache::NINE_PATCH_BORDER_GEOMETRY);
366 if(data->GetRenderingMap())
368 uint32_t elementCount[2];
369 geometry = RenderingAddOn::Get().CreateGeometryGrid(data->GetRenderingMap(), Uint16Pair(3, 3), elementCount);
372 RenderingAddOn::Get().SubmitRenderTask(mImpl->mRenderer, data->GetRenderingMap());
377 geometry = GetNinePatchGeometry(VisualFactoryCache::NINE_PATCH_GEOMETRY);
381 else if(data->GetStretchPixelsX().Size() > 0 || data->GetStretchPixelsY().Size() > 0)
383 Uint16Pair gridSize(2 * data->GetStretchPixelsX().Size() + 1, 2 * data->GetStretchPixelsY().Size() + 1);
384 if(!data->GetRenderingMap())
386 geometry = !mBorderOnly ? NPatchHelper::CreateGridGeometry(gridSize) : NPatchHelper::CreateBorderGeometry(gridSize);
390 uint32_t elementCount[2];
391 geometry = !mBorderOnly ? RenderingAddOn::Get().CreateGeometryGrid(data->GetRenderingMap(), gridSize, elementCount) : NPatchHelper::CreateBorderGeometry(gridSize);
394 RenderingAddOn::Get().SubmitRenderTask(mImpl->mRenderer, data->GetRenderingMap());
401 // no N patch data so use default geometry
402 geometry = GetNinePatchGeometry(VisualFactoryCache::NINE_PATCH_GEOMETRY);
407 Shader NPatchVisual::CreateShader()
410 const NPatchData* data;
411 // 0 is either no data (load failed?) or no stretch regions on image
412 // for both cases we use the default shader
413 NPatchUtility::StretchRanges::SizeType xStretchCount = 0;
414 NPatchUtility::StretchRanges::SizeType yStretchCount = 0;
416 auto fragmentShader = mAuxiliaryResourceStatus == Toolkit::Visual::ResourceStatus::READY ? SHADER_NPATCH_VISUAL_MASK_SHADER_FRAG
417 : SHADER_NPATCH_VISUAL_SHADER_FRAG;
418 auto shaderType = mAuxiliaryResourceStatus == Toolkit::Visual::ResourceStatus::READY ? VisualFactoryCache::NINE_PATCH_MASK_SHADER
419 : VisualFactoryCache::NINE_PATCH_SHADER;
421 // ask loader for the regions
422 if(mLoader.GetNPatchData(mId, data))
424 xStretchCount = data->GetStretchPixelsX().Count();
425 yStretchCount = data->GetStretchPixelsY().Count();
428 if(DALI_LIKELY(!mImpl->mCustomShader))
430 if(DALI_LIKELY((xStretchCount == 1 && yStretchCount == 1) ||
431 (xStretchCount == 0 && yStretchCount == 0)))
433 shader = mFactoryCache.GetShader(shaderType);
434 if(DALI_UNLIKELY(!shader))
436 shader = Shader::New(SHADER_NPATCH_VISUAL_3X3_SHADER_VERT, fragmentShader);
437 // Only cache vanilla 9 patch shaders
438 mFactoryCache.SaveShader(shaderType, shader);
441 else if(xStretchCount > 0 || yStretchCount > 0)
443 std::stringstream vertexShader;
444 vertexShader << "#define FACTOR_SIZE_X " << xStretchCount + 2 << "\n"
445 << "#define FACTOR_SIZE_Y " << yStretchCount + 2 << "\n"
446 << SHADER_NPATCH_VISUAL_SHADER_VERT;
448 shader = Shader::New(vertexShader.str(), fragmentShader);
453 Dali::Shader::Hint::Value hints = Dali::Shader::Hint::NONE;
455 if(!mImpl->mCustomShader->mFragmentShader.empty())
457 fragmentShader = mImpl->mCustomShader->mFragmentShader.c_str();
459 hints = mImpl->mCustomShader->mHints;
461 /* Apply Custom Vertex Shader only if image is 9-patch */
462 if((xStretchCount == 1 && yStretchCount == 1) ||
463 (xStretchCount == 0 && yStretchCount == 0))
465 const char* vertexShader = SHADER_NPATCH_VISUAL_3X3_SHADER_VERT.data();
467 if(!mImpl->mCustomShader->mVertexShader.empty())
469 vertexShader = mImpl->mCustomShader->mVertexShader.c_str();
471 shader = Shader::New(vertexShader, fragmentShader, hints);
473 else if(xStretchCount > 0 || yStretchCount > 0)
475 std::stringstream vertexShader;
476 vertexShader << "#define FACTOR_SIZE_X " << xStretchCount + 2 << "\n"
477 << "#define FACTOR_SIZE_Y " << yStretchCount + 2 << "\n"
478 << SHADER_NPATCH_VISUAL_SHADER_VERT;
480 shader = Shader::New(vertexShader.str(), fragmentShader, hints);
487 void NPatchVisual::ApplyTextureAndUniforms()
489 const NPatchData* data;
490 TextureSet textureSet;
492 if(mLoader.GetNPatchData(mId, data) && data->GetLoadingState() == NPatchData::LoadingState::LOAD_COMPLETE)
494 textureSet = data->GetTextures();
495 NPatchHelper::ApplyTextureAndUniforms(mImpl->mRenderer, data);
497 if(mAuxiliaryResourceStatus == Toolkit::Visual::ResourceStatus::READY)
499 DALI_ASSERT_ALWAYS(mAuxiliaryTextureId != TextureManager::INVALID_TEXTURE_ID);
500 DALI_ASSERT_ALWAYS(mAuxiliaryTextureSet && mAuxiliaryTextureSet.GetTextureCount() > 0u);
502 // TODO : This code exist due to the texture cache manager hold TextureSet, not Texture.
503 // If we call textureSet.SetTexture(1, texture) directly, the cached TextureSet also be changed.
504 // We should make pass utc-Dali-VisualFactory.cpp UtcDaliNPatchVisualAuxiliaryImage02().
505 TextureSet tempTextureSet = TextureSet::New();
506 tempTextureSet.SetTexture(0, textureSet.GetTexture(0));
507 tempTextureSet.SetTexture(1, mAuxiliaryTextureSet.GetTexture(0));
508 textureSet = tempTextureSet;
510 mImpl->mRenderer.RegisterProperty(DevelImageVisual::Property::AUXILIARY_IMAGE_ALPHA,
511 AUXILIARY_IMAGE_ALPHA_NAME,
512 mAuxiliaryImageAlpha);
514 mImpl->mRenderer.SetTextures(textureSet);
518 DALI_LOG_ERROR("The N patch image '%s' is not a valid N patch image\n", mImageUrl.GetUrl().c_str());
519 Actor actor = mPlacementActor.GetHandle();
520 Vector2 imageSize = Vector2::ZERO;
523 imageSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector2>();
525 mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize, false);
528 // Register transform properties
529 mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
532 Geometry NPatchVisual::GetNinePatchGeometry(VisualFactoryCache::GeometryType subType)
534 Geometry geometry = mFactoryCache.GetGeometry(subType);
537 if(DALI_LIKELY(VisualFactoryCache::NINE_PATCH_GEOMETRY == subType))
539 geometry = NPatchHelper::CreateGridGeometry(Uint16Pair(3, 3));
541 else if(VisualFactoryCache::NINE_PATCH_BORDER_GEOMETRY == subType)
543 geometry = NPatchHelper::CreateBorderGeometry(Uint16Pair(3, 3));
545 mFactoryCache.SaveGeometry(subType, geometry);
550 void NPatchVisual::SetResource()
552 const NPatchData* data;
553 if(mImpl->mRenderer && mLoader.GetNPatchData(mId, data))
555 Geometry geometry = CreateGeometry();
556 Shader shader = CreateShader();
558 mImpl->mRenderer.SetGeometry(geometry);
559 mImpl->mRenderer.SetShader(shader);
561 if(RenderingAddOn::Get().IsValid())
563 RenderingAddOn::Get().SubmitRenderTask(mImpl->mRenderer, data->GetRenderingMap());
565 Actor actor = mPlacementActor.GetHandle();
568 ApplyTextureAndUniforms();
569 actor.AddRenderer(mImpl->mRenderer);
570 mPlacementActor.Reset();
573 // npatch loaded and ready to display
574 if(data->GetLoadingState() != NPatchData::LoadingState::LOAD_COMPLETE)
576 ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
580 ResourceReady(Toolkit::Visual::ResourceStatus::READY);
585 void NPatchVisual::LoadComplete(bool loadSuccess, TextureInformation textureInformation)
587 if(textureInformation.url.length() > 0) // For the Url.
589 if(DALI_UNLIKELY(mId == NPatchData::INVALID_NPATCH_DATA_ID))
591 // Special case when mLoader.Load call LoadComplete function before mId setup.
592 // We can overwrite mId.
593 mId = static_cast<NPatchData::NPatchDataId>(textureInformation.textureId);
597 EnablePreMultipliedAlpha(textureInformation.preMultiplied);
600 else // For the AuxiliaryUrl
602 if(DALI_UNLIKELY(mAuxiliaryTextureId == TextureManager::INVALID_TEXTURE_ID))
604 // Special case when TextureManager.LoadTexture call LoadComplete function before mAuxiliaryTextureId setup.
605 // We can overwrite mAuxiliaryTextureId.
606 mAuxiliaryTextureId = textureInformation.textureId;
610 mAuxiliaryTextureSet = textureInformation.textureSet;
611 if(mAuxiliaryTextureSet)
613 Sampler sampler = Sampler::New();
614 sampler.SetWrapMode(WrapMode::DEFAULT, WrapMode::DEFAULT);
615 mAuxiliaryTextureSet.SetSampler(0u, sampler);
618 mAuxiliaryResourceStatus = Toolkit::Visual::ResourceStatus::READY;
622 mAuxiliaryResourceStatus = Toolkit::Visual::ResourceStatus::FAILED;
626 // If auxiliaryUrl didn't required OR auxiliaryUrl load done.
627 if(!mAuxiliaryUrl.IsValid() || mAuxiliaryResourceStatus != Toolkit::Visual::ResourceStatus::PREPARING)
629 const NPatchData* data;
630 // and.. If Url loading done.
631 if(mImpl->mRenderer && mLoader.GetNPatchData(mId, data) && data->GetLoadingState() != NPatchData::LoadingState::LOADING)
638 } // namespace Internal
640 } // namespace Toolkit