📄 ddipu_sdc_cursor.cpp
字号:
//-----------------------------------------------------------------------------
// Copyright (C) 2004-2005, MOTOROLA, INC. All Rights Reserved
// THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
// BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
// MOTOROLA, INC.
//------------------------------------------------------------------------------
//
// Copyright (C) 2005-2006, Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//------------------------------------------------------------------------------
//
// File: ddipu_sdc_cursor.cpp
//
// Implementation of DDIPU_SDC cursor operation functions.
//
//------------------------------------------------------------------------------
#include "precomp.h"
//------------------------------------------------------------------------------
// External Functions
//------------------------------------------------------------------------------
// External Variables
//------------------------------------------------------------------------------
// Defines
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
// Global Variables
//------------------------------------------------------------------------------
// Local Variables
//------------------------------------------------------------------------------
// Local Functions
//------------------------------------------------------------------------------
//
// Function: SetPointerShape
//
// This method sets the shape of the pointer, the hot spot of the pointer,
// and the colors to use for the cursor if the cursor is multicolored. The
// graphics device interface (GDI) calls GPE::MovePointer separately to move
// or hide the cursor.
//
// Parameters:
// pMask
// [in] Pointer to a mask containing the cursor shape.
//
// pColorSurf
// [in] Pointer to a surface specifying the colors to use for the cursor.
//
// xHot
// [in] Horizontal location of the cursor's hot spot.
//
// yHot
// [in] Vertical location of the cursor's hot spot.
//
// cx
// [in] Width of the cursor.
//
// cy
// [in] Height of the cursor.
//
// Returns:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE DDIPU_SDC::SetPointerShape(GPESurf * pMask,
GPESurf * pColorSurf,
int xHot,
int yHot,
int cx,
int cy)
{
#ifndef PLAT_PMC // PMC doesn't support cursors
UCHAR *andPtr; // input pointer
UCHAR *xorPtr; // input pointer
UCHAR *andLine; // output pointer
UCHAR *xorLine; // output pointer
char bAnd;
char bXor;
int row;
int col;
int i;
int bitMask;
// turn current cursor off
CursorOff();
// release memory associated with old cursor
if (!pMask) // do we have a new cursor shape
{
m_CursorDisabled = TRUE; // no, so tag as disabled
}
else
{
m_CursorDisabled = FALSE; // yes, so tag as not disabled
// store size and hotspot for new cursor
m_CursorSize.x = cx;
m_CursorSize.y = cy;
m_CursorHotspot.x = xHot;
m_CursorHotspot.y = yHot;
andPtr = (UCHAR*)pMask->Buffer();
xorPtr = (UCHAR*)pMask->Buffer() + (cy * pMask->Stride());
// store OR and AND mask for new cursor
for (row = 0; row < cy; row++)
{
andLine = &m_CursorAndShape[cx * row];
xorLine = &m_CursorXorShape[cx * row];
for (col = 0; col < cx / 8; col++)
{
bAnd = andPtr[row * pMask->Stride() + col];
bXor = xorPtr[row * pMask->Stride() + col];
for (bitMask = 0x0080, i = 0; i < 8; bitMask >>= 1, i++)
{
andLine[(col * 8) + i] = bAnd & bitMask ? 0xFF : 0x00;
xorLine[(col * 8) + i] = bXor & bitMask ? 0xFF : 0x00;
}
}
}
}
#endif // PLAT_PMC
return S_OK;
}
//------------------------------------------------------------------------------
//
// Function: MovePointer
//
// This method executes from applications either to move the hot spot of
// the cursor to a specific screen location or to hide the cursor.
//
// Parameters:
// x
// [in] Horizontal screen location to move the cursor to.
// Applications can pass a value of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -