projects
/
platform
/
core
/
uifw
/
dali-adaptor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add API for setting resource destruction callback
[platform/core/uifw/dali-adaptor.git]
/
dali
/
internal
/
imaging
/
macos
/
native-image-source-impl-mac.cpp
diff --git
a/dali/internal/imaging/macos/native-image-source-impl-mac.cpp
b/dali/internal/imaging/macos/native-image-source-impl-mac.cpp
index
385e487
..
cc99b1b
100644
(file)
--- a/
dali/internal/imaging/macos/native-image-source-impl-mac.cpp
+++ b/
dali/internal/imaging/macos/native-image-source-impl-mac.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 202
0
Samsung Electronics Co., Ltd.
+ * Copyright (c) 202
1
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-22,73
+22,71
@@
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/internal/graphics/common/egl-image-extensions.h>
#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/graphics/common/egl-image-extensions.h>
#include <dali/internal/graphics/gles/egl-graphics.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
namespace Dali::Internal::Adaptor
{
namespace Dali::Internal::Adaptor
{
-
using Dali::Integration::PixelBuffer;
NativeImageSourceCocoa* NativeImageSourceCocoa::New(
using Dali::Integration::PixelBuffer;
NativeImageSourceCocoa* NativeImageSourceCocoa::New(
- unsigned int width,
- unsigned int height,
+ unsigned int
width,
+ unsigned int
height,
Dali::NativeImageSource::ColorDepth depth,
Dali::NativeImageSource::ColorDepth depth,
- Any nativeImageSource
-)
+ Any nativeImageSource)
{
{
- return new NativeImageSourceCocoa(
width, height, depth, nativeImageSource
);
+ return new NativeImageSourceCocoa(
width, height, depth, nativeImageSource
);
}
NativeImageSourceCocoa::NativeImageSourceCocoa(
}
NativeImageSourceCocoa::NativeImageSourceCocoa(
- unsigned int width,
- unsigned int height,
+ unsigned int
width,
+ unsigned int
height,
Dali::NativeImageSource::ColorDepth depth,
Dali::NativeImageSource::ColorDepth depth,
- Any
nativeImageSource
-)
-
: mImage(MakeRef<CGImageRef>(nullptr)
)
+ Any
nativeImageSource)
+: mImage(MakeRef<CGImageRef>(nullptr)),
+
mResourceDestructionCallback(
)
{
{
- DALI_ASSERT_ALWAYS(
Adaptor::IsAvailable()
);
- DALI_ASSERT_ALWAYS(
nativeImageSource.Empty()
);
+ DALI_ASSERT_ALWAYS(
Adaptor::IsAvailable()
);
+ DALI_ASSERT_ALWAYS(
nativeImageSource.Empty()
);
- CFStringRef colorSpaceName;
+ CFStringRef
colorSpaceName;
CGImageAlphaInfo alphaInfo;
CGImageAlphaInfo alphaInfo;
- std::size_t bitsPerPixel;
+ std::size_t
bitsPerPixel;
- switch
(depth)
+ switch(depth)
{
case Dali::NativeImageSource::COLOR_DEPTH_8:
colorSpaceName = kCGColorSpaceGenericGray;
{
case Dali::NativeImageSource::COLOR_DEPTH_8:
colorSpaceName = kCGColorSpaceGenericGray;
- alphaInfo = kCGImageAlphaNone;
- bitsPerPixel = 8;
+ alphaInfo
= kCGImageAlphaNone;
+ bitsPerPixel
= 8;
break;
case Dali::NativeImageSource::COLOR_DEPTH_16:
colorSpaceName = kCGColorSpaceSRGB;
break;
case Dali::NativeImageSource::COLOR_DEPTH_16:
colorSpaceName = kCGColorSpaceSRGB;
- alphaInfo = kCGImageAlphaNone;
- bitsPerPixel = 16;
+ alphaInfo
= kCGImageAlphaNone;
+ bitsPerPixel
= 16;
break;
case Dali::NativeImageSource::COLOR_DEPTH_24:
colorSpaceName = kCGColorSpaceSRGB;
break;
case Dali::NativeImageSource::COLOR_DEPTH_24:
colorSpaceName = kCGColorSpaceSRGB;
- alphaInfo = kCGImageAlphaNone;
- bitsPerPixel = 24;
+ alphaInfo
= kCGImageAlphaNone;
+ bitsPerPixel
= 24;
break;
case Dali::NativeImageSource::COLOR_DEPTH_32:
default:
colorSpaceName = kCGColorSpaceSRGB;
break;
case Dali::NativeImageSource::COLOR_DEPTH_32:
default:
colorSpaceName = kCGColorSpaceSRGB;
- alphaInfo = kCGImageAlphaLast;
- bitsPerPixel = 32;
+ alphaInfo
= kCGImageAlphaLast;
+ bitsPerPixel
= 32;
break;
}
// round to next 16 bytes boundary
std::size_t bytesPerRow = width & ~0xf;
break;
}
// round to next 16 bytes boundary
std::size_t bytesPerRow = width & ~0xf;
- bytesPerRow = bytesPerRow ? bytesPerRow + 16 : width;
+ bytesPerRow
= bytesPerRow ? bytesPerRow + 16 : width;
auto dataProvider = MakeRef(CGDataProviderCreateWithData(nullptr, nullptr, 0, nullptr));
auto dataProvider = MakeRef(CGDataProviderCreateWithData(nullptr, nullptr, 0, nullptr));
- auto colorSpace = MakeRef(CGColorSpaceCreateWithName(colorSpaceName));
- mImage = MakeRef(CGImageCreate(
+ auto colorSpace
= MakeRef(CGColorSpaceCreateWithName(colorSpaceName));
+ mImage
= MakeRef(CGImageCreate(
width,
height,
8,
width,
height,
8,
@@
-99,10
+97,9
@@
NativeImageSourceCocoa::NativeImageSourceCocoa(
dataProvider.get(),
nullptr,
true,
dataProvider.get(),
nullptr,
true,
- kCGRenderingIntentDefault
- ));
+ kCGRenderingIntentDefault));
- if
(mImage)
+ if(mImage)
{
colorSpace.release();
dataProvider.release();
{
colorSpace.release();
dataProvider.release();
@@
-122,20
+119,20
@@
Any NativeImageSourceCocoa::GetNativeImageSource() const
bool NativeImageSourceCocoa::GetPixels(
std::vector<uint8_t>& pixbuf,
bool NativeImageSourceCocoa::GetPixels(
std::vector<uint8_t>& pixbuf,
- unsigned&
width, unsigned& height
,
- Pixel::Format& pixelFormat
-) const
+ unsigned&
width
,
+ unsigned& height,
+
Pixel::Format& pixelFormat
) const
{
width = CGImageGetWidth(mImage.get());
height = CGImageGetHeight(mImage.get());
return true;
}
{
width = CGImageGetWidth(mImage.get());
height = CGImageGetHeight(mImage.get());
return true;
}
-void NativeImageSourceCocoa::SetSource(
Any source
)
+void NativeImageSourceCocoa::SetSource(
Any source
)
{
}
{
}
-bool NativeImageSourceCocoa::IsColorDepthSupported(
Dali::NativeImageSource::ColorDepth colorDepth
)
+bool NativeImageSourceCocoa::IsColorDepthSupported(
Dali::NativeImageSource::ColorDepth colorDepth
)
{
return true;
}
{
return true;
}
@@
-158,9
+155,9
@@
void NativeImageSourceCocoa::PrepareTexture()
{
}
{
}
-const char* NativeImageSourceCocoa::GetCustomFragmentPrefix() const
+bool NativeImageSourceCocoa::ApplyNativeFragmentShader(std::string& shader)
{
{
- return
nullptr
;
+ return
false
;
}
const char* NativeImageSourceCocoa::GetCustomSamplerTypename() const
}
const char* NativeImageSourceCocoa::GetCustomSamplerTypename() const
@@
-191,10
+188,7
@@
unsigned int NativeImageSourceCocoa::GetHeight() const
bool NativeImageSourceCocoa::RequiresBlending() const
{
const auto alphaInfo = CGImageGetAlphaInfo(mImage.get());
bool NativeImageSourceCocoa::RequiresBlending() const
{
const auto alphaInfo = CGImageGetAlphaInfo(mImage.get());
- return
- alphaInfo != kCGImageAlphaNone
- && alphaInfo != kCGImageAlphaNoneSkipFirst
- && alphaInfo != kCGImageAlphaNoneSkipLast;
+ return alphaInfo != kCGImageAlphaNone && alphaInfo != kCGImageAlphaNoneSkipFirst && alphaInfo != kCGImageAlphaNoneSkipLast;
}
bool NativeImageSourceCocoa::SourceChanged() const
}
bool NativeImageSourceCocoa::SourceChanged() const
@@
-202,15
+196,19
@@
bool NativeImageSourceCocoa::SourceChanged() const
return false;
}
return false;
}
-uint8_t* NativeImageSourceCocoa::AcquireBuffer(
uint16_t& width, uint16_t& height, uint16_t& stride
)
+uint8_t* NativeImageSourceCocoa::AcquireBuffer(
uint16_t& width, uint16_t& height, uint16_t& stride
)
{
return nullptr;
}
{
return nullptr;
}
-
bool NativeImageSourceCocoa::ReleaseBuffer()
{
return false;
}
bool NativeImageSourceCocoa::ReleaseBuffer()
{
return false;
}
+void NativeImageSourceCocoa::SetResourceDestructionCallback(EventThreadCallback* callback)
+{
+ mResourceDestructionCallback = std::unique_ptr<EventThreadCallback>(callback);
+}
+
} // namespace Dali::Internal::Adaptor
} // namespace Dali::Internal::Adaptor