X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fimaging%2Fubuntu-x11%2Fnative-image-source-impl-x.cpp;h=54ad2468ce8713140d4adf23f962b72a736c505f;hb=refs%2Fchanges%2F60%2F244560%2F1;hp=9fed47754d62f714cfc9e6fd3fa4b411e168610a;hpb=ee1898022ba5157cb467dc822cdac1a29712cba9;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp old mode 100644 new mode 100755 index 9fed477..54ad246 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -19,17 +19,16 @@ #include // EXTERNAL INCLUDES -#include +#include #include #include #include // INTERNAL INCLUDES #include -#include +#include #include -#include -#include +#include namespace Dali { @@ -72,7 +71,7 @@ namespace }; } -NativeImageSourceX* NativeImageSourceX::New(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) +NativeImageSourceX* NativeImageSourceX::New( uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) { NativeImageSourceX* image = new NativeImageSourceX( width, height, depth, nativeImageSource ); DALI_ASSERT_DEBUG( image && "NativeImageSource allocation failed." ); @@ -86,7 +85,7 @@ NativeImageSourceX* NativeImageSourceX::New(unsigned int width, unsigned int hei return image; } -NativeImageSourceX::NativeImageSourceX( unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) +NativeImageSourceX::NativeImageSourceX( uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource ) : mWidth( width ), mHeight( height ), mOwnPixmap( true ), @@ -97,8 +96,12 @@ NativeImageSourceX::NativeImageSourceX( unsigned int width, unsigned int height, mEglImageExtensions( NULL ) { DALI_ASSERT_ALWAYS( Adaptor::IsAvailable() ); - EglFactory& eglFactory = Adaptor::GetImplementation( Adaptor::Get() ).GetEGLFactory(); - mEglImageExtensions = eglFactory.GetImageExtensions(); + + GraphicsInterface* graphics = &( Adaptor::GetImplementation( Adaptor::Get() ).GetGraphicsInterface() ); + auto eglGraphics = static_cast(graphics); + + mEglImageExtensions = eglGraphics->GetImageExtensions(); + DALI_ASSERT_DEBUG( mEglImageExtensions ); // assign the pixmap @@ -136,7 +139,8 @@ NativeImageSourceX::~NativeImageSourceX() { if (mOwnPixmap && mPixmap) { - ecore_x_pixmap_free(mPixmap); + // Temporarily disable this as this causes a crash with EFL Version 1.24.0 + //ecore_x_pixmap_free(mPixmap); } } @@ -159,7 +163,7 @@ bool NativeImageSourceX::GetPixels(std::vector& pixbuf, unsigned& XImageJanitor xImageJanitor( XGetImage( displayConnection, mPixmap, 0, 0, // x,y of subregion to extract. - width, height, // of suregion to extract. + width, height, // of subregion to extract. 0xFFFFFFFF, ZPixmap ) ); XImage* const pXImage = xImageJanitor.mXImage; @@ -260,19 +264,6 @@ bool NativeImageSourceX::GetPixels(std::vector& pixbuf, unsigned& return success; } -bool NativeImageSourceX::EncodeToFile(const std::string& filename) const -{ - std::vector< unsigned char > pixbuf; - unsigned int width(0), height(0); - Pixel::Format pixelFormat; - - if(GetPixels(pixbuf, width, height, pixelFormat)) - { - return Dali::EncodeToFile(&pixbuf[0], filename, pixelFormat, width, height); - } - return false; -} - void NativeImageSourceX::SetSource( Any source ) { mPixmap = GetPixmapFromAny( source ); @@ -292,12 +283,12 @@ bool NativeImageSourceX::IsColorDepthSupported( Dali::NativeImageSource::ColorDe return true; } -bool NativeImageSourceX::GlExtensionCreate() +bool NativeImageSourceX::CreateResource() { // if the image existed previously delete it. if (mEglImageKHR != NULL) { - GlExtensionDestroy(); + DestroyResource(); } // casting from an unsigned int to a void *, which should then be cast back @@ -309,14 +300,14 @@ bool NativeImageSourceX::GlExtensionCreate() return mEglImageKHR != NULL; } -void NativeImageSourceX::GlExtensionDestroy() +void NativeImageSourceX::DestroyResource() { mEglImageExtensions->DestroyImageKHR(mEglImageKHR); mEglImageKHR = NULL; } -unsigned int NativeImageSourceX::TargetTexture() +uint32_t NativeImageSourceX::TargetTexture() { mEglImageExtensions->TargetTextureKHR(mEglImageKHR); @@ -360,6 +351,31 @@ int NativeImageSourceX::GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) } } +int NativeImageSourceX::GetTextureTarget() const +{ + return GL_TEXTURE_2D; +} + +const char* NativeImageSourceX::GetCustomFragmentPrefix() const +{ + return nullptr; +} + +const char* NativeImageSourceX::GetCustomSamplerTypename() const +{ + return nullptr; +} + +Any NativeImageSourceX::GetNativeImageHandle() const +{ + return Any(mPixmap); +} + +bool NativeImageSourceX::SourceChanged() const +{ + return false; +} + Ecore_X_Pixmap NativeImageSourceX::GetPixmapFromAny(Any pixmap) const { if (pixmap.Empty()) @@ -398,6 +414,17 @@ void NativeImageSourceX::GetPixmapDetails() mBlendingRequired = ( depth == 32 || depth == 8 ); } +uint8_t* NativeImageSourceX::AcquireBuffer( uint16_t& width, uint16_t& height, uint16_t& stride ) +{ + return NULL; +} + + +bool NativeImageSourceX::ReleaseBuffer() +{ + return false; +} + } // namespace Adaptor } // namespace internal