X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Frenderers%2Frender-property-buffer.cpp;h=26d86c1db632126cabfd7215ac92669d94497505;hb=88c06f8cdea30606c625dd3a7aecb0df8652af72;hp=d4fe4189c493640f3cf9afbdbef6eeb07ff16b06;hpb=d1a5064d7469bd814913ad303fd676f21bdfbae2;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/renderers/render-property-buffer.cpp b/dali/internal/render/renderers/render-property-buffer.cpp index d4fe418..26d86c1 100644 --- a/dali/internal/render/renderers/render-property-buffer.cpp +++ b/dali/internal/render/renderers/render-property-buffer.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #include #include // Dali::Internal::PropertyBuffer @@ -9,7 +25,7 @@ using namespace Dali; using Dali::Property; using Dali::Internal::PropertyImplementationType; -Dali::GLenum GetPropertyImplementationGlType( Property::Type& propertyType ) +Dali::GLenum GetPropertyImplementationGlType( Property::Type propertyType ) { Dali::GLenum type = GL_BYTE; @@ -19,6 +35,7 @@ Dali::GLenum GetPropertyImplementationGlType( Property::Type& propertyType ) case Property::STRING: case Property::ARRAY: case Property::MAP: + case Property::EXTENTS: case Property::RECTANGLE: case Property::ROTATION: { @@ -50,7 +67,7 @@ Dali::GLenum GetPropertyImplementationGlType( Property::Type& propertyType ) return type; } -size_t GetPropertyImplementationGlSize( Property::Type& propertyType ) +size_t GetPropertyImplementationGlSize( Property::Type propertyType ) { size_t size = 1u; @@ -60,6 +77,7 @@ size_t GetPropertyImplementationGlSize( Property::Type& propertyType ) case Property::STRING: case Property::ARRAY: case Property::MAP: + case Property::EXTENTS: case Property::RECTANGLE: case Property::ROTATION: { @@ -118,20 +136,14 @@ void PropertyBuffer::SetFormat( PropertyBuffer::Format* format ) mDataChanged = true; } -void PropertyBuffer::SetData( Dali::Vector* data ) +void PropertyBuffer::SetData( Dali::Vector* data, size_t size ) { mData = data; - mDataChanged = true; -} - -void PropertyBuffer::SetSize( unsigned int size ) -{ mSize = size; mDataChanged = true; } - -bool PropertyBuffer::Update( Context& context, bool isIndexBuffer ) +bool PropertyBuffer::Update( Context& context ) { if( !mData || !mFormat || !mSize ) { @@ -149,23 +161,7 @@ bool PropertyBuffer::Update( Context& context, bool isIndexBuffer ) if ( mGpuBuffer ) { DALI_ASSERT_DEBUG( mSize && "No data in the property buffer!" ); - - const void *data = &((*mData)[0]); - - // Index buffer needs to be unsigned short which is not supported by the property system - Vector ushortData; - if( isIndexBuffer ) - { - ushortData.Resize(mSize); - const unsigned int* unsignedData = static_cast(data); - for( unsigned int i = 0; i < mSize; ++i ) - { - ushortData[i] = unsignedData[i]; - } - data = &(ushortData[0]); - } - - mGpuBuffer->UpdateDataBuffer( GetDataSize(), data, GpuBuffer::STATIC_DRAW ); + mGpuBuffer->UpdateDataBuffer( GetDataSize(), &((*mData)[0]), GpuBuffer::STATIC_DRAW, GpuBuffer::ARRAY_BUFFER ); } mDataChanged = false; @@ -196,16 +192,16 @@ unsigned int PropertyBuffer::EnableVertexAttributes( Context& context, Vectorcomponents[i].size; + const GLint attributeSize = mFormat->components[i].size; size_t attributeOffset = mFormat->components[i].offset; - Property::Type attributeType = mFormat->components[i].type; + const Property::Type attributeType = mFormat->components[i].type; context.VertexAttribPointer( attributeLocation, attributeSize / GetPropertyImplementationGlSize(attributeType), GetPropertyImplementationGlType(attributeType), GL_FALSE, // Not normalized elementSize, - (void*)attributeOffset ); + reinterpret_cast< void* >( attributeOffset ) ); } }