|
只修改这个文件
vapp_screen_lock_main.cpp
#if defined(__MMI_N9_SCREENLOCK__)
//申请静态的数组来存储图层数据
static VfxU8 N9_old_layer_buff_ptr[LCD_WIDTH*LCD_HEIGHT<<1];
//拷贝当前图层的数据
void N9_gui_save_current_layer(VfxU8 *output_buf)
{
/*
*local
*/
gdi_handle snap_layer;
gdi_handle base_layer;
BOOL src_key_enable;
gdi_color src_key_color;
GDI_RESULT res;
/**
*code body
*/
res = gdi_layer_create_using_outside_memory(0, 0, LCD_WIDTH, LCD_HEIGHT,
&snap_layer, output_buf, LCD_WIDTH*LCD_HEIGHT*2 );
if(GDI_SUCCEED != res)
{
return;
}
gdi_layer_get_base_handle(&base_layer);
gdi_layer_push_and_set_active(base_layer);
gdi_layer_get_source_key(&src_key_enable, &src_key_color);
gdi_layer_set_source_key(FALSE, src_key_color);
gdi_layer_push_and_set_active(snap_layer);
gdi_layer_reset_clip();
gdi_layer_flatten_with_clipping(base_layer, 0, 0, 0);
gdi_layer_pop_and_restore_active();
gdi_layer_set_source_key(src_key_enable, src_key_color);
gdi_layer_pop_and_restore_active();
gdi_layer_free(snap_layer);
}
//获取数据指针
void N9_get_save_base_layer_ptr(VfxU8 **buf_ptr)
{
*buf_ptr = N9_old_layer_buff_ptr;
}
#endif /*__MMI_N9_SCREENLOCK__*/
mmi_id vapp_screen_lock_launch(void)
{
MMI_TRACE(TRACE_GROUP_3, TRC_VAPP_SCREEN_LOCK_LAUNCH, 200);
VfxContext *cntx = VFX_OBJ_GET_INSTANCE(VappPlatformContext);
//进入锁屏界面之前,保存当前图层数据
#if defined(__MMI_N9_SCREENLOCK__)
N9_gui_save_current_layer(N9_old_layer_buff_ptr);
#endif/*__MMI_N9_SCREENLOCK__*/
return VfxAppLauncher::launchWithCtx(
VAPP_SCREEN_LOCK,
VFX_OBJ_CLASS_INFO(VappScreenLockApp),
GRP_ID_ROOT,
cntx);
}
#if defined(__MMI_N9_SCREENLOCK__)
#include "vfx_logger.h"
void VappScreenLockScreen::onInit()
{
VfxU8 *bufPtr;
VfxS32 width, height;
gdi_color_format colorFormat;
VfxS32 bpp;
VfxScrRotateTypeEnum rotateType;
gdi_handle baseLayer;
rotateType = (VfxScrRotateTypeEnum)vrt_sys_get_pre_screen_rotation();
gdi_layer_get_base_handle(&baseLayer);
// Get all layer information
gdi_layer_push_and_set_active(baseLayer);
N9_get_save_base_layer_ptr(&bufPtr);
if (rotateType == VFX_SCR_ROTATE_TYPE_90 ||
rotateType == VFX_SCR_ROTATE_TYPE_270)
{
width = GDI_LCD_HEIGHT;
height = GDI_LCD_WIDTH;
}
else
{
width = GDI_LCD_WIDTH;
height = GDI_LCD_HEIGHT;
}
gdi_layer_get_color_format(&colorFormat);
bpp = gdi_layer_get_bit_per_pixel();
gdi_layer_pop_and_restore_active();
// Config image buffer
VfxImageBuffer imgBuf;
imgBuf.ptr = bufPtr;
imgBuf.pitchBytes = bpp * width / 8;
imgBuf.width = width;
imgBuf.height = height;
switch (colorFormat)
{
case GDI_COLOR_FORMAT_16:
imgBuf.colorFormat = VRT_COLOR_TYPE_RGB565;
break;
case GDI_COLOR_FORMAT_32:
imgBuf.colorFormat = VRT_COLOR_TYPE_ARGB8888;
break;
case GDI_COLOR_FORMAT_32_PARGB:
imgBuf.colorFormat = VRT_COLOR_TYPE_PARGB8888;
break;
default:
VFX_DEV_ASSERT(0);
imgBuf.colorFormat = VRT_COLOR_TYPE_UNKNOWN;
break;
};
VFX_LOG_FUNC;
VfxAppScr::onInit();
//显示图层上的数据
setImgContent(VfxImageSrc(imgBuf));
createObjStack();
#ifndef __MRE_SDK__
VFX_OBJ_CREATE(m_statusBar, VcpStatusIconBar, this);
m_statusBar->setAutoAnimate(VFX_TRUE);
m_statusBar->setPos(0, 0);
#endif
setBgColor(VFX_COLOR_WHITE);
#ifndef __MRE_SDK__
setSize(GDI_LCD_WIDTH, GDI_LCD_HEIGHT);
#else
setSize(VFX_SRV_CALL0(vfx_srv_get_lcd_width), VFX_SRV_CALL0(vfx_srv_get_lcd_height));
#endif
setIsZSortChild(VFX_TRUE);
}
#endif |
|