From: taeyoon Date: Wed, 30 Dec 2015 02:30:51 +0000 (+0900) Subject: Revert "Merge "[3.0] Change PixmapImage class to NativeImageSource class" into tizen" X-Git-Tag: accepted/tizen/common/20160208.162637~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F55859%2F2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Revert "Merge "[3.0] Change PixmapImage class to NativeImageSource class" into tizen" This reverts commit f6364c126062e48bfb3bd4b6d1ea61e211bfa7b7, reversing changes made to 0fadbd50e9cd62d8513be7ee41a160a82b6f06f2. Change-Id: Ice2dc184e331344d0631d2b6314019eb6a460e6d --- diff --git a/adaptors/common/indicator-buffer.h b/adaptors/common/indicator-buffer.h index f32bd32..4a43c3d 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 NativeImageSource, on older + * On platforms where EglImage is available it uses either SharedGlBuffer or PixmapImage, 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 23d4b81..141d78a 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::NativeImageSourcePtr nativeImageSource = Dali::NativeImageSource::New( mPixmap ); + Dali::PixmapImagePtr pixmapImage = Dali::PixmapImage::New( mPixmap ); - if( nativeImageSource ) + if( pixmapImage ) { - mIndicatorImageActor.SetImage( Dali::NativeImage::New(*nativeImageSource) ); + mIndicatorImageActor.SetImage( Dali::NativeImage::New(*pixmapImage) ); 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 deleted file mode 100644 index ba9a914..0000000 --- a/adaptors/public-api/adaptor-framework/native-image-source.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 -{ - -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.cpp b/adaptors/public-api/adaptor-framework/pixmap-image.cpp new file mode 100644 index 0000000..05fe7e8 --- /dev/null +++ b/adaptors/public-api/adaptor-framework/pixmap-image.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 +{ + +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/adaptor-framework/native-image-source.h b/adaptors/public-api/adaptor-framework/pixmap-image.h similarity index 70% rename from adaptors/public-api/adaptor-framework/native-image-source.h rename to adaptors/public-api/adaptor-framework/pixmap-image.h index dea2a14..8dd3c46 100644 --- a/adaptors/public-api/adaptor-framework/native-image-source.h +++ b/adaptors/public-api/adaptor-framework/pixmap-image.h @@ -1,5 +1,5 @@ -#ifndef __DALI_NATIVE_IMAGE_SOURCE_H__ -#define __DALI_NATIVE_IMAGE_SOURCE_H__ +#ifndef __DALI_PIXMAP_IMAGE_H__ +#define __DALI_PIXMAP_IMAGE_H__ /* * Copyright (c) 2015 Samsung Electronics Co., Ltd. @@ -37,30 +37,30 @@ namespace Internal DALI_INTERNAL { namespace Adaptor { -class NativeImageSource; +class PixmapImage; } } -class NativeImageSource; +class PixmapImage; /** - * @brief Pointer to Dali::NativeImageSource. + * @brief Pointer to Dali::PixmapImage. */ -typedef IntrusivePtr NativeImageSourcePtr; +typedef IntrusivePtr PixmapImagePtr; /** - * @brief Used for displaying native images. + * @brief Used for displaying native Pixmap images. * - * The native image source can be created internally or + * The native pixmap can be created internally or * externally by X11 or ECORE-X11. * * @since DALi 1.1.4 */ -class DALI_IMPORT_API NativeImageSource : public NativeImageInterface +class DALI_IMPORT_API PixmapImage : public NativeImageInterface { public: /** - * @brief When creating a native image the color depth has to be specified. + * @brief When creating a pixmap the color depth has to be specified. */ enum ColorDepth { @@ -72,33 +72,33 @@ public: }; /** - * @brief Create a new NativeImageSource. + * @brief Create a new PixmapImage. * * 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 image. + * @param[in] depth color depth of the pixmap * @return A smart-pointer to a newly allocated image. */ - static NativeImageSourcePtr New( unsigned int width, unsigned int height, ColorDepth depth ); + static PixmapImagePtr New( unsigned int width, unsigned int height, ColorDepth depth ); /** - * @brief Create a new NativeImageSource from an existing native image. + * @brief Create a new PixmapImage from an existing pixmap. * - * @param[in] nativeImageSource must be a X11 pixmap or a Ecore_X_Pixmap + * @param[in] pixmap must be a X11 pixmap or a Ecore_X_Pixmap * @return A smart-pointer to a newly allocated image. */ - static NativeImageSourcePtr New( Any nativeImageSource ); + static PixmapImagePtr New( Any pixmap ); /** - * @brief Retrieve the internal native image. + * @brief Retrieve the internal pixmap * - * @return Any object containing the internal native image. + * @return pixmap any object containing the internal pixmap */ - Any GetNativeImageSource(); + Any GetPixmap(); /** - * @brief Get a copy of the pixels used by NativeImageSource. + * @brief Get a copy of the pixels used by PixmapImage. * * 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 image. - * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @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 */ - DALI_INTERNAL NativeImageSource( unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource ); + DALI_INTERNAL PixmapImage( unsigned int width, unsigned int height, ColorDepth depth, Any pixmap ); /** * @brief A reference counted object may only be deleted by calling Unreference(). * * The implementation should destroy the NativeImage resources. */ - DALI_INTERNAL virtual ~NativeImageSource(); + DALI_INTERNAL virtual ~PixmapImage(); /** * @brief Undefined copy constructor * * This avoids accidental calls to a default copy constructor. - * @param[in] nativeImageSource A reference to the object to copy. + * @param[in] pixmapImage A reference to the object to copy. */ - DALI_INTERNAL NativeImageSource( const NativeImageSource& nativeImageSource ); + DALI_INTERNAL PixmapImage( const PixmapImage& pixmapImage ); /** * @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 NativeImageSource& operator=(const NativeImageSource& rhs); + DALI_INTERNAL PixmapImage& operator=(const PixmapImage& rhs); private: - Internal::Adaptor::NativeImageSource* mImpl; ///< Implementation pointer + Internal::Adaptor::PixmapImage* mImpl; ///< Implementation pointer }; /** @@ -202,4 +202,4 @@ private: */ } // namespace Dali -#endif // __DALI_NATIVE_IMAGE_SOURCE_H__ +#endif // __DALI_PIXMAP_IMAGE_H__ diff --git a/adaptors/public-api/dali.h b/adaptors/public-api/dali.h index 240215e..8ed599f 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 dbf643f..90e1144 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/native-image-source.cpp \ + $(adaptor_public_api_dir)/adaptor-framework/pixmap-image.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/native-image-source.h \ + $(adaptor_public_api_dir)/adaptor-framework/pixmap-image.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 0d66f49..f383295 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)/native-image-source-impl-wl.cpp \ + $(adaptor_wayland_dir)/pixmap-image-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/native-image-source-impl-wl.cpp b/adaptors/wayland/pixmap-image-impl-wl.cpp similarity index 63% rename from adaptors/wayland/native-image-source-impl-wl.cpp rename to adaptors/wayland/pixmap-image-impl-wl.cpp index e32aec9..3ebc0e7 100644 --- a/adaptors/wayland/native-image-source-impl-wl.cpp +++ b/adaptors/wayland/pixmap-image-impl-wl.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "native-image-source-impl.h" +#include "pixmap-image-impl.h" // EXTERNAL INCLUDES #include @@ -41,10 +41,10 @@ namespace Adaptor { using Dali::Integration::PixelBuffer; -NativeImageSource* NativeImageSource::New(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) +PixmapImage* PixmapImage::New(unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Any pixmap ) { - NativeImageSource* image = new NativeImageSource( width, height, depth, nativeImageSource ); - DALI_ASSERT_DEBUG( image && "NativeImageSource allocation failed." ); + PixmapImage* image = new PixmapImage( width, height, depth, pixmap ); + DALI_ASSERT_DEBUG( image && "PixmapImage allocation failed." ); // 2nd phase construction if(image) //< Defensive in case we ever compile without exceptions. @@ -55,7 +55,7 @@ NativeImageSource* NativeImageSource::New(unsigned int width, unsigned int heigh return image; } -NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) +PixmapImage::PixmapImage( unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Any pixmap ) : mWidth( width ), mHeight( height ), mOwnPixmap( true ), @@ -71,26 +71,26 @@ NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, D DALI_ASSERT_DEBUG( mEglImageExtensions ); } -void NativeImageSource::Initialize() +void PixmapImage::Initialize() { } -NativeImageSource::~NativeImageSource() +PixmapImage::~PixmapImage() { } -Any NativeImageSource::GetNativeImageSource() const +Any PixmapImage::GetPixmap() const { - DALI_ASSERT_ALWAYS( false && "NativeImageSource::GetNativeImageSource() is not supported for Wayland." ); + DALI_ASSERT_ALWAYS( false && "PixmapImage::GetPixmap() is not supported for Wayland." ); return Any(); } -bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const +bool PixmapImage::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const { return false; } -bool NativeImageSource::EncodeToFile(const std::string& filename) const +bool PixmapImage::EncodeToFile(const std::string& filename) const { std::vector< unsigned char > pixbuf; unsigned int width(0), height(0); @@ -103,37 +103,37 @@ bool NativeImageSource::EncodeToFile(const std::string& filename) const return false; } -bool NativeImageSource::GlExtensionCreate() +bool PixmapImage::GlExtensionCreate() { return false; } -void NativeImageSource::GlExtensionDestroy() +void PixmapImage::GlExtensionDestroy() { mEglImageExtensions->DestroyImageKHR(mEglImageKHR); mEglImageKHR = NULL; } -unsigned int NativeImageSource::TargetTexture() +unsigned int PixmapImage::TargetTexture() { mEglImageExtensions->TargetTextureKHR(mEglImageKHR); return 0; } -void NativeImageSource::SetBlending(Dali::NativeImageSource::ColorDepth depth) +void PixmapImage::SetBlending(Dali::PixmapImage::ColorDepth depth) { switch (depth) { - case Dali::NativeImageSource::COLOR_DEPTH_16: //Pixel::RGB565 - case Dali::NativeImageSource::COLOR_DEPTH_24: // Pixel::RGB888 + case Dali::PixmapImage::COLOR_DEPTH_16: //Pixel::RGB565 + case Dali::PixmapImage::COLOR_DEPTH_24: // Pixel::RGB888 { mBlendingRequired = false; break; } - case Dali::NativeImageSource::COLOR_DEPTH_8: //Pixel::A8 - case Dali::NativeImageSource::COLOR_DEPTH_32: // Pixel::RGBA8888 + case Dali::PixmapImage::COLOR_DEPTH_8: //Pixel::A8 + case Dali::PixmapImage::COLOR_DEPTH_32: // Pixel::RGBA8888 { mBlendingRequired = true; break; @@ -145,6 +145,10 @@ void NativeImageSource::SetBlending(Dali::NativeImageSource::ColorDepth depth) } } +void PixmapImage::GetPixmapDetails() +{ +} + } // namespace Adaptor } // namespace internal diff --git a/adaptors/wayland/native-image-source-impl.h b/adaptors/wayland/pixmap-image-impl.h similarity index 57% rename from adaptors/wayland/native-image-source-impl.h rename to adaptors/wayland/pixmap-image-impl.h index 3870416..4fd9044 100644 --- a/adaptors/wayland/native-image-source-impl.h +++ b/adaptors/wayland/pixmap-image-impl.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ -#define __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ +#ifndef __DALI_INTERNAL_PIXMAP_IMAGE_H__ +#define __DALI_INTERNAL_PIXMAP_IMAGE_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 NativeImageSource. + * Dali internal PixmapImage. */ -class NativeImageSource +class PixmapImage { public: /** - * Create a new NativeImageSource internally. + * Create a new PixmapImage 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 image. - * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @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 * @return A smart-pointer to a newly allocated image. */ - static NativeImageSource* New(unsigned int width, + static PixmapImage* New(unsigned int width, unsigned int height, - Dali::NativeImageSource::ColorDepth depth, - Any nativeImageSource); + Dali::PixmapImage::ColorDepth depth, + Any pixmap); /** - * @copydoc Dali::NativeImageSource::GetNativeImageSource() + * @copydoc Dali::PixmapImage::GetPixmap() */ - Any GetNativeImageSource() const; + Any GetPixmap() const; /** - * @copydoc Dali::NativeImageSource::GetPixels() + * @copydoc Dali::PixmapImage::GetPixels() */ bool GetPixels(std::vector &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const; /** - * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) + * @copydoc Dali::PixmapImage::EncodeToFile(const std::string& ) */ bool EncodeToFile(const std::string& filename) const; /** * destructor */ - ~NativeImageSource(); + ~PixmapImage(); /** - * @copydoc Dali::NativeImageSource::GlExtensionCreate() + * @copydoc Dali::PixmapImage::GlExtensionCreate() */ bool GlExtensionCreate(); /** - * @copydoc Dali::NativeImageSource::GlExtensionDestroy() + * @copydoc Dali::PixmapImage::GlExtensionDestroy() */ void GlExtensionDestroy(); /** - * @copydoc Dali::NativeImageSource::TargetTexture() + * @copydoc Dali::PixmapImage::TargetTexture() */ unsigned int TargetTexture(); /** - * @copydoc Dali::NativeImageSource::GetWidth() + * @copydoc Dali::PixmapImage::GetWidth() */ unsigned int GetWidth() const { @@ -98,7 +98,7 @@ public: } /** - * @copydoc Dali::NativeImageSource::GetHeight() + * @copydoc Dali::PixmapImage::GetHeight() */ unsigned int GetHeight() const { @@ -106,7 +106,7 @@ public: } /** - * @copydoc Dali::NativeImageSource::RequiresBlending() + * @copydoc Dali::PixmapImage::RequiresBlending() */ bool RequiresBlending() const { @@ -116,16 +116,16 @@ public: private: /** - * Private constructor; @see NativeImageSource::New() + * Private constructor; @see PixmapImage::New() * @param[in] width The width of the image. * @param[in] height The height of the image. - * @param[in] colour depth of the image. - * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @param[in] colour depth of the pixmap + * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty */ - NativeImageSource(unsigned int width, + PixmapImage(unsigned int width, unsigned int height, - Dali::NativeImageSource::ColorDepth depth, - Any nativeImageSource); + Dali::PixmapImage::ColorDepth depth, + Any pixmap); /** * 2nd phase construction. @@ -136,15 +136,21 @@ private: * Decide whether blending is required based on the color depth. * @param depth the PixelImage depth enum */ - void SetBlending(Dali::NativeImageSource::ColorDepth depth); + 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(); private: - unsigned int mWidth; ///< image width - unsigned int mHeight; ///< image heights + unsigned int mWidth; ///< pixmap width + unsigned int mHeight; ///< pixmap heights bool mOwnPixmap; ///< Whether we created pixmap or not bool mBlendingRequired; ///< Whether blending is required - Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image + Dali::PixmapImage::ColorDepth mColorDepth; ///< color depth of pixmap void* mEglImageKHR; ///< From EGL extension EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions }; @@ -155,4 +161,4 @@ private: } // namespace Dali -#endif // __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ +#endif // __DALI_INTERNAL_PIXMAP_IMAGE_H__ diff --git a/adaptors/x11/file.list b/adaptors/x11/file.list index 03052b4..a716f3e 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)/native-image-source-impl-x.cpp \ + $(adaptor_x11_dir)/pixmap-image-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/native-image-source-impl-x.cpp b/adaptors/x11/pixmap-image-impl-x.cpp similarity index 85% rename from adaptors/x11/native-image-source-impl-x.cpp rename to adaptors/x11/pixmap-image-impl-x.cpp index b58057b..4fbc237 100644 --- a/adaptors/x11/native-image-source-impl-x.cpp +++ b/adaptors/x11/pixmap-image-impl-x.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include "native-image-source-impl.h" +#include "pixmap-image-impl.h" // EXTERNAL INCLUDES #include @@ -72,10 +72,10 @@ namespace }; } -NativeImageSource* NativeImageSource::New(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) +PixmapImage* PixmapImage::New(unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Any pixmap ) { - NativeImageSource* image = new NativeImageSource( width, height, depth, nativeImageSource ); - DALI_ASSERT_DEBUG( image && "NativeImageSource allocation failed." ); + PixmapImage* image = new PixmapImage( width, height, depth, pixmap ); + DALI_ASSERT_DEBUG( image && "PixmapImage allocation failed." ); // 2nd phase construction if(image) //< Defensive in case we ever compile without exceptions. @@ -86,7 +86,7 @@ NativeImageSource* NativeImageSource::New(unsigned int width, unsigned int heigh return image; } -NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) +PixmapImage::PixmapImage( unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Any pixmap ) : mWidth( width ), mHeight( height ), mOwnPixmap( true ), @@ -102,10 +102,10 @@ NativeImageSource::NativeImageSource( unsigned int width, unsigned int height, D DALI_ASSERT_DEBUG( mEglImageExtensions ); // assign the pixmap - mPixmap = GetPixmapFromAny(nativeImageSource); + mPixmap = GetPixmapFromAny(pixmap); } -void NativeImageSource::Initialize() +void PixmapImage::Initialize() { // if pixmap has been created outside of X11 Image we can return if (mPixmap) @@ -132,7 +132,7 @@ void NativeImageSource::Initialize() ecore_x_sync(); } -NativeImageSource::~NativeImageSource() +PixmapImage::~PixmapImage() { if (mOwnPixmap && mPixmap) { @@ -140,13 +140,13 @@ NativeImageSource::~NativeImageSource() } } -Any NativeImageSource::GetNativeImageSource() const +Any PixmapImage::GetPixmap() const { // return ecore x11 type return Any(mPixmap); } -bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const +bool PixmapImage::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 NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& } if(!success) { - DALI_LOG_ERROR("Failed to get pixels from NativeImageSource."); + DALI_LOG_ERROR("Failed to get pixels from PixmapImage."); pixbuf.resize(0); width = 0; height = 0; @@ -260,7 +260,7 @@ bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned& return success; } -bool NativeImageSource::EncodeToFile(const std::string& filename) const +bool PixmapImage::EncodeToFile(const std::string& filename) const { std::vector< unsigned char > pixbuf; unsigned int width(0), height(0); @@ -273,7 +273,7 @@ bool NativeImageSource::EncodeToFile(const std::string& filename) const return false; } -bool NativeImageSource::GlExtensionCreate() +bool PixmapImage::GlExtensionCreate() { // if the image existed previously delete it. if (mEglImageKHR != NULL) @@ -290,42 +290,42 @@ bool NativeImageSource::GlExtensionCreate() return mEglImageKHR != NULL; } -void NativeImageSource::GlExtensionDestroy() +void PixmapImage::GlExtensionDestroy() { mEglImageExtensions->DestroyImageKHR(mEglImageKHR); mEglImageKHR = NULL; } -unsigned int NativeImageSource::TargetTexture() +unsigned int PixmapImage::TargetTexture() { mEglImageExtensions->TargetTextureKHR(mEglImageKHR); return 0; } -int NativeImageSource::GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) const +int PixmapImage::GetPixelDepth(Dali::PixmapImage::ColorDepth depth) const { switch (depth) { - case Dali::NativeImageSource::COLOR_DEPTH_DEFAULT: + case Dali::PixmapImage::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::NativeImageSource::COLOR_DEPTH_8: + case Dali::PixmapImage::COLOR_DEPTH_8: { return 8; } - case Dali::NativeImageSource::COLOR_DEPTH_16: + case Dali::PixmapImage::COLOR_DEPTH_16: { return 16; } - case Dali::NativeImageSource::COLOR_DEPTH_24: + case Dali::PixmapImage::COLOR_DEPTH_24: { return 24; } - case Dali::NativeImageSource::COLOR_DEPTH_32: + case Dali::PixmapImage::COLOR_DEPTH_32: { return 32; } @@ -337,7 +337,7 @@ int NativeImageSource::GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) } } -Ecore_X_Pixmap NativeImageSource::GetPixmapFromAny(Any pixmap) const +Ecore_X_Pixmap PixmapImage::GetPixmapFromAny(Any pixmap) const { if (pixmap.Empty()) { @@ -359,7 +359,7 @@ Ecore_X_Pixmap NativeImageSource::GetPixmapFromAny(Any pixmap) const } } -void NativeImageSource::GetPixmapDetails() +void PixmapImage::GetPixmapDetails() { int x, y; diff --git a/adaptors/x11/native-image-source-impl.h b/adaptors/x11/pixmap-image-impl.h similarity index 61% rename from adaptors/x11/native-image-source-impl.h rename to adaptors/x11/pixmap-image-impl.h index a97bfe1..3e897f1 100644 --- a/adaptors/x11/native-image-source-impl.h +++ b/adaptors/x11/pixmap-image-impl.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ -#define __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ +#ifndef __DALI_INTERNAL_PIXMAP_IMAGE_H__ +#define __DALI_INTERNAL_PIXMAP_IMAGE_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 NativeImageSource. + * Dali internal PixmapImage. */ -class NativeImageSource +class PixmapImage { public: /** - * Create a new NativeImageSource internally. + * Create a new PixmapImage 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 image. - * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @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 * @return A smart-pointer to a newly allocated image. */ - static NativeImageSource* New(unsigned int width, + static PixmapImage* New(unsigned int width, unsigned int height, - Dali::NativeImageSource::ColorDepth depth, - Any nativeImageSource); + Dali::PixmapImage::ColorDepth depth, + Any pixmap); /** - * @copydoc Dali::NativeImageSource::GetNativeImageSource() + * @copydoc Dali::PixmapImage::GetPixmap() */ - Any GetNativeImageSource() const; + Any GetPixmap() const; /** - * @copydoc Dali::NativeImageSource::GetPixels() + * @copydoc Dali::PixmapImage::GetPixels() */ bool GetPixels(std::vector &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const; /** - * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) + * @copydoc Dali::PixmapImage::EncodeToFile(const std::string& ) */ bool EncodeToFile(const std::string& filename) const; /** * destructor */ - ~NativeImageSource(); + ~PixmapImage(); /** - * @copydoc Dali::NativeImageSource::GlExtensionCreate() + * @copydoc Dali::PixmapImage::GlExtensionCreate() */ bool GlExtensionCreate(); /** - * @copydoc Dali::NativeImageSource::GlExtensionDestroy() + * @copydoc Dali::PixmapImage::GlExtensionDestroy() */ void GlExtensionDestroy(); /** - * @copydoc Dali::NativeImageSource::TargetTexture() + * @copydoc Dali::PixmapImage::TargetTexture() */ unsigned int TargetTexture(); /** - * @copydoc Dali::NativeImageSource::GetWidth() + * @copydoc Dali::PixmapImage::GetWidth() */ unsigned int GetWidth() const { @@ -98,7 +98,7 @@ public: } /** - * @copydoc Dali::NativeImageSource::GetHeight() + * @copydoc Dali::PixmapImage::GetHeight() */ unsigned int GetHeight() const { @@ -106,7 +106,7 @@ public: } /** - * @copydoc Dali::NativeImageSource::RequiresBlending() + * @copydoc Dali::PixmapImage::RequiresBlending() */ bool RequiresBlending() const { @@ -116,16 +116,16 @@ public: private: /** - * Private constructor; @see NativeImageSource::New() + * Private constructor; @see PixmapImage::New() * @param[in] width The width of the image. * @param[in] height The height of the image. - * @param[in] colour depth of the image. - * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @param[in] colour depth of the pixmap + * @param[in] pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty */ - NativeImageSource(unsigned int width, + PixmapImage(unsigned int width, unsigned int height, - Dali::NativeImageSource::ColorDepth depth, - Any nativeImageSource); + Dali::PixmapImage::ColorDepth depth, + Any pixmap); /** * 2nd phase construction. @@ -137,7 +137,7 @@ private: * @param depth the PixelImage depth enum * @return default x11 pixel depth */ - int GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) const; + int GetPixelDepth(Dali::PixmapImage::ColorDepth depth) const; /** * Gets the pixmap from the Any parameter @@ -154,12 +154,12 @@ private: private: - unsigned int mWidth; ///< image width - unsigned int mHeight; ///< image heights + unsigned int mWidth; ///< pixmap width + unsigned int mHeight; ///< pixmap heights bool mOwnPixmap; ///< Whether we created pixmap or not Ecore_X_Pixmap mPixmap; ///< From Xlib bool mBlendingRequired; ///< Whether blending is required - Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image + Dali::PixmapImage::ColorDepth mColorDepth; ///< color depth of pixmap void* mEglImageKHR; ///< From EGL extension EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions }; @@ -170,4 +170,4 @@ private: } // namespace Dali -#endif // __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__ +#endif // __DALI_INTERNAL_PIXMAP_IMAGE_H__ diff --git a/automated-tests/src/dali-adaptor/CMakeLists.txt b/automated-tests/src/dali-adaptor/CMakeLists.txt index ae49b47..f711d28 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-NativeImageSource.cpp + utc-Dali-PixmapImage.cpp utc-Dali-SingletonService.cpp utc-Dali-Window.cpp utc-Dali-Timer.cpp diff --git a/automated-tests/src/dali-adaptor/utc-Dali-NativeImageSource.cpp b/automated-tests/src/dali-adaptor/utc-Dali-PixmapImage.cpp similarity index 81% rename from automated-tests/src/dali-adaptor/utc-Dali-NativeImageSource.cpp rename to automated-tests/src/dali-adaptor/utc-Dali-PixmapImage.cpp index 679409a..1ed3120 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-NativeImageSource.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-PixmapImage.cpp @@ -23,24 +23,24 @@ using namespace Dali; -void utc_dali_native_image_source_startup(void) +void utc_dali_pixmap_image_startup(void) { test_return_value = TET_UNDEF; } -void utc_dali_native_image_source_cleanup(void) +void utc_dali_pixmap_image_cleanup(void) { test_return_value = TET_PASS; } -int UtcDaliNativeImageSourceNewN(void) +int UtcDaliPixmapImageNewN(void) { unsigned int width = 256u; unsigned int heigth = 256u; try { - NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, heigth, NativeImageSource::COLOR_DEPTH_DEFAULT ); + PixmapImagePtr pixmapImage = PixmapImage::New(width, heigth, PixmapImage::COLOR_DEPTH_DEFAULT ); } catch(Dali::DaliException& e) {