mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-27 01:00:50 +00:00
!16364 [挑单 weekly_20241014] iOS平台视图优化
Merge pull request !16364 from qugr/cherry-pick-1729826520
This commit is contained in:
commit
44ab781360
@ -139,6 +139,7 @@ public:
|
||||
sk_sp<SkColorSpace> ColorSpace() const { return color_space_; }
|
||||
bool UpdateStorageSizeIfNecessary();
|
||||
bool ResourceMakeCurrent();
|
||||
static const EGLContext GetResourceContext();
|
||||
#endif
|
||||
static sk_sp<SkColorSpace> ConvertColorGamutToSkColorSpace(GraphicColorGamut colorGamut);
|
||||
|
||||
@ -155,7 +156,9 @@ protected:
|
||||
#ifdef ROSEN_IOS
|
||||
sk_sp<SkColorSpace> color_space_ = nullptr;
|
||||
void *layer_ = nullptr;
|
||||
EGLContext resource_context_ = EGL_NO_CONTEXT;
|
||||
static EGLContext resourceContext;
|
||||
static std::mutex resourceContextMutex;
|
||||
|
||||
uint32_t framebuffer_ = 0;
|
||||
uint32_t colorbuffer_ = 0;
|
||||
int32_t storage_width_ = 0;
|
||||
|
@ -311,6 +311,7 @@ struct RSSurfaceExtConfig {
|
||||
using RSSurfaceTextureConfig = RSSurfaceExtConfig;
|
||||
using RSSurfaceTextureAttachCallBack = std::function<void(int64_t textureId, bool attach)>;
|
||||
using RSSurfaceTextureUpdateCallBack = std::function<void(std::vector<float>&)>;
|
||||
using RSSurfaceTextureInitTypeCallBack = std::function<void(int32_t&)>;
|
||||
|
||||
struct RSDisplayNodeConfig {
|
||||
uint64_t screenId = 0;
|
||||
|
@ -44,8 +44,11 @@ public:
|
||||
#ifdef USE_SURFACE_TEXTURE
|
||||
virtual void DrawTextureImage(RSPaintFilterCanvas& canvas, bool freeze, const Drawing::Rect& clipRect) = 0;
|
||||
virtual void UpdateSurfaceDefaultSize(float width, float height) = 0;
|
||||
virtual RSSurfaceExtConfig GetSurfaceExtConfig() = 0;
|
||||
virtual void UpdateSurfaceExtConfig(const RSSurfaceExtConfig& config) = 0;
|
||||
virtual void SetAttachCallback(const RSSurfaceTextureAttachCallBack& attachCallback) = 0;
|
||||
virtual void SetUpdateCallback(const RSSurfaceTextureUpdateCallBack& updateCallback) = 0;
|
||||
virtual void SetInitTypeCallback(const RSSurfaceTextureInitTypeCallBack& initTypeCallback) = 0;
|
||||
virtual void MarkUiFrameAvailable(bool available) = 0;
|
||||
virtual bool IsUiFrameAvailable() const = 0;
|
||||
#endif
|
||||
|
@ -123,6 +123,16 @@ RSSurfaceNode::SharedPtr RSSurfaceNode::Create(const RSSurfaceNodeConfig& surfac
|
||||
};
|
||||
node->CreateSurfaceExt(config);
|
||||
}
|
||||
#endif
|
||||
#if defined(USE_SURFACE_TEXTURE) && defined(ROSEN_IOS)
|
||||
if ((type == RSSurfaceNodeType::SURFACE_TEXTURE_NODE) &&
|
||||
(surfaceNodeConfig.SurfaceNodeName == "PlatformViewSurface")) {
|
||||
RSSurfaceExtConfig config = {
|
||||
.type = RSSurfaceExtType::SURFACE_PLATFORM_TEXTURE,
|
||||
.additionalData = nullptr,
|
||||
};
|
||||
node->CreateSurfaceExt(config);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -744,6 +754,11 @@ void RSSurfaceNode::CreateSurfaceExt(const RSSurfaceExtConfig& config)
|
||||
GetId(), config.type);
|
||||
return;
|
||||
}
|
||||
#ifdef ROSEN_IOS
|
||||
if (texture->GetSurfaceExtConfig().additionalData == nullptr) {
|
||||
texture->UpdateSurfaceExtConfig(config);
|
||||
}
|
||||
#endif
|
||||
ROSEN_LOGD("RSSurfaceNode::CreateSurfaceExt %{public}" PRIu64 " type %{public}u %{public}p",
|
||||
GetId(), config.type, texture.get());
|
||||
std::unique_ptr<RSCommand> command =
|
||||
@ -772,6 +787,15 @@ void RSSurfaceNode::MarkUiFrameAvailable(bool available)
|
||||
|
||||
void RSSurfaceNode::SetSurfaceTextureAttachCallBack(const RSSurfaceTextureAttachCallBack& attachCallback)
|
||||
{
|
||||
#if defined(ROSEN_IOS)
|
||||
RSSurfaceTextureConfig config = {
|
||||
.type = RSSurfaceExtType::SURFACE_PLATFORM_TEXTURE,
|
||||
};
|
||||
auto texture = surface_->GetSurfaceExt(config);
|
||||
if (texture) {
|
||||
texture->SetAttachCallback(attachCallback);
|
||||
}
|
||||
#else
|
||||
RSSurfaceTextureConfig config = {
|
||||
.type = RSSurfaceExtType::SURFACE_TEXTURE,
|
||||
};
|
||||
@ -779,10 +803,20 @@ void RSSurfaceNode::SetSurfaceTextureAttachCallBack(const RSSurfaceTextureAttach
|
||||
if (texture) {
|
||||
texture->SetAttachCallback(attachCallback);
|
||||
}
|
||||
#endif // ROSEN_IOS
|
||||
}
|
||||
|
||||
void RSSurfaceNode::SetSurfaceTextureUpdateCallBack(const RSSurfaceTextureUpdateCallBack& updateCallback)
|
||||
{
|
||||
#if defined(ROSEN_IOS)
|
||||
RSSurfaceTextureConfig config = {
|
||||
.type = RSSurfaceExtType::SURFACE_PLATFORM_TEXTURE,
|
||||
};
|
||||
auto texture = surface_->GetSurfaceExt(config);
|
||||
if (texture) {
|
||||
texture->SetUpdateCallback(updateCallback);
|
||||
}
|
||||
#else
|
||||
RSSurfaceTextureConfig config = {
|
||||
.type = RSSurfaceExtType::SURFACE_TEXTURE,
|
||||
.additionalData = nullptr
|
||||
@ -791,6 +825,20 @@ void RSSurfaceNode::SetSurfaceTextureUpdateCallBack(const RSSurfaceTextureUpdate
|
||||
if (texture) {
|
||||
texture->SetUpdateCallback(updateCallback);
|
||||
}
|
||||
#endif // ROSEN_IOS
|
||||
}
|
||||
|
||||
void RSSurfaceNode::SetSurfaceTextureInitTypeCallBack(const RSSurfaceTextureInitTypeCallBack& initTypeCallback)
|
||||
{
|
||||
#if defined(ROSEN_IOS)
|
||||
RSSurfaceTextureConfig config = {
|
||||
.type = RSSurfaceExtType::SURFACE_PLATFORM_TEXTURE,
|
||||
};
|
||||
auto texture = surface_->GetSurfaceExt(config);
|
||||
if (texture) {
|
||||
texture->SetInitTypeCallback(initTypeCallback);
|
||||
}
|
||||
#endif // ROSEN_IOS
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -135,6 +135,7 @@ public:
|
||||
void MarkUiFrameAvailable(bool available);
|
||||
void SetSurfaceTextureAttachCallBack(const RSSurfaceTextureAttachCallBack& attachCallback);
|
||||
void SetSurfaceTextureUpdateCallBack(const RSSurfaceTextureUpdateCallBack& updateCallback);
|
||||
void SetSurfaceTextureInitTypeCallBack(const RSSurfaceTextureInitTypeCallBack& initTypeCallback);
|
||||
#endif
|
||||
void SetForeground(bool isForeground);
|
||||
// Force enable UIFirst when set TRUE
|
||||
|
Loading…
Reference in New Issue
Block a user