X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fimage%2Fimage-visual.cpp;h=0cd4c1bf58d092550dc5e8662548f0a8bb9e6c52;hp=22a54e636659941914f2698f6a57ae9734c0070a;hb=dbc35ad10b31e70a99ef60c23fb0f5248a8ed271;hpb=3b0dbb53f9e300e1dfc642d7040cf955b9c4b064 diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index 22a54e6..0cd4c1b 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -916,35 +916,38 @@ Shader ImageVisual::GetShader() { Shader shader; - std::string vertexShader; - bool usesWholeTexture = true; + std::string_view vertexShaderView; + bool usesWholeTexture = true; if(mImpl->mCustomShader && !mImpl->mCustomShader->mVertexShader.empty()) { - vertexShader = mImpl->mCustomShader->mVertexShader; + vertexShaderView = mImpl->mCustomShader->mVertexShader; usesWholeTexture = false; // Impossible to tell. } else { - vertexShader = mImageVisualShaderFactory.GetVertexShaderSource().data(); + vertexShaderView = mImageVisualShaderFactory.GetVertexShaderSource(); } - std::string fragmentShader; + std::string_view fragmentShaderView; if(mImpl->mCustomShader && !mImpl->mCustomShader->mFragmentShader.empty()) { - fragmentShader = mImpl->mCustomShader->mFragmentShader; + fragmentShaderView = mImpl->mCustomShader->mFragmentShader; } else { - fragmentShader = mImageVisualShaderFactory.GetFragmentShaderSource().data(); + fragmentShaderView = mImageVisualShaderFactory.GetFragmentShaderSource(); } // If the texture is native, we may need to change prefix and sampler in // the fragment shader bool modifiedFragmentShader = false; + std::string fragmentShaderString; if(mTextures && DevelTexture::IsNative(mTextures.GetTexture(0))) { - Texture nativeTexture = mTextures.GetTexture(0); - modifiedFragmentShader = DevelTexture::ApplyNativeFragmentShader(nativeTexture, fragmentShader); + Texture nativeTexture = mTextures.GetTexture(0); + fragmentShaderString = std::string(fragmentShaderView); + modifiedFragmentShader = DevelTexture::ApplyNativeFragmentShader(nativeTexture, fragmentShaderString); + fragmentShaderView = fragmentShaderString; } const bool useStandardShader = !mImpl->mCustomShader && !modifiedFragmentShader; @@ -955,26 +958,26 @@ Shader ImageVisual::GetShader() mFactoryCache, mImpl->mFlags & Impl::IS_ATLASING_APPLIED, mWrapModeU <= WrapMode::CLAMP_TO_EDGE && mWrapModeV <= WrapMode::CLAMP_TO_EDGE, - IsRoundedCornerRequired()); + IsRoundedCornerRequired() ); } else if(mImpl->mCustomShader) { - shader = Shader::New(vertexShader, fragmentShader, mImpl->mCustomShader->mHints); + shader = Shader::New(vertexShaderView, fragmentShaderView, mImpl->mCustomShader->mHints); } else { - shader = Shader::New(vertexShader, fragmentShader); + shader = Shader::New(vertexShaderView, fragmentShaderView); } if(usesWholeTexture) { - shader.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT); + shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT ); } // Set pixel align off as default. // ToDo: Pixel align causes issues such as rattling image animation. // We should trun it off until issues are resolved - shader.RegisterProperty(PIXEL_ALIGNED_UNIFORM_NAME, PIXEL_ALIGN_OFF); + shader.RegisterProperty( PIXEL_ALIGNED_UNIFORM_NAME, PIXEL_ALIGN_OFF ); return shader; }