//***************************************************************************** // //! Draws a horizontal line. //! //! \param pContext is a pointer to the drawing context to use. //! \param i32X1 is the X coordinate of one end of the line. //! \param i32X2 is the X coordinate of the other end of the line. //! \param i32Y is the Y coordinate of the line. //! //! This function draws a horizontal line, taking advantage of the fact that //! the line is horizontal to draw it more efficiently. The clipping of the //! horizontal line to the clipping rectangle is performed within this routine; //! the display driver's horizontal line routine is used to perform the actual //! line drawing. //! //! \return None. // //***************************************************************************** void GrLineDrawH(const tContext *pContext, int32_t i32X1, int32_t i32X2, int32_t i32Y) { int32_t i32Temp; // // Check the arguments. // ASSERT(pContext); // // If the Y coordinate of this line is not in the clipping region, then // there is nothing to be done. // if((i32Y < pContext->sClipRegion.i16YMin) || (i32Y > pContext->sClipRegion.i16YMax)) { return; } // // Swap the X coordinates if the first is larger than the second. // if(i32X1 > i32X2) { i32Temp = i32X1; i32X1 = i32X2; i32X2 = i32Temp; } // // If the entire line is outside the clipping region, then there is nothing // to be done. // if((i32X1 > pContext->sClipRegion.i16XMax) || (i32X2 < pContext->sClipRegion.i16XMin)) { return; } // // Clip the starting coordinate to the left side of the clipping region if // required. // if(i32X1 < pContext->sClipRegion.i16XMin) { i32X1 = pContext->sClipRegion.i16XMin; } // // Clip the ending coordinate to the right side of the clipping region if // required. // if(i32X2 > pContext->sClipRegion.i16XMax) { i32X2 = pContext->sClipRegion.i16XMax; } // // Call the low level horizontal line drawing routine. // DpyLineDrawH(pContext->psDisplay, i32X1, i32X2, i32Y, pContext->ui32Foreground); }
//***************************************************************************** // //! Draws a horizontal line. //! //! \param pContext is a pointer to the drawing context to use. //! \param lX1 is the X coordinate of one end of the line. //! \param lX2 is the X coordinate of the other end of the line. //! \param lY is the Y coordinate of the line. //! //! This function draws a horizontal line, taking advantage of the fact that //! the line is horizontal to draw it more efficiently. The clipping of the //! horizontal line to the clipping rectangle is performed within this routine; //! the display driver's horizontal line routine is used to perform the actual //! line drawing. //! //! \return None. // //***************************************************************************** void GrLineDrawH(const tContext *pContext, long lX1, long lX2, long lY) { long lTemp; // // Check the arguments. // ASSERT(pContext); // // If the Y coordinate of this line is not in the clipping region, then // there is nothing to be done. // if((lY < pContext->sClipRegion.sYMin) || (lY > pContext->sClipRegion.sYMax)) { return; } // // Swap the X coordinates if the first is larger than the second. // if(lX1 > lX2) { lTemp = lX1; lX1 = lX2; lX2 = lTemp; } // // If the entire line is outside the clipping region, then there is nothing // to be done. // if((lX1 > pContext->sClipRegion.sXMax) || (lX2 < pContext->sClipRegion.sXMin)) { return; } // // Clip the starting coordinate to the left side of the clipping region if // required. // if(lX1 < pContext->sClipRegion.sXMin) { lX1 = pContext->sClipRegion.sXMin; } // // Clip the ending coordinate to the right side of the clipping region if // required. // if(lX2 > pContext->sClipRegion.sXMax) { lX2 = pContext->sClipRegion.sXMax; } // // Call the low level horizontal line drawing routine. // DpyLineDrawH(pContext->pDisplay, lX1, lX2, lY, pContext->ulForeground); }