Changeset 18511 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Mar 29, 2009 3:09:25 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/vrdptext.c
r8155 r18511 78 78 * 79 79 */ 80 80 81 81 static BOOL vboxReportGlyph (GLYPHPOS *pGlyphPos, uint8_t **ppu8Ptr, uint8_t *pu8End) 82 82 { 83 83 uint32_t cbOrder; 84 84 uint32_t cbBitmap; 85 85 86 86 VRDPORDERGLYPH *pOrder = (VRDPORDERGLYPH *)*ppu8Ptr; 87 87 88 88 GLYPHBITS *pgb = pGlyphPos->pgdf->pgb; 89 89 90 90 /* BYTE-aligned 1BPP bitmap of the glyph. The array includes padding at the end to DWORD-align. */ 91 91 cbBitmap = (pgb->sizlBitmap.cx + 7) / 8; /* Line size in bytes. */ 92 92 cbBitmap *= pgb->sizlBitmap.cy; /* Size of bitmap. */ 93 93 cbBitmap = (cbBitmap + 3) & ~3; /* DWORD align. */ 94 95 cbOrder = (uint 8_t *)&pOrder->au8Bitmap - (uint8_t *)pOrder;96 94 95 cbOrder = (uint32_t)((uint8_t *)&pOrder->au8Bitmap - (uint8_t *)pOrder); 96 97 97 cbOrder += cbBitmap; 98 98 99 99 if (*ppu8Ptr + cbOrder > pu8End) 100 100 { 101 101 return FALSE; 102 102 } 103 103 104 104 pOrder->o32NextGlyph = cbOrder; 105 105 106 106 pOrder->u64Handle = RTCrc64Start (); 107 107 pOrder->u64Handle = RTCrc64Process(pOrder->u64Handle, pgb->aj, cbBitmap); 108 108 pOrder->u64Handle = RTCrc64Process(pOrder->u64Handle, &pgb->ptlOrigin, sizeof (pgb->ptlOrigin)); 109 109 pOrder->u64Handle = RTCrc64Finish(pOrder->u64Handle); 110 110 111 111 pOrder->x = (int16_t)pGlyphPos->ptl.x; 112 112 pOrder->y = (int16_t)pGlyphPos->ptl.y; 113 113 114 114 pOrder->w = (uint16_t)pgb->sizlBitmap.cx; 115 115 pOrder->h = (uint16_t)pgb->sizlBitmap.cy; … … 117 117 pOrder->xOrigin = (int16_t)pgb->ptlOrigin.x; 118 118 pOrder->yOrigin = (int16_t)pgb->ptlOrigin.y; 119 119 120 120 /* 1BPP bitmap. Rows are byte aligned. Size is (((w + 7)/8) * h + 3) & ~3. */ 121 121 memcpy (pOrder->au8Bitmap, pgb->aj, cbBitmap); 122 122 123 123 *ppu8Ptr += cbOrder; 124 124 125 125 return TRUE; 126 126 } … … 129 129 { 130 130 uint32_t cb = sizeof (VRDPORDERTEXT); 131 131 132 132 cb += cGlyphs * (sizeof (VRDPORDERGLYPH) + cbMaxGlyph); 133 133 134 134 return cb; 135 135 } … … 150 150 uint8_t *pu8GlyphPtr; 151 151 uint8_t *pu8GlyphEnd; 152 152 153 153 DISPDBG((1, "VRDP::vrdpReportText: ppdev %p, pClipRects %p, pstro %p, pfo %p, prclOpaque %p, ulForeRGB %x, ulBackRGB %x\n", 154 154 ppdev, pClipRects, pstro, pfo, prclOpaque, ulForeRGB, ulBackRGB)); 155 155 156 156 if (pstro->ulCharInc > 0xFF) 157 157 { … … 169 169 170 170 memset (&fi, 0, sizeof (fi)); 171 171 172 172 FONTOBJ_vGetInfo (pfo, sizeof (fi), &fi); 173 173 174 174 if ( fi.cjMaxGlyph1 == 0 175 175 || fi.cjMaxGlyph1 > VRDP_TEXT_MAX_GLYPH_SIZE) … … 179 179 return FALSE; 180 180 } 181 181 182 182 cbOrderMax = vboxSizeofTextOrder (pstro->cGlyphs, fi.cjMaxGlyph1); 183 183 184 184 DISPDBG((1, "VRDP::vrdpReportText: pstro->cGlyphs = %d, fi.cjMaxGlyph1 = 0x%x, cbOrderMax = 0x%x.\n", pstro->cGlyphs, fi.cjMaxGlyph1, cbOrderMax)); 185 185 186 186 pOrder = (VRDPORDERTEXT *)EngAllocMem (0, cbOrderMax, ALLOC_TAG); 187 187 188 188 if (!pOrder) 189 189 { … … 191 191 return FALSE; 192 192 } 193 193 194 194 pu8GlyphPtr = (uint8_t *)&pOrder[1]; /* Follows the order header. */ 195 195 pu8GlyphEnd = (uint8_t *)pOrder + cbOrderMax; 196 196 197 197 pOrder->xBkGround = (int16_t)pstro->rclBkGround.left; 198 198 pOrder->yBkGround = (int16_t)pstro->rclBkGround.top; … … 214 214 pOrder->hOpaque = 0; 215 215 } 216 216 217 217 pOrder->u16MaxGlyph = (uint16_t)fi.cjMaxGlyph1; 218 218 219 219 pOrder->u8Glyphs = (uint8_t)pstro->cGlyphs; 220 220 221 221 pOrder->u8Flags = (uint8_t)pstro->flAccel; 222 222 223 223 pOrder->u8CharInc = (uint8_t)pstro->ulCharInc; 224 224 225 225 pOrder->u32FgRGB = ulForeRGB; 226 226 pOrder->u32BgRGB = ulBackRGB; 227 227 228 228 DISPDBG((1, "VRDP::vrdpReportText: pstro->pgp %p.\n", pstro->pgp)); 229 229 230 230 /* Enumerate glyphs. */ 231 231 STROBJ_vEnumStart (pstro); 232 232 233 233 fResult = TRUE; 234 234 235 235 for (;;) 236 236 { … … 238 238 ULONG cGlyphs = 0; 239 239 GLYPHPOS *pGlyphPos = NULL; 240 240 241 241 BOOL fMore = STROBJ_bEnum (pstro, &cGlyphs, &pGlyphPos); 242 242 243 243 DISPDBG((1, "VRDP::vrdpReportText: cGlyphs %d.\n", cGlyphs)); 244 244 245 245 for (i = 0; i < cGlyphs; i++) 246 246 { 247 247 fResult = vboxReportGlyph (&pGlyphPos[i], &pu8GlyphPtr, pu8GlyphEnd); 248 248 249 249 if (!fResult) 250 250 { … … 252 252 } 253 253 } 254 254 255 255 if (!fMore || !fResult) 256 256 { … … 260 260 261 261 DISPDBG((1, "VRDP::vrdpReportText: fResult %d.\n", fResult)); 262 262 263 263 if (fResult) 264 264 { 265 pOrder->cbOrder = pu8GlyphPtr - (uint8_t *)pOrder;265 pOrder->cbOrder = (uint32_t)(pu8GlyphPtr - (uint8_t *)pOrder); 266 266 267 267 vrdpReportOrderGeneric (ppdev, pClipRects, pOrder, pOrder->cbOrder, VRDP_ORDER_TEXT); 268 268 } 269 269 270 270 EngFreeMem (pOrder); 271 271 272 272 return fResult; 273 273 }
Note:
See TracChangeset
for help on using the changeset viewer.