From: Javon Prince Date: Thu, 6 Mar 2014 11:05:15 +0000 (+0000) Subject: Clamp text shadow offset to limit clipping and/or bleeding of the shadow X-Git-Tag: dali-2014-wk16-release~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22a6fbaef7bc66ccc054f3ee1895f63e24f230e0;p=platform%2Fcore%2Fuifw%2Fdali-core.git Clamp text shadow offset to limit clipping and/or bleeding of the shadow [Issue#] P140304-04522 [Problem] If the shadow offset value is too large artifacts can be seen. [Cause] Range of values is relative to the font point size. [Solution] Clamp the shadow offset value internally. Change-Id: Idb26ac962b08fc302988d1ea101962e637ed1e44 Signed-off-by: Paul Wisbey --- diff --git a/dali/internal/event/actor-attachments/text-attachment-impl.cpp b/dali/internal/event/actor-attachments/text-attachment-impl.cpp index e9b4389..5374c7d 100644 --- a/dali/internal/event/actor-attachments/text-attachment-impl.cpp +++ b/dali/internal/event/actor-attachments/text-attachment-impl.cpp @@ -291,11 +291,15 @@ void TextAttachment::SetShadow(bool enable, const Vector4& color, const Vector2& const float unitPointSize( 64.0f ); const float unitsToPixels( mFont->GetUnitsToPixels()); + const float fontPointSize( mFont->GetPointSize() ); float shadowSize( (size * 0.25f) / unitsToPixels ); - Vector2 shadowOffset( offset * ( unitPointSize / mFont->GetPointSize() ) ); - + Vector2 shadowOffset( offset ); + Vector2 maxOffset( fontPointSize / 4.5f, fontPointSize / 4.5f ); + shadowOffset = Min( shadowOffset, maxOffset ); + shadowOffset = Max( shadowOffset, -maxOffset ); + shadowOffset *= unitPointSize / fontPointSize; SetDropShadowMessage( mStage->GetUpdateInterface(), *mSceneObject, enable, color, shadowOffset, shadowSize ); } }