X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fx11%2Fnative-image-source-impl-x.cpp;h=45562ee9b36adc86ec5a99ff62ef21697df22164;hb=0a3bcdabd8633cf86782d5d1978a458f1f11548f;hp=b58057b1209f222ddf3d5b89575f13eca4be5dea;hpb=ae3c1c63437003630d7c07caa7b27f8c98dd4ad3;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/x11/native-image-source-impl-x.cpp b/adaptors/x11/native-image-source-impl-x.cpp old mode 100644 new mode 100755 index b58057b..45562ee --- a/adaptors/x11/native-image-source-impl-x.cpp +++ b/adaptors/x11/native-image-source-impl-x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -61,7 +61,7 @@ namespace { if( !XDestroyImage(mXImage) ) { - DALI_ASSERT_DEBUG("XImage deallocation failure"); + DALI_LOG_ERROR("XImage deallocation failure"); } } } @@ -166,7 +166,7 @@ bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& DALI_ASSERT_DEBUG(pXImage && "XImage (from pixmap) could not be retrieved from the server"); if(!pXImage) { - DALI_LOG_ERROR("Could not retrieve Ximage."); + DALI_LOG_ERROR("Could not retrieve Ximage.\n"); } else { @@ -211,7 +211,7 @@ bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& pixbuf.resize(width*height*4); unsigned * bufPtr = reinterpret_cast(&pixbuf[0]); const unsigned xDataLineSkip = pXImage->bytes_per_line; - const size_t copy_count = width * 4; + const size_t copy_count = static_cast< size_t >( width ) * 4; pixelFormat = Pixel::BGRA8888; for(unsigned y = height-1; y < height; --y, bufPtr += width) @@ -229,7 +229,7 @@ bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& } else { - DALI_LOG_ERROR("XImage has null data pointer."); + DALI_LOG_ERROR("XImage has null data pointer.\n"); } break; } @@ -242,13 +242,13 @@ bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& } default: { - DALI_LOG_WARNING("Pixmap has unsupported bit-depth for getting pixels: %u", pXImage->depth); + DALI_LOG_WARNING("Pixmap has unsupported bit-depth for getting pixels: %u\n", pXImage->depth); } } } if(!success) { - DALI_LOG_ERROR("Failed to get pixels from NativeImageSource."); + DALI_LOG_ERROR("Failed to get pixels from NativeImageSource.\n"); pixbuf.resize(0); width = 0; height = 0; @@ -273,6 +273,25 @@ bool NativeImageSource::EncodeToFile(const std::string& filename) const return false; } +void NativeImageSource::SetSource( Any source ) +{ + mPixmap = GetPixmapFromAny( source ); + + if (mPixmap) + { + // we don't own the pixmap + mOwnPixmap = false; + + // find out the pixmap width / height and color depth + GetPixmapDetails(); + } +} + +bool NativeImageSource::IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth ) +{ + return true; +} + bool NativeImageSource::GlExtensionCreate() { // if the image existed previously delete it. @@ -304,6 +323,10 @@ unsigned int NativeImageSource::TargetTexture() return 0; } +void NativeImageSource::PrepareTexture() +{ +} + int NativeImageSource::GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) const { switch (depth) @@ -364,7 +387,7 @@ void NativeImageSource::GetPixmapDetails() int x, y; // get the width, height and depth - ecore_x_pixmap_geometry_get(mPixmap, &x, &y, (int*)&mWidth, (int*)&mHeight); + ecore_x_pixmap_geometry_get( mPixmap, &x, &y, reinterpret_cast< int* >( &mWidth ), reinterpret_cast< int* >( &mHeight ) ); // set whether blending is required according to pixel format based on the depth /* default pixel format is RGB888