X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Ftext%2Ftext-visual.h;h=e6c0ab88da1f22f43294a528ab068181f9d0038c;hp=c81fbcee1ebef46704546831cb2dd8f3aaae032f;hb=HEAD;hpb=020b07151378db83ab8e12eb3e2d51db0ed69996 diff --git a/dali-toolkit/internal/visuals/text/text-visual.h b/dali-toolkit/internal/visuals/text/text-visual.h index c81fbce..0d5e5f8 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.h +++ b/dali-toolkit/internal/visuals/text/text-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,6 +116,16 @@ public: }; /** + * @brief Set the text to be always rendered + * @param[in] visual The text visual. + * @param[in] requireRender Whether to text always rendered. + */ + static void SetRequireRender(Toolkit::Visual::Base visual, bool requireRender) + { + GetVisualObject(visual).SetRequireRender(requireRender); + }; + + /** * @brief Instantly updates the renderer * @param[in] visual The text visual. */ @@ -194,47 +204,31 @@ protected: private: struct TilingInfo { - unsigned char* textBuffer; - unsigned char* styleBuffer; - unsigned char* overlayStyleBuffer; - unsigned char* maskBuffer; - int width; - int height; - Pixel::Format textPixelFormat; - int offsetPosition; - Vector2 offSet; - - TilingInfo(int width, int height, Pixel::Format textPixelFormat) - : textBuffer(NULL), - styleBuffer(NULL), - overlayStyleBuffer(NULL), - maskBuffer(NULL), + PixelData textPixelData; + PixelData stylePixelData; + PixelData overlayStylePixelData; + PixelData maskPixelData; + int32_t width; + int32_t height; + Pixel::Format textPixelFormat; + uint32_t offsetHeight; + Vector2 transformOffset; + + TilingInfo(int32_t width, int32_t height, Pixel::Format textPixelFormat) + : textPixelData(), + stylePixelData(), + overlayStylePixelData(), + maskPixelData(), width(width), height(height), textPixelFormat(textPixelFormat), - offsetPosition(0), - offSet(0.f, 0.f) + offsetHeight(0u), + transformOffset(0.f, 0.f) { } ~TilingInfo() { - if(textBuffer) - { - free(textBuffer); - } - if(styleBuffer) - { - free(styleBuffer); - } - if(overlayStyleBuffer) - { - free(overlayStyleBuffer); - } - if(maskBuffer) - { - free(maskBuffer); - } } }; @@ -255,26 +249,26 @@ private: /** * @brief Removes the text's renderer. */ - void RemoveRenderer(Actor& actor); + void RemoveRenderer(Actor& actor, bool removeDefaultRenderer); /** * @brief Create a texture in textureSet and add it. * @param[in] textureSet The textureSet to which the texture will be added. - * @param[in] data The PixelData to be uploaded to texture + * @param[in] data The PixelData to be uploaded to texture. * @param[in] sampler The sampler. * @param[in] textureSetIndex The Index of TextureSet. */ void AddTexture(TextureSet& textureSet, PixelData& data, Sampler& sampler, unsigned int textureSetIndex); /** - * @brief Convert the buffer to pixelData. - * @param[in] buffer The Buffer to be converted to pixelData. - * @param[in] width The width of pixel data. - * @param[in] height The height of pixel data. - * @param[in] offsetPosition The The buffer's start position. - * @param[in] textPixelFormat The PixelForma of text. + * @brief Create a texture in textureSet and add it. + * @param[in] textureSet The textureSet to which the texture will be added. + * @param[in] tilingInfo The tiling infomation to be uploaded to texture. + * @param[in] data The PixelData to be uploaded to texture. + * @param[in] sampler The sampler. + * @param[in] textureSetIndex The Index of TextureSet. */ - PixelData ConvertToPixelData(unsigned char* buffer, int width, int height, int offsetPosition, const Pixel::Format textPixelFormat); + void AddTilingTexture(TextureSet& textureSet, TilingInfo& tilingInfo, PixelData& data, Sampler& sampler, unsigned int textureSetIndex); /** * @brief Create the text's texture. It will use cached shader feature for text visual. @@ -309,6 +303,12 @@ private: Shader GetTextShader(VisualFactoryCache& factoryCache, const TextVisualShaderFeature::FeatureBuilder& featureBuilder); /** + * @brief Set the text to be always rendered + * @param[in] requireRender Whether to text always rendered. + */ + void SetRequireRender(bool requireRender); + + /** * @brief Retrieve the TextVisual object. * @param[in] visual A handle to the TextVisual * @return The TextVisual object @@ -331,9 +331,12 @@ private: WeakHandle mControl; ///< The control where the renderer is added. Constraint mColorConstraint{}; ///< Color constraint Constraint mOpacityConstraint{}; ///< Opacity constraint + Property::Index mHasMultipleTextColorsIndex; ///< The index of uHasMultipleTextColors proeprty. Property::Index mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control. Property::Index mTextColorAnimatableIndex; ///< The index of uTextColorAnimatable property. + Property::Index mTextRequireRenderPropertyIndex; ///< The index of requireRender property. bool mRendererUpdateNeeded : 1; ///< The flag to indicate whether the renderer needs to be updated. + bool mTextRequireRender : 1; ///< The flag to indicate whether the text needs to be rendered. RendererContainer mRendererList; };