X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-item.cpp;h=d47f808abe108b9e32ef548e3fa0761d75e70c84;hb=cd0ce6e412df8961b1a5e28b496369fa49fd72d7;hp=ad024e82571ef7ca2da8a5a340d0ebe9e7d042b2;hpb=c44a118601cabe32b8195558d719b80a6c8efb2a;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/common/render-item.cpp b/dali/internal/render/common/render-item.cpp index ad024e8..d47f808 100644 --- a/dali/internal/render/common/render-item.cpp +++ b/dali/internal/render/common/render-item.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -101,13 +101,19 @@ ClippingBox RenderItem::CalculateViewportSpaceAABB( const int viewportWidth, con // So without doing min/max branching, we can fetch the min/max values of all the remaining X/Y coords from this one index. Vector4 aabb( corners[smallestX].x, corners[( smallestX + 3u ) % 4].y, corners[( smallestX + 2u ) % 4].x, corners[( smallestX + 1u ) % 4].y ); - // Convert maximums to extents. - aabb.z -= aabb.x; - aabb.w -= aabb.y; - // Return the AABB in screen-space pixels (x, y, width, height). // Note: This is a algebraic simplification of: ( viewport.x - aabb.width ) / 2 - ( ( aabb.width / 2 ) + aabb.x ) per axis. - return ClippingBox( ( viewportWidth / 2 ) - aabb.z - aabb.x, ( viewportHeight / 2 ) - aabb.w - aabb.y, aabb.z, aabb.w ); + Vector4 aabbInScreen( static_cast( viewportWidth ) * 0.5f - aabb.z, + static_cast( viewportHeight ) * 0.5f - aabb.w, + static_cast( viewportWidth ) * 0.5f - aabb.x, + static_cast( viewportHeight ) * 0.5f - aabb.y ); + + int x = static_cast< int >( roundf( aabbInScreen.x ) ); + int y = static_cast< int >( roundf( aabbInScreen.y ) ); + int z = static_cast< int >( roundf( aabbInScreen.z ) ); + int w = static_cast< int >( roundf( aabbInScreen.w ) ); + + return ClippingBox( x, y, z - x, w - y ); } void RenderItem::operator delete( void* ptr )