X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Frenderers%2Fgradient%2Fgradient.cpp;h=e070754c6cfbe8118102e94483bb9b3dfc2dacff;hp=d87d1321e85d8293538b0340088601dbfe2547ad;hb=36ac338ff7e9c299ce45818d77aa8f71c63a45aa;hpb=b5eca237428be8e01adaa98457b3cef3695d860d diff --git a/dali-toolkit/internal/controls/renderers/gradient/gradient.cpp b/dali-toolkit/internal/controls/renderers/gradient/gradient.cpp index d87d132..e070754 100644 --- a/dali-toolkit/internal/controls/renderers/gradient/gradient.cpp +++ b/dali-toolkit/internal/controls/renderers/gradient/gradient.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -88,7 +88,7 @@ const Matrix3& Gradient::GetAlignmentTransform() const * If the stops have not covered the whole zero to one range, * the REPEAT spread behaves different from the two others in the lookup texture generation. */ -BufferImage Gradient::GenerateLookupTexture() +Dali::Texture Gradient::GenerateLookupTexture() { std::sort( mGradientStops.Begin(), mGradientStops.End() ); @@ -133,8 +133,11 @@ BufferImage Gradient::GenerateLookupTexture() * Generate the pixels with the color transit from one stop to next. */ unsigned int resolution = EstimateTextureResolution(); - BufferImage texture = BufferImage::New( resolution, 1 ); - PixelBuffer* pixels = texture.GetBuffer(); + + unsigned int bufferSize = resolution * 4u; + unsigned char* pixels = new unsigned char[ bufferSize ]; + PixelData pixelData = PixelData::New( pixels, bufferSize, resolution, 1u, Pixel::RGBA8888, PixelData::DELETE_ARRAY ); + int segmentStart = 0; int segmentEnd = 0; int k = 0; @@ -161,6 +164,9 @@ BufferImage Gradient::GenerateLookupTexture() segmentStart = segmentEnd; } + Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, resolution, 1u ); + texture.Upload( pixelData ); + // remove the stops added temporarily for generating the pixels, as the spread method might get changed later if( tempLastStop ) {