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(); }
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; }
static int avl_get_balance(avl_node_t* node) { if (node == NULL) return 0; else return HEIGHT(node->left) - HEIGHT(node->right); }
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; } }
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; }
//------------------------------------------------------------------------- // 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; } }
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(); }
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; }
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; }
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; }
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; }
void CToolsPanelContainer::SetWindowsPos(const RECT& rect) { if (!pTopToolsPanel || !pBotToolsPanel) return; // position top toolbar pTopToolsPanel->SetWindowPos(NULL, rect.left, rect.top, WIDTH(rect), HEIGHT(rect), SWP_NOZORDER | SWP_NOACTIVATE); // position bottom toolbar pBotToolsPanel->SetWindowPos(NULL, rect.left, rect.bottom, WIDTH(rect), HEIGHT(rect), SWP_NOZORDER | SWP_NOACTIVATE); }
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; }
/* 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); }
/* * 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; }
/* * 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; }
struct node* rotate_left(struct node *p) { struct node *q; assert(p!=NULL); assert(p->right!=NULL); q = p->right; p->right = q->left; q->left = p; p->height = 1 + MAX(HEIGHT(p->left),HEIGHT(p->right)); q->height = 1 + MAX(HEIGHT(q->left),HEIGHT(q->right)); return q; }
void LoadTerrain (char *filename) { grsBitmap bmHeight; int iff_error; int i, j; ubyte h, hMin, hMax; LogErr (" loading terrain height map\n"); iff_error = iff_read_bitmap (filename, &bmHeight, BM_LINEAR); if (iff_error != IFF_NO_ERROR) { #if TRACE con_printf (1, "File %s - IFF error: %s", filename, iff_errormsg (iff_error)); #endif Error ("File %s - IFF error: %s", filename, iff_errormsg (iff_error)); } if (gameData.render.terrain.pHeightMap) D2_FREE (gameData.render.terrain.pHeightMap) else atexit (FreeTerrainHeightMap); //first time gameData.render.terrain.nGridW = bmHeight.bmProps.w; gameData.render.terrain.nGridH = bmHeight.bmProps.h; Assert (gameData.render.terrain.nGridW <= TERRAIN_GRID_MAX_SIZE); Assert (gameData.render.terrain.nGridH <= TERRAIN_GRID_MAX_SIZE); LogErr ("heightmap loaded, size=%dx%d\n", gameData.render.terrain.nGridW, gameData.render.terrain.nGridH); gameData.render.terrain.pHeightMap = bmHeight.bmTexBuf; hMax = 0; hMin = 255; for (i = 0; i < gameData.render.terrain.nGridW; i++) for (j = 0; j < gameData.render.terrain.nGridH; j++) { h = HEIGHT (i, j); if (h > hMax) hMax = h; if (h < hMin) hMin = h; } for (i = 0; i < gameData.render.terrain.nGridW; i++) { for (j = 0; j < gameData.render.terrain.nGridH; j++) { HEIGHT (i, j) -= hMin; } } // D2_FREE (bmHeight.bmTexBuf); gameData.render.terrain.bmP = gameData.endLevel.terrain.bmP; #if 0 //the following code turns the (palettized) terrain texture into a white TGA texture for testing gameData.render.terrain.bmP->bmProps.rowSize *= 4; gameData.render.terrain.bmP->bmProps.flags |= BM_FLAG_TGA; D2_FREE (gameData.render.terrain.bmP->bmTexBuf); gameData.render.terrain.bmP->bmTexBuf = D2_ALLOC (gameData.render.terrain.bmP->bmProps.h * gameData.render.terrain.bmP->bmProps.rowSize); memset (gameData.render.terrain.bmP->bmTexBuf, 0xFF, gameData.render.terrain.bmP->bmProps.h * gameData.render.terrain.bmP->bmProps.rowSize); #endif LogErr (" building terrain light map\n"); BuildTerrainLightMap (); }
/* * RR:右右对应的情况(右单旋转)。 * * 返回值:旋转后的根节点 */ static Node* right_right_rotation(AVLTree k1) { AVLTree k2; k2 = k1->right; k1->right = k2->left; k2->left = k1; k1->height = MAX( HEIGHT(k1->left), HEIGHT(k1->right)) + 1; k2->height = MAX( HEIGHT(k2->right), k1->height) + 1; return k2; }
/* * LL:左左对应的情况(左单旋转)。 * * 返回值:旋转后的根节点 */ static Node* left_left_rotation(AVLTree k2) { AVLTree k1; k1 = k2->left; k2->left = k1->right; k1->right = k2; k2->height = MAX( HEIGHT(k2->left), HEIGHT(k2->right)) + 1; k1->height = MAX( HEIGHT(k1->left), k2->height) + 1; return k1; }
void LoadTerrain (char *filename) { CBitmap bmHeight; int iff_error; int i, j; ubyte h, hMin, hMax; CIFF iff; PrintLog (" loading terrain height map\n"); memset (&bmHeight, 0, sizeof (bmHeight)); iff_error = iff.ReadBitmap (filename, &bmHeight, BM_LINEAR); if (iff_error != IFF_NO_ERROR) { #if TRACE console.printf (1, "File %s - IFF error: %s", filename, iff.ErrorMsg (iff_error)); #endif Error ("File %s - IFF error: %s", filename, iff.ErrorMsg (iff_error)); } gameData.render.terrain.heightmap.Destroy (); gameData.render.terrain.nGridW = bmHeight.Width (); gameData.render.terrain.nGridH = bmHeight.Height (); Assert (gameData.render.terrain.nGridW <= TERRAIN_GRID_MAX_SIZE); Assert (gameData.render.terrain.nGridH <= TERRAIN_GRID_MAX_SIZE); PrintLog ("heightmap loaded, size=%dx%d\n", gameData.render.terrain.nGridW, gameData.render.terrain.nGridH); gameData.render.terrain.heightmap = bmHeight; hMax = 0; hMin = 255; for (i = 0; i < gameData.render.terrain.nGridW; i++) for (j = 0; j < gameData.render.terrain.nGridH; j++) { h = HEIGHT (i, j); if (h > hMax) hMax = h; if (h < hMin) hMin = h; } for (i = 0; i < gameData.render.terrain.nGridW; i++) { for (j = 0; j < gameData.render.terrain.nGridH; j++) { HEIGHT (i, j) -= hMin; } } gameData.render.terrain.bmP = gameData.endLevel.terrain.bmP; #if 0 //the following code turns the (palettized) terrain texture into a white TGA texture for testing gameData.render.terrain.bmP->props.rowSize *= 4; gameData.render.terrain.bmP->props.flags |= BM_FLAG_TGA; gameData.render.terrain.bmP->DestroyBuffer (); gameData.render.terrain.bmP->CreateBuffer (gameData.render.terrain.bmP->Height () * gameData.render.terrain.bmP->props.rowSize); gameData.render.terrain.bmP->Clear (0xFF); #endif PrintLog (" building terrain light map\n"); BuildTerrainLightmap (); }
static int _equal(CMATRIX *a, CMATRIX *b) { if (WIDTH(a) != WIDTH(b) || HEIGHT(a) != HEIGHT(b)) return FALSE; if (COMPLEX(a) || COMPLEX(b)) { MATRIX_ensure_complex(a); MATRIX_ensure_complex(b); return gsl_matrix_complex_equal(CMAT(a), CMAT(b)); } else return gsl_matrix_equal(MAT(a), MAT(b)); }
static void Draw(void *p) { AG_Button *bu = p; AG_Variable *binding; void *pState; int pressed; binding = AG_GetVariable(bu, "state", &pState); pressed = GetState(bu, binding, pState); AG_UnlockVariable(binding); if (AG_WidgetEnabled(bu)) { AG_DrawBox(bu, AG_RECT(0, 0, WIDTH(bu), HEIGHT(bu)), pressed ? -1 : 1, WCOLOR(bu,0)); } else { AG_DrawBoxDisabled(bu, AG_RECT(0, 0, WIDTH(bu), HEIGHT(bu)), pressed ? -1 : 1, WCOLOR_DEF(bu,0), WCOLOR_DIS(bu,0)); } if (bu->lbl != NULL) { AG_WidgetDraw(bu->lbl); } else if (bu->surface != -1) { int w = WSURFACE(bu,bu->surface)->w; int h = WSURFACE(bu,bu->surface)->h; int x = 0, y = 0; switch (bu->justify) { case AG_TEXT_LEFT: x = bu->lPad; break; case AG_TEXT_CENTER: x = WIDTH(bu)/2 - w/2; break; case AG_TEXT_RIGHT: x = WIDTH(bu) - w - bu->rPad; break; } switch (bu->valign) { case AG_TEXT_TOP: y = bu->tPad; break; case AG_TEXT_MIDDLE: y = HEIGHT(bu)/2 - h/2; break; case AG_TEXT_BOTTOM: y = HEIGHT(bu) - h - bu->bPad; break; } if (pressed) { x++; y++; } AG_WidgetBlitSurface(bu, bu->surface, x, y); } }
static pnode LL(pnode p) { /* * p lc * / \ * / \ * lc p */ pnode lc=p->left; p->left=lc->right; lc->right=p; p->height=MAX(HEIGHT(p->left),HEIGHT(p->right))+1; lc->height=MAX(HEIGHT(lc->left),HEIGHT(lc->right))+1; return lc; }
static pnode RR(pnode p) { /* * p p * \ / * \ / * rc rc */ pnode rc=p->right; p->right=rc->left; rc->left=p; p->height=MAX(HEIGHT(p->left),HEIGHT(p->right))+1; rc->height=MAX(HEIGHT(rc->left),HEIGHT(p->right))+1; return rc; }
void CECardDialog::PositionWindow() { HWND hParent = GetParent(); POINT ptCursor; ::GetCursorPos(&ptCursor); RECT rParent; ::GetWindowRect(hParent, &rParent); ClientToScreen(&rParent); RECT rRect; GetWindowRect(&rRect); ClientToScreen(&rRect); POINT ptNew; if (ptCursor.x < (rParent.left + rParent.right)/2) ptNew.x = ptCursor.x; else ptNew.x = ptCursor.x - WIDTH(rRect); if (ptCursor.y < (rParent.top + rParent.bottom)/2) ptNew.y = ptCursor.y + 10; else ptNew.y = ptCursor.y - HEIGHT(rRect) - 10; SetWindowPos(HWND_TOPMOST, ptNew.x, ptNew.y, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); }
static void rgz_src2blend_prep( struct rgz_blt_entry* e, hwc_layer_1_t *l, blit_rect_t *rect) { IMG_native_handle_t *handle = (IMG_native_handle_t *)l->handle; struct bvbuffdesc *src2desc = &e->src2desc; src2desc->structsize = sizeof(struct bvbuffdesc); src2desc->length = handle->iHeight * HANDLE_TO_STRIDE(handle); src2desc->virtaddr = HANDLE_TO_BUFFER(handle); /* XXX caution virtaddr */ struct bvsurfgeom *src2geom = &e->src2geom; src2geom->structsize = sizeof(struct bvsurfgeom); src2geom->format = hal_to_ocd(handle->iFormat); src2geom->width = handle->iWidth; src2geom->height = handle->iHeight; src2geom->orientation = l->transform & HWC_TRANSFORM_ROT_90 ? 90 : l->transform & HWC_TRANSFORM_ROT_180 ? 180 : l->transform & HWC_TRANSFORM_ROT_270 ? 270 : 0; src2geom->virtstride = HANDLE_TO_STRIDE(handle); /* * This looks a little odd but what we need to do here is take the * rectangle which has coordinates in terms of the display dimensions * and find the offset of the source buffer for the layer */ blit_rect_t src2rect = *rect; src2rect.top = effective_srctop(l, rect); src2rect.left = effective_srcleft(l, rect); src2rect.bottom = src2rect.top + HEIGHT(*rect); src2rect.right = src2rect.left + WIDTH(*rect); rgz_src2blend_prep2(e, l->transform, &src2rect, src2desc, src2geom); }
void ExynosMPP::setupSource(exynos_mpp_img &src_img, hwc_layer_1_t &layer) { private_handle_t *src_handle = private_handle_t::dynamicCast(layer.handle); src_img.x = ALIGN((unsigned int)layer.sourceCropf.left, srcXOffsetAlign(layer)); src_img.y = ALIGN((unsigned int)layer.sourceCropf.top, srcYOffsetAlign(layer)); src_img.w = WIDTH(layer.sourceCropf); src_img.fw = src_handle->stride; src_img.h = HEIGHT(layer.sourceCropf); src_img.fh = src_handle->vstride; src_img.yaddr = src_handle->fd; if (mS3DMode == S3D_SBS) src_img.w /= 2; if (mS3DMode == S3D_TB) src_img.h /= 2; if (isFormatYCrCb(src_handle->format)) { src_img.uaddr = src_handle->fd2; src_img.vaddr = src_handle->fd1; } else { src_img.uaddr = src_handle->fd1; src_img.vaddr = src_handle->fd2; } if (src_handle->format != HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL) src_img.format = src_handle->format; else src_img.format = HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M; src_img.drmMode = !!(getDrmMode(src_handle->flags) == SECURE_DRM); src_img.acquireFenceFd = layer.acquireFenceFd; }
static bool matrix_determinant(CMATRIX *m, COMPLEX_VALUE *det) { int sign = 0; int size = WIDTH(m); if (size != HEIGHT(m)) return TRUE; gsl_permutation *p = gsl_permutation_calloc(size); if (COMPLEX(m)) { gsl_matrix_complex *tmp = gsl_matrix_complex_alloc(size, size); gsl_matrix_complex_memcpy(tmp, CMAT(m)); gsl_linalg_complex_LU_decomp(tmp, p, &sign); det->z = gsl_linalg_complex_LU_det(tmp, sign); gsl_matrix_complex_free(tmp); } else { gsl_matrix *tmp = gsl_matrix_alloc(size, size); gsl_matrix_memcpy(tmp, MAT(m)); gsl_linalg_LU_decomp(tmp, p, &sign); det->x = gsl_linalg_LU_det(tmp, sign); det->z.dat[1] = 0; gsl_matrix_free(tmp); } gsl_permutation_free(p); return FALSE; }
static void bstackhoriz(Monitor *m) { int x, y, h, w, mh; unsigned int i, n; Client *c; for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); if(n == 0) return; /* master */ c = nexttiled(m->clients); mh = m->mfact * m->wh; resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * c->bw, False); if(--n == 0) return; /* tile stack */ x = m->wx; y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh; w = m->ww; h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh; h /= n; if(h < bh) h = m->wh; for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) ? m->wy + m->wh - y - 2 * c->bw : h - 2 * c->bw), False); if(h != m->wh) y = c->y + HEIGHT(c); } }