本文整理汇总了C++中HEIGHT函数的典型用法代码示例。如果您正苦于以下问题:C++ HEIGHT函数的具体用法?C++ HEIGHT怎么用?C++ HEIGHT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HEIGHT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LCD_PrintCharXY
void LCD_PrintCharXY(unsigned int x, unsigned int y, u32 c)
{
u8 row, col, width;
const u8 *offset = char_offset(c, &width);
if (! offset || ! width) {
printf("Could not locate character U-%04x\n", (int)c);
return;
}
// Check if the requested character is available
LCD_DrawStart(x, y, x + width - 1, y + HEIGHT(cur_str.font) - 1, DRAW_NWSE);
for (col = 0; col < width; col++)
{
const u8 *data = offset++;
u8 bit = 0;
// Data is right aligned,adrawn top to bottom
for (row = 0; row < HEIGHT(cur_str.font); ++row)
{
if (bit == 8) {
data = offset++;
bit = 0;
}
if (*data & (1 << bit)) {
LCD_DrawPixelXY(x + col, y + row, cur_str.color);
}
bit++;
}
}
LCD_DrawStop();
}
示例2: ensure_balance
struct node* ensure_balance(struct node *p)
{
// trivially balanced - return now
if (p==NULL)
return p;
p->height = 1 + MAX(HEIGHT(p->left),HEIGHT(p->right));
// left-heavy - rebalance needed
if ( HEIGHT(p->left) - HEIGHT(p->right) > 1)
{
if (HEIGHT(p->left->left) > HEIGHT(p->left->right))
p = rotate_right(p);
else {
p->left = rotate_left(p->left);
p = rotate_right(p);
}
}
// right-heavy - rebalance needed
else if ( HEIGHT(p->right) - HEIGHT(p->left) > 1)
{
if (HEIGHT(p->right->right) > HEIGHT(p->right->left))
p = rotate_left(p);
else {
p->right = rotate_right(p->right);
p = rotate_left(p);
}
}
else// balanced - no rebalance needed
;
return p;
}
示例3: avl_get_balance
static int avl_get_balance(avl_node_t* node)
{
if (node == NULL)
return 0;
else
return HEIGHT(node->left) - HEIGHT(node->right);
}
示例4: Draw
static void
Draw(void *obj)
{
AG_Slider *sl = obj;
int x;
if (GetPosition(sl, &x) == -1) {
return;
}
switch (sl->type) {
case AG_SLIDER_VERT:
AG_DrawBox(sl, AG_RECT(0,0,WIDTH(sl),HEIGHT(sl)), -1, WCOLOR(sl,0));
AG_DrawBox(sl,
AG_RECT(0, x, WIDTH(sl), sl->wControl),
sl->ctlPressed ? -1 : 1,
WCOLOR(sl,0));
break;
case AG_SLIDER_HORIZ:
AG_DrawBox(sl, AG_RECT(0,0,WIDTH(sl),HEIGHT(sl)), -1, WCOLOR(sl,0));
AG_DrawBox(sl,
AG_RECT(x, 0, sl->wControl, HEIGHT(sl)),
sl->ctlPressed ? -1 : 1,
WCOLOR(sl,0));
break;
}
}
示例5: _equalf
static int _equalf(CMATRIX *a, double f)
{
bool result;
if (COMPLEX(a))
{
if (f == 0.0)
return gsl_matrix_complex_isnull(CMAT(a));
gsl_matrix_complex *m = gsl_matrix_complex_alloc(WIDTH(a), HEIGHT(a));
gsl_matrix_complex_set_identity(m);
gsl_matrix_complex_scale(m, gsl_complex_rect(f, 0));
result = gsl_matrix_complex_equal(CMAT(a), m);
gsl_matrix_complex_free(m);
}
else
{
if (f == 0.0)
return gsl_matrix_isnull(MAT(a));
gsl_matrix *m = gsl_matrix_alloc(WIDTH(a), HEIGHT(a));
gsl_matrix_set_identity(m);
gsl_matrix_scale(m, f);
result = gsl_matrix_equal(MAT(a), m);
gsl_matrix_free(m);
}
return result;
}
示例6: GetClientRect
//-------------------------------------------------------------------------
// CmdProcessDoubleClick
// processes command "change selection" from the playback window
//-------------------------------------------------------------------------
void CMultiSAP::CmdProcessDoubleClick( int xPos, int yPos)
{
if( !m_pEffect || eEffectStagePlaying != m_pEffect->GetStage() )
{
return;
}
RECT rect;
GetClientRect( m_hwndApp, &rect );
RECT rectRT = m_movieList.GetDefaultTarget();
// given xPos, yPos are in client coordinates of the window;
// transform then to client coordinates of the render target and find the movie
float xPosRT = (float)xPos / (float)(WIDTH(&rect)) * (float)(WIDTH(&rectRT));
float yPosRT = (float)yPos / (float)(HEIGHT(&rect)) * (float)(HEIGHT(&rectRT));
CMovie *pmovie = NULL;
pmovie = m_movieList.GetMovieFromRTPoint( xPosRT, yPosRT);
if( pmovie && pmovie->m_dwUserID != m_movieList.GetSelectedMovieID() )
{
m_pdwNextSelectedMovie = pmovie->m_dwUserID;
if( m_pEffect )
{
m_pEffect->Finish();
}
CmdAddEffect(eEffectFountain, 10, 10, 10, TRUE);
return;
}
}
示例7: draw
void draw(void) {
int x, y;
double diff;
glBegin(GL_QUADS);
GLfloat c1[4] = { 0, 0, 1, 1 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, c1);
VERTEX3(0, 0, waterh);
VERTEX3(0, maph - 1, waterh);
VERTEX3(mapw - 1, maph - 1, waterh);
VERTEX3(mapw - 1, 0, waterh);
GLfloat c2[4] = { 34 / 255., 139 / 255., 34 / 255., 1 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, c2);
for(x = 0; x < mapw - 1; ++x)
for(y = 0; y < maph - 1; ++y) {
diff = HEIGHT(x, y) - HEIGHT(x + 1, y + 1);
glNormal3f(diff, diff, 2);
VERTEX2(x, y);
VERTEX2(x, y + 1);
VERTEX2(x + 1, y + 1);
VERTEX2(x + 1, y);
}
GLfloat c3[4] = { 160 / 255., 82 / 255., 45 / 255., 1 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, c3);
glNormal3i(0, -1, 0);
for(x = 0; x < mapw - 1; ++x) {
VERTEX3(x, 0, waterh);
VERTEX2(x, 0);
VERTEX2(x + 1, 0);
VERTEX3(x + 1, 0, waterh);
}
glNormal3i(1, 0, 0);
for(y = 0; y < maph - 1; ++y) {
VERTEX3(mapw - 1, y, waterh);
VERTEX2(mapw - 1, y);
VERTEX2(mapw - 1, y + 1);
VERTEX3(mapw - 1, y + 1, waterh);
}
glNormal3i(0, 1, 0);
for(x = 0; x < mapw - 1; ++x) {
VERTEX3(x, maph - 1, waterh);
VERTEX3(x + 1, maph - 1, waterh);
VERTEX2(x + 1, maph - 1);
VERTEX2(x, maph - 1);
}
glNormal3i(-1, 0, 0);
for(y = 0; y < maph - 1; ++y) {
VERTEX3(0, y, waterh);
VERTEX3(0, y + 1, waterh);
VERTEX2(0, y + 1);
VERTEX2(0, y);
}
glEnd();
}
示例8: rgz_hwc_scaled
static int rgz_hwc_scaled(hwc_layer_1_t *layer)
{
int w = WIDTH(layer->sourceCrop);
int h = HEIGHT(layer->sourceCrop);
if (layer->transform & HWC_TRANSFORM_ROT_90)
swap(w, h);
return WIDTH(layer->displayFrame) != w || HEIGHT(layer->displayFrame) != h;
}
示例9: right_right_rotation
Node* right_right_rotation(AVLTree v1)
{
AVLTree v2;
v2 = v1->right;
v1->right = v2->left;
v2->left = v1;
v1->height = MAX( HEIGHT(v1->left), HEIGHT(v1->right)) + 1;
v2->height = MAX( HEIGHT(v2->right), v1->height) + 1;
return v2;
}
示例10: left_left_rotation
Node* left_left_rotation(AVLTree v2)
{
AVLTree v1;
v1 = v2->left;
v2->left = v1->right;
v1->right = v2;
v2->height = MAX( HEIGHT(v2->left), HEIGHT(v2->right)) + 1;
v1->height = MAX( HEIGHT(v1->left), v2->height) + 1;
return v1;
}
示例11: getscaleh
static float getscaleh(hwc_layer_1_t *layer)
{
int w = WIDTH(layer->sourceCrop);
int h = HEIGHT(layer->sourceCrop);
if (layer->transform & HWC_TRANSFORM_ROT_90)
swap(w, h);
return ((float)HEIGHT(layer->displayFrame)) / (float)h;
}
示例12: rgz_src1_prep
static void rgz_src1_prep(
struct rgz_blt_entry* e, hwc_layer_1_t *l,
blit_rect_t *rect,
struct bvbuffdesc *scrdesc, struct bvsurfgeom *scrgeom)
{
if (!l)
return;
IMG_native_handle_t *handle = (IMG_native_handle_t *)l->handle;
struct bvbuffdesc *src1desc = &e->src1desc;
src1desc->structsize = sizeof(struct bvbuffdesc);
src1desc->length = handle->iHeight * HANDLE_TO_STRIDE(handle);
/*
* The virtaddr isn't going to be used in the final 2D h/w integration
* because we will be handling buffers differently
*/
src1desc->virtaddr = HANDLE_TO_BUFFER(handle);
struct bvsurfgeom *src1geom = &e->src1geom;
src1geom->structsize = sizeof(struct bvsurfgeom);
src1geom->format = hal_to_ocd(handle->iFormat);
src1geom->width = handle->iWidth;
src1geom->height = handle->iHeight;
src1geom->orientation = l->transform & HWC_TRANSFORM_ROT_90 ? 90 :
l->transform & HWC_TRANSFORM_ROT_180 ? 180 :
l->transform & HWC_TRANSFORM_ROT_270 ? 270 : 0;
src1geom->virtstride = HANDLE_TO_STRIDE(handle);
struct bvsurfgeom *dstgeom = &e->dstgeom;
dstgeom->structsize = sizeof(struct bvsurfgeom);
dstgeom->format = scrgeom->format;
dstgeom->width = scrgeom->width;
dstgeom->height = scrgeom->height;
dstgeom->orientation = 0;
dstgeom->virtstride = DSTSTRIDE(scrgeom);
struct bvbltparams *bp = &e->bp;
bp->structsize = sizeof(struct bvbltparams);
bp->dstdesc = scrdesc;
bp->dstgeom = dstgeom;
bp->dstrect.left = rect->left;
bp->dstrect.top = rect->top;
bp->dstrect.width = WIDTH(*rect);
bp->dstrect.height = HEIGHT(*rect);
bp->src1.desc = src1desc;
bp->src1geom = src1geom;
bp->src1rect.left = effective_srcleft(l, rect);
bp->src1rect.top = effective_srctop(l, rect);
bp->src1rect.width = WIDTH(*rect); // XXX fixme - effective width/height?
bp->src1rect.height = HEIGHT(*rect);
bp->cliprect.left = bp->cliprect.top = 0;
bp->cliprect.width = scrgeom->width;
bp->cliprect.height = scrgeom->height;
}
示例13: avl_remove_node
/* delete an node from tree */
static avl_node_t* avl_remove_node(avl_node_t* root, avl_key_t key)
{
int factor = 0;
int rotate = 0;
if (root == NULL)
return NULL;
if (key < root->key)
{
root->left = avl_remove_node(root->left, key);
}
else if (key > root->key)
{
root->right = avl_remove_node(root->right, key);
}
else /* this is the node to be deleted */
{
if ((root->left == NULL) || (root->right == NULL))
{
avl_node_t* node = (root->left ? root->left : root->right);
if (node != NULL) /* one child case */
{
*root = *node;
}
else /* no child case */
{
node = root;
root = NULL;
}
avl_free_node(node);
}
else /* node with two children */
{
avl_node_t* node = avl_node_min(root->right);
root->key = node->key;
root->data = node->data;
root->right = avl_remove_node(root->right, node->key);
}
}
if (root == NULL)
return NULL;
root->height = MAX(HEIGHT(root->left), HEIGHT(root->right)) + 1;
factor = avl_get_balance(root);
if (factor > 1)
{
int left_balance = avl_get_balance(root->left);
rotate = (left_balance >= 0 ? ROT_LEFT : ROT_RIGHT);
}
else if (factor < -1)
{
int right_balance = avl_get_balance(root->right);
rotate = (right_balance <= 0 ? ROT_RIGHT : ROT_LEFT);
}
return avl_balance_node(root, factor, rotate);
}
示例14: avl_node_ll_rot
/*
* left-left rotation
*
* A B
* / \ / \
* B C D A
* / \ ==> / \ / \
* D E F G E C
* / \
* F G
*/
static avl_node_t* avl_node_ll_rot(avl_node_t* A)
{
avl_node_t* B = A->left;
A->left = B->right;
B->right = A;
// update heights
A->height = MAX(HEIGHT(A->left), HEIGHT(A->right)) + 1;
B->height = MAX(HEIGHT(B->left), HEIGHT(B->right)) + 1;
return B;
}
示例15: avl_node_rr_rot
/*
* right-right rotation
*
* A C
* / \ / \
* B C A E
* / \ ==> / \ / \
* D E B D F G
* / \
* F G
*/
static avl_node_t* avl_node_rr_rot(avl_node_t* A)
{
avl_node_t* C = A->right;
A->right = C->left;
C->left = A;
// update heights
A->height = MAX(HEIGHT(A->left), HEIGHT(A->right)) + 1;
C->height = MAX(HEIGHT(C->left), HEIGHT(C->right)) + 1;
return C;
}