From 3ff14e8d4759a186eafd46a859bfd710e39366cb Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Fri, 13 Nov 2015 15:53:55 +0900 Subject: [PATCH] [3.0] Change PixmapImage class to NativeImageSource class Change-Id: I5cb0a1564f724609f4f89aec340196b09511d299 --- adaptors/common/indicator-buffer.h | 2 +- adaptors/common/indicator-impl.cpp | 8 +- .../adaptor-framework/native-image-source.cpp | 103 +++++++++++++++++++++ .../{pixmap-image.h => native-image-source.h} | 58 ++++++------ .../public-api/adaptor-framework/pixmap-image.cpp | 103 --------------------- adaptors/public-api/dali.h | 2 +- adaptors/public-api/file.list | 4 +- adaptors/wayland/file.list | 2 +- ...impl-wl.cpp => native-image-source-impl-wl.cpp} | 42 ++++----- ...map-image-impl.h => native-image-source-impl.h} | 72 +++++++------- adaptors/x11/file.list | 2 +- ...e-impl-x.cpp => native-image-source-impl-x.cpp} | 46 ++++----- ...map-image-impl.h => native-image-source-impl.h} | 66 ++++++------- automated-tests/src/dali-adaptor/CMakeLists.txt | 2 +- ...mapImage.cpp => utc-Dali-NativeImageSource.cpp} | 8 +- 15 files changed, 255 insertions(+), 265 deletions(-) create mode 100644 adaptors/public-api/adaptor-framework/native-image-source.cpp rename adaptors/public-api/adaptor-framework/{pixmap-image.h => native-image-source.h} (70%) delete mode 100644 adaptors/public-api/adaptor-framework/pixmap-image.cpp rename adaptors/wayland/{pixmap-image-impl-wl.cpp => native-image-source-impl-wl.cpp} (63%) rename adaptors/wayland/{pixmap-image-impl.h => native-image-source-impl.h} (57%) rename adaptors/x11/{pixmap-image-impl-x.cpp => native-image-source-impl-x.cpp} (85%) rename adaptors/x11/{pixmap-image-impl.h => native-image-source-impl.h} (61%) rename automated-tests/src/dali-adaptor/{utc-Dali-PixmapImage.cpp => utc-Dali-NativeImageSource.cpp} (81%) diff --git a/adaptors/common/indicator-buffer.h b/adaptors/common/indicator-buffer.h index 4a43c3d..f32bd32 100644 --- a/adaptors/common/indicator-buffer.h +++ b/adaptors/common/indicator-buffer.h @@ -40,7 +40,7 @@ typedef IntrusivePtr IndicatorBufferPtr; /** * The IndicatorBuffer class uses the best available implementation for rendering indicator data. - * On platforms where EglImage is available it uses either SharedGlBuffer or PixmapImage, on older + * On platforms where EglImage is available it uses either SharedGlBuffer or NativeImageSource, on older * platforms it falls back to using a bitmap buffer based solution. */ class IndicatorBuffer : public RefObject diff --git a/adaptors/common/indicator-impl.cpp b/adaptors/common/indicator-impl.cpp index 141d78a..23d4b81 100644 --- a/adaptors/common/indicator-impl.cpp +++ b/adaptors/common/indicator-impl.cpp @@ -41,7 +41,7 @@ // INTERNAL INCLUDES #include #include -#include +#include using Dali::Vector4; @@ -931,11 +931,11 @@ bool Indicator::CopyToBuffer( int bufferNumber ) void Indicator::CreateNewPixmapImage() { DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mImageWidth, mImageHeight ); - Dali::PixmapImagePtr pixmapImage = Dali::PixmapImage::New( mPixmap ); + Dali::NativeImageSourcePtr nativeImageSource = Dali::NativeImageSource::New( mPixmap ); - if( pixmapImage ) + if( nativeImageSource ) { - mIndicatorImageActor.SetImage( Dali::NativeImage::New(*pixmapImage) ); + mIndicatorImageActor.SetImage( Dali::NativeImage::New(*nativeImageSource) ); mIndicatorImageActor.SetSize( mImageWidth, mImageHeight ); mIndicatorActor.SetSize( mImageWidth, mImageHeight ); mEventActor.SetSize(mImageWidth, mImageHeight); diff --git a/adaptors/public-api/adaptor-framework/native-image-source.cpp b/adaptors/public-api/adaptor-framework/native-image-source.cpp new file mode 100644 index 0000000..ba9a914 --- /dev/null +++ b/adaptors/public-api/adaptor-framework/native-image-source.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2015 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. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +NativeImageSourcePtr NativeImageSource::New( unsigned int width, unsigned int height, ColorDepth depth ) +{ + Any empty; + NativeImageSourcePtr image = new NativeImageSource( width, height, depth, empty ); + return image; +} + +Any NativeImageSource::GetNativeImageSource() +{ + return mImpl->GetNativeImageSource(); +} + +NativeImageSourcePtr NativeImageSource::New( Any nativeImageSource ) +{ + NativeImageSourcePtr image = new NativeImageSource(0, 0, COLOR_DEPTH_DEFAULT, nativeImageSource); + return image; +} + +bool NativeImageSource::GetPixels( std::vector &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const +{ + return mImpl->GetPixels( pixbuf, width, height, pixelFormat ); +} + +bool NativeImageSource::EncodeToFile(const std::string& filename) const +{ + return mImpl->EncodeToFile(filename); +} + +bool NativeImageSource::GlExtensionCreate() +{ + return mImpl->GlExtensionCreate(); +} + +void NativeImageSource::GlExtensionDestroy() +{ + mImpl->GlExtensionDestroy(); +} + +unsigned int NativeImageSource::TargetTexture() +{ + return mImpl->TargetTexture(); +} + +void NativeImageSource::PrepareTexture() +{ + +} + +unsigned int NativeImageSource::GetWidth() const +{ + return mImpl->GetWidth(); +} + +unsigned int NativeImageSource::GetHeight() const +{ + return mImpl->GetHeight(); +} + +bool NativeImageSource::RequiresBlending() const +{ + return mImpl->RequiresBlending(); +} + +NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource ) +{ + mImpl = Internal::Adaptor::NativeImageSource::New( width, height, depth, nativeImageSource ); +} + +NativeImageSource::~NativeImageSource() +{ + delete mImpl; +} + +} // namespace Dali diff --git a/adaptors/public-api/adaptor-framework/pixmap-image.h b/adaptors/public-api/adaptor-framework/native-image-source.h similarity index 70% rename from adaptors/public-api/adaptor-framework/pixmap-image.h rename to adaptors/public-api/adaptor-framework/native-image-source.h index 8dd3c46..dea2a14 100644 --- a/adaptors/public-api/adaptor-framework/pixmap-image.h +++ b/adaptors/public-api/adaptor-framework/native-image-source.h @@ -1,5 +1,5 @@ -#ifndef __DALI_PIXMAP_IMAGE_H__ -#define __DALI_PIXMAP_IMAGE_H__ +#ifndef __DALI_NATIVE_IMAGE_SOURCE_H__ +#define __DALI_NATIVE_IMAGE_SOURCE_H__ /* * Copyright (c) 2015 Samsung Electronics Co., Ltd. @@ -37,30 +37,30 @@ namespace Internal DALI_INTERNAL { namespace Adaptor { -class PixmapImage; +class NativeImageSource; } } -class PixmapImage; +class NativeImageSource; /** - * @brief Pointer to Dali::PixmapImage. + * @brief Pointer to Dali::NativeImageSource. */ -typedef IntrusivePtr PixmapImagePtr; +typedef IntrusivePtr NativeImageSourcePtr; /** - * @brief Used for displaying native Pixmap images. + * @brief Used for displaying native images. * - * The native pixmap can be created internally or + * The native image source can be created internally or * externally by X11 or ECORE-X11. * * @since DALi 1.1.4 */ -class DALI_IMPORT_API PixmapImage : public NativeImageInterface +class DALI_IMPORT_API NativeImageSource : public NativeImageInterface { public: /** - * @brief When creating a pixmap the color depth has to be specified. + * @brief When creating a native image the color depth has to be specified. */ enum ColorDepth { @@ -72,33 +72,33 @@ public: }; /** - * @brief Create a new PixmapImage. + * @brief Create a new NativeImageSource. * * Depending on hardware the width and height may have to be a power of two. * @param[in] width The width of the image. * @param[in] height The height of the image. - * @param[in] depth color depth of the pixmap + * @param[in] depth color depth of the image. * @return A smart-pointer to a newly allocated image. */ - static PixmapImagePtr New( unsigned int width, unsigned int height, ColorDepth depth ); + static NativeImageSourcePtr New( unsigned int width, unsigned int height, ColorDepth depth ); /** - * @brief Create a new PixmapImage from an existing pixmap. + * @brief Create a new NativeImageSource from an existing native image. * - * @param[in] pixmap must be a X11 pixmap or a Ecore_X_Pixmap + * @param[in] nativeImageSource must be a X11 pixmap or a Ecore_X_Pixmap * @return A smart-pointer to a newly allocated image. */ - static PixmapImagePtr New( Any pixmap ); + static NativeImageSourcePtr New( Any nativeImageSource ); /** - * @brief Retrieve the internal pixmap + * @brief Retrieve the internal native image. * - * @return pixmap any object containing the internal pixmap + * @return Any object containing the internal native image. */ - Any GetPixmap(); + Any GetNativeImageSource(); /** - * @brief Get a copy of the pixels used by PixmapImage. + * @brief Get a copy of the pixels used by NativeImageSource. * * This is only supported for 24 bit RGB and 32 bit RGBA internal formats * (COLOR_DEPTH_24 and COLOR_DEPTH_32). @@ -164,25 +164,25 @@ private: * @brief Private constructor * @param[in] width The width of the image. * @param[in] height The height of the image. - * @param[in] depth color depth of the pixmap - * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @param[in] depth color depth of the image. + * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty */ - DALI_INTERNAL PixmapImage( unsigned int width, unsigned int height, ColorDepth depth, Any pixmap ); + DALI_INTERNAL NativeImageSource( unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource ); /** * @brief A reference counted object may only be deleted by calling Unreference(). * * The implementation should destroy the NativeImage resources. */ - DALI_INTERNAL virtual ~PixmapImage(); + DALI_INTERNAL virtual ~NativeImageSource(); /** * @brief Undefined copy constructor * * This avoids accidental calls to a default copy constructor. - * @param[in] pixmapImage A reference to the object to copy. + * @param[in] nativeImageSource A reference to the object to copy. */ - DALI_INTERNAL PixmapImage( const PixmapImage& pixmapImage ); + DALI_INTERNAL NativeImageSource( const NativeImageSource& nativeImageSource ); /** * @brief Undefined assignment operator. @@ -190,11 +190,11 @@ private: * This avoids accidental calls to a default assignment operator. * @param[in] rhs A reference to the object to copy. */ - DALI_INTERNAL PixmapImage& operator=(const PixmapImage& rhs); + DALI_INTERNAL NativeImageSource& operator=(const NativeImageSource& rhs); private: - Internal::Adaptor::PixmapImage* mImpl; ///< Implementation pointer + Internal::Adaptor::NativeImageSource* mImpl; ///< Implementation pointer }; /** @@ -202,4 +202,4 @@ private: */ } // namespace Dali -#endif // __DALI_PIXMAP_IMAGE_H__ +#endif // __DALI_NATIVE_IMAGE_SOURCE_H__ diff --git a/adaptors/public-api/adaptor-framework/pixmap-image.cpp b/adaptors/public-api/adaptor-framework/pixmap-image.cpp deleted file mode 100644 index 05fe7e8..0000000 --- a/adaptors/public-api/adaptor-framework/pixmap-image.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2015 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. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -PixmapImagePtr PixmapImage::New( unsigned int width, unsigned int height, ColorDepth depth ) -{ - Any empty; - PixmapImagePtr image = new PixmapImage( width, height, depth, empty ); - return image; -} - -Any PixmapImage::GetPixmap() -{ - return mImpl->GetPixmap(); -} - -PixmapImagePtr PixmapImage::New( Any pixmap ) -{ - PixmapImagePtr image = new PixmapImage(0, 0, COLOR_DEPTH_DEFAULT, pixmap); - return image; -} - -bool PixmapImage::GetPixels( std::vector &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const -{ - return mImpl->GetPixels( pixbuf, width, height, pixelFormat ); -} - -bool PixmapImage::EncodeToFile(const std::string& filename) const -{ - return mImpl->EncodeToFile(filename); -} - -bool PixmapImage::GlExtensionCreate() -{ - return mImpl->GlExtensionCreate(); -} - -void PixmapImage::GlExtensionDestroy() -{ - mImpl->GlExtensionDestroy(); -} - -unsigned int PixmapImage::TargetTexture() -{ - return mImpl->TargetTexture(); -} - -void PixmapImage::PrepareTexture() -{ - -} - -unsigned int PixmapImage::GetWidth() const -{ - return mImpl->GetWidth(); -} - -unsigned int PixmapImage::GetHeight() const -{ - return mImpl->GetHeight(); -} - -bool PixmapImage::RequiresBlending() const -{ - return mImpl->RequiresBlending(); -} - -PixmapImage::PixmapImage( unsigned int width, unsigned int height, ColorDepth depth, Any pixmap ) -{ - mImpl = Internal::Adaptor::PixmapImage::New( width, height, depth, pixmap ); -} - -PixmapImage::~PixmapImage() -{ - delete mImpl; -} - -} // namespace Dali diff --git a/adaptors/public-api/dali.h b/adaptors/public-api/dali.h index 8ed599f..240215e 100644 --- a/adaptors/public-api/dali.h +++ b/adaptors/public-api/dali.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #endif //__DALI_H__ diff --git a/adaptors/public-api/file.list b/adaptors/public-api/file.list index 90e1144..dbf643f 100644 --- a/adaptors/public-api/file.list +++ b/adaptors/public-api/file.list @@ -4,7 +4,7 @@ public_api_src_files = \ $(adaptor_public_api_dir)/adaptor-framework/window.cpp \ $(adaptor_public_api_dir)/adaptor-framework/timer.cpp \ $(adaptor_public_api_dir)/adaptor-framework/tts-player.cpp \ - $(adaptor_public_api_dir)/adaptor-framework/pixmap-image.cpp \ + $(adaptor_public_api_dir)/adaptor-framework/native-image-source.cpp \ $(adaptor_public_api_dir)/dali-adaptor-version.cpp @@ -20,7 +20,7 @@ public_api_adaptor_framework_header_files = \ $(adaptor_public_api_dir)/adaptor-framework/style-change.h \ $(adaptor_public_api_dir)/adaptor-framework/timer.h \ $(adaptor_public_api_dir)/adaptor-framework/tts-player.h \ - $(adaptor_public_api_dir)/adaptor-framework/pixmap-image.h \ + $(adaptor_public_api_dir)/adaptor-framework/native-image-source.h \ $(adaptor_public_api_dir)/adaptor-framework/window.h adaptor_dali_header_file = \ diff --git a/adaptors/wayland/file.list b/adaptors/wayland/file.list index f383295..0d66f49 100644 --- a/adaptors/wayland/file.list +++ b/adaptors/wayland/file.list @@ -6,7 +6,7 @@ adaptor_wayland_tizen_internal_src_files = \ $(adaptor_wayland_dir)/display-connection-impl-wl.cpp \ $(adaptor_wayland_dir)/framework-wl.cpp \ $(adaptor_wayland_dir)/imf-manager-impl-wl.cpp \ - $(adaptor_wayland_dir)/pixmap-image-impl-wl.cpp \ + $(adaptor_wayland_dir)/native-image-source-impl-wl.cpp \ $(adaptor_wayland_dir)/virtual-keyboard-impl-wl.cpp \ $(adaptor_wayland_dir)/window-impl-wl.cpp \ $(adaptor_wayland_dir)/event-handler-wl.cpp \ diff --git a/adaptors/wayland/pixmap-image-impl-wl.cpp b/adaptors/wayland/native-image-source-impl-wl.cpp similarity index 63% rename from adaptors/wayland/pixmap-image-impl-wl.cpp rename to adaptors/wayland/native-image-source-impl-wl.cpp index 3ebc0e7..e32aec9 100644 --- a/adaptors/wayland/pixmap-image-impl-wl.cpp +++ b/adaptors/wayland/native-image-source-impl-wl.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "pixmap-image-impl.h" +#include "native-image-source-impl.h" // EXTERNAL INCLUDES #include @@ -41,10 +41,10 @@ namespace Adaptor { using Dali::Integration::PixelBuffer; -PixmapImage* PixmapImage::New(unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Any pixmap ) +NativeImageSource* NativeImageSource::New(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) { - PixmapImage* image = new PixmapImage( width, height, depth, pixmap ); - DALI_ASSERT_DEBUG( image && "PixmapImage allocation failed." ); + NativeImageSource* image = new NativeImageSource( width, height, depth, nativeImageSource ); + DALI_ASSERT_DEBUG( image && "NativeImageSource allocation failed." ); // 2nd phase construction if(image) //< Defensive in case we ever compile without exceptions. @@ -55,7 +55,7 @@ PixmapImage* PixmapImage::New(unsigned int width, unsigned int height, Dali::Pix return image; } -PixmapImage::PixmapImage( unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Any pixmap ) +NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) : mWidth( width ), mHeight( height ), mOwnPixmap( true ), @@ -71,26 +71,26 @@ PixmapImage::PixmapImage( unsigned int width, unsigned int height, Dali::PixmapI DALI_ASSERT_DEBUG( mEglImageExtensions ); } -void PixmapImage::Initialize() +void NativeImageSource::Initialize() { } -PixmapImage::~PixmapImage() +NativeImageSource::~NativeImageSource() { } -Any PixmapImage::GetPixmap() const +Any NativeImageSource::GetNativeImageSource() const { - DALI_ASSERT_ALWAYS( false && "PixmapImage::GetPixmap() is not supported for Wayland." ); + DALI_ASSERT_ALWAYS( false && "NativeImageSource::GetNativeImageSource() is not supported for Wayland." ); return Any(); } -bool PixmapImage::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const +bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const { return false; } -bool PixmapImage::EncodeToFile(const std::string& filename) const +bool NativeImageSource::EncodeToFile(const std::string& filename) const { std::vector< unsigned char > pixbuf; unsigned int width(0), height(0); @@ -103,37 +103,37 @@ bool PixmapImage::EncodeToFile(const std::string& filename) const return false; } -bool PixmapImage::GlExtensionCreate() +bool NativeImageSource::GlExtensionCreate() { return false; } -void PixmapImage::GlExtensionDestroy() +void NativeImageSource::GlExtensionDestroy() { mEglImageExtensions->DestroyImageKHR(mEglImageKHR); mEglImageKHR = NULL; } -unsigned int PixmapImage::TargetTexture() +unsigned int NativeImageSource::TargetTexture() { mEglImageExtensions->TargetTextureKHR(mEglImageKHR); return 0; } -void PixmapImage::SetBlending(Dali::PixmapImage::ColorDepth depth) +void NativeImageSource::SetBlending(Dali::NativeImageSource::ColorDepth depth) { switch (depth) { - case Dali::PixmapImage::COLOR_DEPTH_16: //Pixel::RGB565 - case Dali::PixmapImage::COLOR_DEPTH_24: // Pixel::RGB888 + case Dali::NativeImageSource::COLOR_DEPTH_16: //Pixel::RGB565 + case Dali::NativeImageSource::COLOR_DEPTH_24: // Pixel::RGB888 { mBlendingRequired = false; break; } - case Dali::PixmapImage::COLOR_DEPTH_8: //Pixel::A8 - case Dali::PixmapImage::COLOR_DEPTH_32: // Pixel::RGBA8888 + case Dali::NativeImageSource::COLOR_DEPTH_8: //Pixel::A8 + case Dali::NativeImageSource::COLOR_DEPTH_32: // Pixel::RGBA8888 { mBlendingRequired = true; break; @@ -145,10 +145,6 @@ void PixmapImage::SetBlending(Dali::PixmapImage::ColorDepth depth) } } -void PixmapImage::GetPixmapDetails() -{ -} - } // namespace Adaptor } // namespace internal diff --git a/adaptors/wayland/pixmap-image-impl.h b/adaptors/wayland/native-image-source-impl.h similarity index 57% rename from adaptors/wayland/pixmap-image-impl.h rename to adaptors/wayland/native-image-source-impl.h index 4fd9044..3870416 100644 --- a/adaptors/wayland/pixmap-image-impl.h +++ b/adaptors/wayland/native-image-source-impl.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_PIXMAP_IMAGE_H__ -#define __DALI_INTERNAL_PIXMAP_IMAGE_H__ +#ifndef __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ +#define __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -21,7 +21,7 @@ // EXTERNAL INCLUDES // INTERNAL INCLUDES -#include +#include namespace Dali { @@ -34,63 +34,63 @@ namespace Adaptor class EglImageExtensions; /** - * Dali internal PixmapImage. + * Dali internal NativeImageSource. */ -class PixmapImage +class NativeImageSource { public: /** - * Create a new PixmapImage internally. + * Create a new NativeImageSource internally. * Depending on hardware the width and height may have to be a power of two. * @param[in] width The width of the image. * @param[in] height The height of the image. - * @param[in] depth color depth of the pixmap - * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @param[in] depth color depth of the image. + * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty * @return A smart-pointer to a newly allocated image. */ - static PixmapImage* New(unsigned int width, + static NativeImageSource* New(unsigned int width, unsigned int height, - Dali::PixmapImage::ColorDepth depth, - Any pixmap); + Dali::NativeImageSource::ColorDepth depth, + Any nativeImageSource); /** - * @copydoc Dali::PixmapImage::GetPixmap() + * @copydoc Dali::NativeImageSource::GetNativeImageSource() */ - Any GetPixmap() const; + Any GetNativeImageSource() const; /** - * @copydoc Dali::PixmapImage::GetPixels() + * @copydoc Dali::NativeImageSource::GetPixels() */ bool GetPixels(std::vector &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const; /** - * @copydoc Dali::PixmapImage::EncodeToFile(const std::string& ) + * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) */ bool EncodeToFile(const std::string& filename) const; /** * destructor */ - ~PixmapImage(); + ~NativeImageSource(); /** - * @copydoc Dali::PixmapImage::GlExtensionCreate() + * @copydoc Dali::NativeImageSource::GlExtensionCreate() */ bool GlExtensionCreate(); /** - * @copydoc Dali::PixmapImage::GlExtensionDestroy() + * @copydoc Dali::NativeImageSource::GlExtensionDestroy() */ void GlExtensionDestroy(); /** - * @copydoc Dali::PixmapImage::TargetTexture() + * @copydoc Dali::NativeImageSource::TargetTexture() */ unsigned int TargetTexture(); /** - * @copydoc Dali::PixmapImage::GetWidth() + * @copydoc Dali::NativeImageSource::GetWidth() */ unsigned int GetWidth() const { @@ -98,7 +98,7 @@ public: } /** - * @copydoc Dali::PixmapImage::GetHeight() + * @copydoc Dali::NativeImageSource::GetHeight() */ unsigned int GetHeight() const { @@ -106,7 +106,7 @@ public: } /** - * @copydoc Dali::PixmapImage::RequiresBlending() + * @copydoc Dali::NativeImageSource::RequiresBlending() */ bool RequiresBlending() const { @@ -116,16 +116,16 @@ public: private: /** - * Private constructor; @see PixmapImage::New() + * Private constructor; @see NativeImageSource::New() * @param[in] width The width of the image. * @param[in] height The height of the image. - * @param[in] colour depth of the pixmap - * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @param[in] colour depth of the image. + * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty */ - PixmapImage(unsigned int width, + NativeImageSource(unsigned int width, unsigned int height, - Dali::PixmapImage::ColorDepth depth, - Any pixmap); + Dali::NativeImageSource::ColorDepth depth, + Any nativeImageSource); /** * 2nd phase construction. @@ -136,21 +136,15 @@ private: * Decide whether blending is required based on the color depth. * @param depth the PixelImage depth enum */ - void SetBlending(Dali::PixmapImage::ColorDepth depth); - - /** - * Given an existing pixmap, the function uses X to find out - * the width, heigth and depth of that pixmap. - */ - void GetPixmapDetails(); + void SetBlending(Dali::NativeImageSource::ColorDepth depth); private: - unsigned int mWidth; ///< pixmap width - unsigned int mHeight; ///< pixmap heights + unsigned int mWidth; ///< image width + unsigned int mHeight; ///< image heights bool mOwnPixmap; ///< Whether we created pixmap or not bool mBlendingRequired; ///< Whether blending is required - Dali::PixmapImage::ColorDepth mColorDepth; ///< color depth of pixmap + Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image void* mEglImageKHR; ///< From EGL extension EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions }; @@ -161,4 +155,4 @@ private: } // namespace Dali -#endif // __DALI_INTERNAL_PIXMAP_IMAGE_H__ +#endif // __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ diff --git a/adaptors/x11/file.list b/adaptors/x11/file.list index a716f3e..03052b4 100644 --- a/adaptors/x11/file.list +++ b/adaptors/x11/file.list @@ -4,7 +4,7 @@ _adaptor_x11_internal_src_files = \ $(adaptor_x11_dir)/clipboard-impl-x.cpp \ $(adaptor_x11_dir)/display-connection-impl-x.cpp \ $(adaptor_x11_dir)/imf-manager-impl-x.cpp \ - $(adaptor_x11_dir)/pixmap-image-impl-x.cpp \ + $(adaptor_x11_dir)/native-image-source-impl-x.cpp \ $(adaptor_x11_dir)/virtual-keyboard-impl-x.cpp \ $(adaptor_x11_dir)/window-impl-x.cpp \ $(adaptor_x11_dir)/egl-implementation-x.cpp \ diff --git a/adaptors/x11/pixmap-image-impl-x.cpp b/adaptors/x11/native-image-source-impl-x.cpp similarity index 85% rename from adaptors/x11/pixmap-image-impl-x.cpp rename to adaptors/x11/native-image-source-impl-x.cpp index 4fbc237..b58057b 100644 --- a/adaptors/x11/pixmap-image-impl-x.cpp +++ b/adaptors/x11/native-image-source-impl-x.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "pixmap-image-impl.h" +#include "native-image-source-impl.h" // EXTERNAL INCLUDES #include @@ -72,10 +72,10 @@ namespace }; } -PixmapImage* PixmapImage::New(unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Any pixmap ) +NativeImageSource* NativeImageSource::New(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) { - PixmapImage* image = new PixmapImage( width, height, depth, pixmap ); - DALI_ASSERT_DEBUG( image && "PixmapImage allocation failed." ); + NativeImageSource* image = new NativeImageSource( width, height, depth, nativeImageSource ); + DALI_ASSERT_DEBUG( image && "NativeImageSource allocation failed." ); // 2nd phase construction if(image) //< Defensive in case we ever compile without exceptions. @@ -86,7 +86,7 @@ PixmapImage* PixmapImage::New(unsigned int width, unsigned int height, Dali::Pix return image; } -PixmapImage::PixmapImage( unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Any pixmap ) +NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) : mWidth( width ), mHeight( height ), mOwnPixmap( true ), @@ -102,10 +102,10 @@ PixmapImage::PixmapImage( unsigned int width, unsigned int height, Dali::PixmapI DALI_ASSERT_DEBUG( mEglImageExtensions ); // assign the pixmap - mPixmap = GetPixmapFromAny(pixmap); + mPixmap = GetPixmapFromAny(nativeImageSource); } -void PixmapImage::Initialize() +void NativeImageSource::Initialize() { // if pixmap has been created outside of X11 Image we can return if (mPixmap) @@ -132,7 +132,7 @@ void PixmapImage::Initialize() ecore_x_sync(); } -PixmapImage::~PixmapImage() +NativeImageSource::~NativeImageSource() { if (mOwnPixmap && mPixmap) { @@ -140,13 +140,13 @@ PixmapImage::~PixmapImage() } } -Any PixmapImage::GetPixmap() const +Any NativeImageSource::GetNativeImageSource() const { // return ecore x11 type return Any(mPixmap); } -bool PixmapImage::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const +bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const { DALI_ASSERT_DEBUG(sizeof(unsigned) == 4); bool success = false; @@ -248,7 +248,7 @@ bool PixmapImage::GetPixels(std::vector& pixbuf, unsigned& width, } if(!success) { - DALI_LOG_ERROR("Failed to get pixels from PixmapImage."); + DALI_LOG_ERROR("Failed to get pixels from NativeImageSource."); pixbuf.resize(0); width = 0; height = 0; @@ -260,7 +260,7 @@ bool PixmapImage::GetPixels(std::vector& pixbuf, unsigned& width, return success; } -bool PixmapImage::EncodeToFile(const std::string& filename) const +bool NativeImageSource::EncodeToFile(const std::string& filename) const { std::vector< unsigned char > pixbuf; unsigned int width(0), height(0); @@ -273,7 +273,7 @@ bool PixmapImage::EncodeToFile(const std::string& filename) const return false; } -bool PixmapImage::GlExtensionCreate() +bool NativeImageSource::GlExtensionCreate() { // if the image existed previously delete it. if (mEglImageKHR != NULL) @@ -290,42 +290,42 @@ bool PixmapImage::GlExtensionCreate() return mEglImageKHR != NULL; } -void PixmapImage::GlExtensionDestroy() +void NativeImageSource::GlExtensionDestroy() { mEglImageExtensions->DestroyImageKHR(mEglImageKHR); mEglImageKHR = NULL; } -unsigned int PixmapImage::TargetTexture() +unsigned int NativeImageSource::TargetTexture() { mEglImageExtensions->TargetTextureKHR(mEglImageKHR); return 0; } -int PixmapImage::GetPixelDepth(Dali::PixmapImage::ColorDepth depth) const +int NativeImageSource::GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) const { switch (depth) { - case Dali::PixmapImage::COLOR_DEPTH_DEFAULT: + case Dali::NativeImageSource::COLOR_DEPTH_DEFAULT: { // Get the default screen depth return ecore_x_default_depth_get(ecore_x_display_get(), ecore_x_default_screen_get()); } - case Dali::PixmapImage::COLOR_DEPTH_8: + case Dali::NativeImageSource::COLOR_DEPTH_8: { return 8; } - case Dali::PixmapImage::COLOR_DEPTH_16: + case Dali::NativeImageSource::COLOR_DEPTH_16: { return 16; } - case Dali::PixmapImage::COLOR_DEPTH_24: + case Dali::NativeImageSource::COLOR_DEPTH_24: { return 24; } - case Dali::PixmapImage::COLOR_DEPTH_32: + case Dali::NativeImageSource::COLOR_DEPTH_32: { return 32; } @@ -337,7 +337,7 @@ int PixmapImage::GetPixelDepth(Dali::PixmapImage::ColorDepth depth) const } } -Ecore_X_Pixmap PixmapImage::GetPixmapFromAny(Any pixmap) const +Ecore_X_Pixmap NativeImageSource::GetPixmapFromAny(Any pixmap) const { if (pixmap.Empty()) { @@ -359,7 +359,7 @@ Ecore_X_Pixmap PixmapImage::GetPixmapFromAny(Any pixmap) const } } -void PixmapImage::GetPixmapDetails() +void NativeImageSource::GetPixmapDetails() { int x, y; diff --git a/adaptors/x11/pixmap-image-impl.h b/adaptors/x11/native-image-source-impl.h similarity index 61% rename from adaptors/x11/pixmap-image-impl.h rename to adaptors/x11/native-image-source-impl.h index 3e897f1..a97bfe1 100644 --- a/adaptors/x11/pixmap-image-impl.h +++ b/adaptors/x11/native-image-source-impl.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_PIXMAP_IMAGE_H__ -#define __DALI_INTERNAL_PIXMAP_IMAGE_H__ +#ifndef __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ +#define __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -22,7 +22,7 @@ #include // INTERNAL INCLUDES -#include +#include namespace Dali { @@ -35,62 +35,62 @@ namespace Adaptor class EglImageExtensions; /** - * Dali internal PixmapImage. + * Dali internal NativeImageSource. */ -class PixmapImage +class NativeImageSource { public: /** - * Create a new PixmapImage internally. + * Create a new NativeImageSource internally. * Depending on hardware the width and height may have to be a power of two. * @param[in] width The width of the image. * @param[in] height The height of the image. - * @param[in] depth color depth of the pixmap - * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @param[in] depth color depth of the image. + * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty * @return A smart-pointer to a newly allocated image. */ - static PixmapImage* New(unsigned int width, + static NativeImageSource* New(unsigned int width, unsigned int height, - Dali::PixmapImage::ColorDepth depth, - Any pixmap); + Dali::NativeImageSource::ColorDepth depth, + Any nativeImageSource); /** - * @copydoc Dali::PixmapImage::GetPixmap() + * @copydoc Dali::NativeImageSource::GetNativeImageSource() */ - Any GetPixmap() const; + Any GetNativeImageSource() const; /** - * @copydoc Dali::PixmapImage::GetPixels() + * @copydoc Dali::NativeImageSource::GetPixels() */ bool GetPixels(std::vector &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const; /** - * @copydoc Dali::PixmapImage::EncodeToFile(const std::string& ) + * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) */ bool EncodeToFile(const std::string& filename) const; /** * destructor */ - ~PixmapImage(); + ~NativeImageSource(); /** - * @copydoc Dali::PixmapImage::GlExtensionCreate() + * @copydoc Dali::NativeImageSource::GlExtensionCreate() */ bool GlExtensionCreate(); /** - * @copydoc Dali::PixmapImage::GlExtensionDestroy() + * @copydoc Dali::NativeImageSource::GlExtensionDestroy() */ void GlExtensionDestroy(); /** - * @copydoc Dali::PixmapImage::TargetTexture() + * @copydoc Dali::NativeImageSource::TargetTexture() */ unsigned int TargetTexture(); /** - * @copydoc Dali::PixmapImage::GetWidth() + * @copydoc Dali::NativeImageSource::GetWidth() */ unsigned int GetWidth() const { @@ -98,7 +98,7 @@ public: } /** - * @copydoc Dali::PixmapImage::GetHeight() + * @copydoc Dali::NativeImageSource::GetHeight() */ unsigned int GetHeight() const { @@ -106,7 +106,7 @@ public: } /** - * @copydoc Dali::PixmapImage::RequiresBlending() + * @copydoc Dali::NativeImageSource::RequiresBlending() */ bool RequiresBlending() const { @@ -116,16 +116,16 @@ public: private: /** - * Private constructor; @see PixmapImage::New() + * Private constructor; @see NativeImageSource::New() * @param[in] width The width of the image. * @param[in] height The height of the image. - * @param[in] colour depth of the pixmap - * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @param[in] colour depth of the image. + * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty */ - PixmapImage(unsigned int width, + NativeImageSource(unsigned int width, unsigned int height, - Dali::PixmapImage::ColorDepth depth, - Any pixmap); + Dali::NativeImageSource::ColorDepth depth, + Any nativeImageSource); /** * 2nd phase construction. @@ -137,7 +137,7 @@ private: * @param depth the PixelImage depth enum * @return default x11 pixel depth */ - int GetPixelDepth(Dali::PixmapImage::ColorDepth depth) const; + int GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) const; /** * Gets the pixmap from the Any parameter @@ -154,12 +154,12 @@ private: private: - unsigned int mWidth; ///< pixmap width - unsigned int mHeight; ///< pixmap heights + unsigned int mWidth; ///< image width + unsigned int mHeight; ///< image heights bool mOwnPixmap; ///< Whether we created pixmap or not Ecore_X_Pixmap mPixmap; ///< From Xlib bool mBlendingRequired; ///< Whether blending is required - Dali::PixmapImage::ColorDepth mColorDepth; ///< color depth of pixmap + Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image void* mEglImageKHR; ///< From EGL extension EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions }; @@ -170,4 +170,4 @@ private: } // namespace Dali -#endif // __DALI_INTERNAL_PIXMAP_IMAGE_H__ +#endif // __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ diff --git a/automated-tests/src/dali-adaptor/CMakeLists.txt b/automated-tests/src/dali-adaptor/CMakeLists.txt index f711d28..ae49b47 100644 --- a/automated-tests/src/dali-adaptor/CMakeLists.txt +++ b/automated-tests/src/dali-adaptor/CMakeLists.txt @@ -6,7 +6,7 @@ SET(RPM_NAME "core-${PKG_NAME}-tests") SET(CAPI_LIB "dali-adaptor") SET(TC_SOURCES utc-Dali-Key.cpp - utc-Dali-PixmapImage.cpp + utc-Dali-NativeImageSource.cpp utc-Dali-SingletonService.cpp utc-Dali-Window.cpp utc-Dali-Timer.cpp diff --git a/automated-tests/src/dali-adaptor/utc-Dali-PixmapImage.cpp b/automated-tests/src/dali-adaptor/utc-Dali-NativeImageSource.cpp similarity index 81% rename from automated-tests/src/dali-adaptor/utc-Dali-PixmapImage.cpp rename to automated-tests/src/dali-adaptor/utc-Dali-NativeImageSource.cpp index 1ed3120..679409a 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-PixmapImage.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-NativeImageSource.cpp @@ -23,24 +23,24 @@ using namespace Dali; -void utc_dali_pixmap_image_startup(void) +void utc_dali_native_image_source_startup(void) { test_return_value = TET_UNDEF; } -void utc_dali_pixmap_image_cleanup(void) +void utc_dali_native_image_source_cleanup(void) { test_return_value = TET_PASS; } -int UtcDaliPixmapImageNewN(void) +int UtcDaliNativeImageSourceNewN(void) { unsigned int width = 256u; unsigned int heigth = 256u; try { - PixmapImagePtr pixmapImage = PixmapImage::New(width, heigth, PixmapImage::COLOR_DEPTH_DEFAULT ); + NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, heigth, NativeImageSource::COLOR_DEPTH_DEFAULT ); } catch(Dali::DaliException& e) { -- 2.7.4