mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-12-22 23:00:35 +00:00
fix wmtest
Change-Id: Id50c70ebfaf88385f0732032d1b802a10cc93f3c Signed-off-by: lizheng <lizheng2@huawei.com>
This commit is contained in:
parent
18478dc52d
commit
dc5d42a5d3
@ -176,8 +176,11 @@ int32_t INativeTest::IPCServerStart()
|
||||
auto sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
constexpr int32_t sABegin = 4610;
|
||||
constexpr int32_t sAEnd = 4700;
|
||||
IncStrongRef(this);
|
||||
for (int32_t i = sABegin; i < sAEnd; i++) {
|
||||
if (sam->AddSystemAbility(i, this) == ERR_OK) {
|
||||
GSLOG7SO(DEBUG) << "adding SystemAbility, SAID: " << i;
|
||||
if (sam->AddSystemAbility(i, AsObject()) == ERR_OK) {
|
||||
GSLOG7SO(DEBUG) << "AddSystemAbility Success";
|
||||
said = i;
|
||||
return GSERROR_OK;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
}
|
||||
} g_autoload;
|
||||
|
||||
class WMClientNativeTest21Sub0 : public WMClientNativeTest21, public IScreenShotCallback {
|
||||
class WMClientNativeTest21Sub0 : public WMClientNativeTest21 {
|
||||
public:
|
||||
std::string GetDescription() const override
|
||||
{
|
||||
@ -88,49 +88,14 @@ public:
|
||||
|
||||
void Run(int32_t argc, const char **argv) override
|
||||
{
|
||||
windowManager->ListenNextScreenShot(0, this);
|
||||
}
|
||||
|
||||
void OnScreenShot(const struct WMImageInfo &info) override
|
||||
{
|
||||
if (info.wret) {
|
||||
GSLOG7SE(ERROR) << "screenshot failed with " << info.wret;
|
||||
return;
|
||||
}
|
||||
GSLOG7SO(INFO) << "screenshot success";
|
||||
|
||||
auto addr = reinterpret_cast<const uint32_t *>(info.data);
|
||||
screenshot = std::make_unique<uint32_t[]>(info.width * info.height);
|
||||
for (uint32_t i = 0; i < info.width * info.height; i++) {
|
||||
screenshot[i] = addr[i];
|
||||
}
|
||||
screenshotWidth = info.width;
|
||||
screenshotHeight = info.height;
|
||||
}
|
||||
|
||||
void Run2()
|
||||
{
|
||||
sptr<IBufferProducer> producer = iface_cast<IBufferProducer>(remoteObject);
|
||||
psurf = Surface::CreateSurfaceAsProducer(producer);
|
||||
auto func = std::bind(&WMClientNativeTest21Sub0::Draw, this,
|
||||
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
|
||||
SetVsyncRate(1);
|
||||
subwindowSync = NativeTestSync::CreateSync(func, psurf);
|
||||
}
|
||||
|
||||
void Draw(uint32_t *addr, uint32_t width, uint32_t height, uint32_t count)
|
||||
{
|
||||
if (screenshot == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t copyWidth = width < screenshotWidth ? width : screenshotWidth;
|
||||
uint32_t copyHeight = height < screenshotHeight ? height : screenshotHeight;
|
||||
for (uint32_t j = 0; j < copyHeight; j++) {
|
||||
for (uint32_t i = 0; i < copyWidth; i++) {
|
||||
addr[j * width + i] = screenshot[j * screenshotWidth + i];
|
||||
}
|
||||
}
|
||||
subwindowSync = NativeTestSync::CreateSync(NativeTestDraw::RainbowDraw, psurf);
|
||||
}
|
||||
|
||||
void IPCClientOnMessage(int32_t sequence, const std::string &message, const sptr<IRemoteObject> &robj) override
|
||||
@ -156,9 +121,6 @@ private:
|
||||
sptr<IRemoteObject> remoteObject = nullptr;
|
||||
sptr<Surface> psurf = nullptr;
|
||||
sptr<NativeTestSync> subwindowSync = nullptr;
|
||||
std::unique_ptr<uint32_t[]> screenshot = nullptr;
|
||||
uint32_t screenshotWidth = 0;
|
||||
uint32_t screenshotHeight = 0;
|
||||
} g_autoload0;
|
||||
|
||||
class WMClientNativeTest21Sub1 : public WMClientNativeTest21 {
|
||||
|
Loading…
Reference in New Issue
Block a user