You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
/** |
|
* SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC <community@omp.ru> |
|
* SPDX-License-Identifier: BSD-3-Clause |
|
*/ |
|
#include <embedder_texture/embedder_texture_plugin.h> |
|
#include <flutter/method-channel.h> |
|
#include <flutter/platform-methods.h> |
|
|
|
void EmbedderTexturePlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) |
|
{ |
|
registrar.RegisterMethodChannel("embedder_texture", |
|
MethodCodecType::Standard, |
|
[this](const MethodCall &call) { this->onMethodCall(call); }); |
|
} |
|
|
|
void EmbedderTexturePlugin::onMethodCall(const MethodCall &call) |
|
{ |
|
const auto &method = call.GetMethod(); |
|
|
|
if (method == "create") { |
|
onCreate(call); |
|
return; |
|
} |
|
|
|
if (method == "remove") { |
|
onRemove(call); |
|
return; |
|
} |
|
|
|
unimplemented(call); |
|
} |
|
|
|
void EmbedderTexturePlugin::onCreate(const MethodCall &call) |
|
{ |
|
// auto width = call.GetArgument<Encodable::Float>("width"); |
|
// auto height = call.GetArgument<Encodable::Float>("height"); |
|
|
|
call.SendSuccessResponse(call.TextureRegister()); |
|
} |
|
|
|
void EmbedderTexturePlugin::onRemove(const MethodCall &call) |
|
{ |
|
call.SendSuccessResponse(nullptr); |
|
} |
|
|
|
void EmbedderTexturePlugin::unimplemented(const MethodCall &call) |
|
{ |
|
call.SendSuccessResponse(nullptr); |
|
} |