Ignore:
Timestamp:
Aug 5, 2002, 8:57:15 PM (23 years ago)
Author:
umoeller
Message:

Misc fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/gpih.c

    r191 r195  
    25072507 *      replacement for WinDrawPointer that can do clipping.
    25082508 *
    2509  *      To do clipping with WinDrawPointer, one has to
    2510  *      alter the clip rectangle for the current HPS,
    2511  *      which involves creating regions and is thus quite
    2512  *      some overhead.
    2513  *
    2514  *      Instead, this function  allows for specifying a clip
    2515  *      rectangle directly. Besides, since it uses GpiWCBitBlt,
    2516  *      it should probably work with all types of device contexts.
     2509 *      Normally, to do clipping with WinDrawPointer, one
     2510 *      would have to alter the clip rectangle for the current
     2511 *      HPS, which requires creating regions and is thus quite
     2512 *      expensive.
     2513 *
     2514 *      Instead, this function allows for specifying a clip
     2515 *      rectangle directly. It blits the icon bitmaps directly
     2516 *      without calling WinDrawPointer.
     2517 *      Besides, since it uses GpiWCBitBlt, it should probably
     2518 *      work with all types of device contexts.
    25172519 *
    25182520 *      This also replaces gpihIcon2Bitmap, which wasn't quite
     
    25222524 *      If you don't need clipping and are drawing to the
    25232525 *      screen only, this function has no advantage over
    2524  *      WinDrawPointer because it's presumably slower.
     2526 *      WinDrawPointer because it's presumably a bit slower.
    25252527 *
    25262528 *      Flags presently supported in fl:
     
    25282530 *      --  DP_MINI (not DP_MINIICON, as stated in PMREF):
    25292531 *          use mini-icon.
     2532 *
     2533 *      --  DP_HALFTONED (V0.9.20)
    25302534 *
    25312535 *      Preconditions:
     
    25402544 *
    25412545 *@@added V0.9.19 (2002-06-18) [umoeller]
     2546 *@@changed V0.9.20 (2002-07-31) [umoeller]: optimized, saved one GpiQueryBitmapInfoHeader
     2547 *@@changed V0.9.20 (2002-08-04) [umoeller]: added DP_HALFTONED
    25422548 */
    25432549
     
    25592565        POINTL  aptl[4];
    25602566        HBITMAP hbmThis;
    2561         BITMAPINFOHEADER2 bmi;
     2567        BITMAPINFOHEADER2 bmiAndXor,
     2568                          bmiColor;
    25622569
    25632570        // A HPOINTER really consists of two bitmaps,
     
    26452652            GpiSetBackColor(hps, RGBCOL_BLACK);
    26462653
     2654            if (fl & DP_HALFTONED) // V0.9.20 (2002-08-04) [umoeller]
     2655                GpiSetPattern(hps, PATSYM_HALFTONE);
     2656
    26472657            /*
    26482658             * 1)   work on the AND image
     
    26562666               )
    26572667            {
    2658                 bmi.cbFix = sizeof(bmi);
    2659                 GpiQueryBitmapInfoHeader(hbmThis, &bmi);
     2668                bmiAndXor.cbFix = sizeof(bmiAndXor);
     2669                GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor);
    26602670
    26612671                // use only half the bitmap height
    2662                 cySrc = bmi.cy / 2;
     2672                cySrc = bmiAndXor.cy / 2;
    26632673
    26642674                // aptl[2]: source bottom-left
    26652675                aptl[2].x =   0
    2666                             + lClipLeft   * bmi.cx / cxIcon;
     2676                            + lClipLeft   * bmiAndXor.cx / cxIcon;
    26672677                aptl[2].y =   cySrc
    26682678                            + lClipBottom * cySrc / cyIcon;
    26692679
    26702680                // aptl[3]: source top-right (exclusive!)
    2671                 aptl[3].x =   bmi.cx
    2672                             - lClipRight  * bmi.cx / cxIcon;
    2673                 aptl[3].y =   bmi.cy
     2681                aptl[3].x =   bmiAndXor.cx
     2682                            - lClipRight  * bmiAndXor.cx / cxIcon;
     2683                aptl[3].y =   bmiAndXor.cy
    26742684                            - lClipTop    * cySrc / cyIcon;
    26752685
     
    26932703               )
    26942704            {
    2695                 bmi.cbFix = sizeof(bmi);
    2696                 GpiQueryBitmapInfoHeader(hbmThis, &bmi);
     2705                bmiColor.cbFix = sizeof(bmiColor);
     2706                GpiQueryBitmapInfoHeader(hbmThis, &bmiColor);
    26972707
    26982708                // aptl[2]: source bottom-left
    26992709                aptl[2].x =   0
    2700                             + lClipLeft   * bmi.cx / cxIcon;
     2710                            + lClipLeft   * bmiColor.cx / cxIcon;
    27012711                aptl[2].y =   0
    2702                             + lClipBottom * bmi.cy / cyIcon;
     2712                            + lClipBottom * bmiColor.cy / cyIcon;
    27032713
    27042714                // aptl[3]: source top-right (exclusive!)
    2705                 aptl[3].x =   bmi.cx
    2706                             - lClipRight  * bmi.cx / cxIcon;
    2707                 aptl[3].y =   bmi.cy
    2708                             - lClipTop    * bmi.cy / cyIcon;
     2715                aptl[3].x =   bmiColor.cx
     2716                            - lClipRight  * bmiColor.cx / cxIcon;
     2717                aptl[3].y =   bmiColor.cy
     2718                            - lClipTop    * bmiColor.cy / cyIcon;
    27092719
    27102720                GpiWCBitBlt(hps,        // target
     
    27272737               )
    27282738            {
    2729                 bmi.cbFix = sizeof(bmi);
    2730                 GpiQueryBitmapInfoHeader(hbmThis, &bmi);
     2739                /*  we queried this one above V0.9.20 (2002-07-31) [umoeller]
     2740                bmiAndXor.cbFix = sizeof(bmiAndXor);
     2741                GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor);
     2742                */
    27312743
    27322744                // use only half the bitmap height
    2733                 cySrc = bmi.cy / 2;
     2745                cySrc = bmiAndXor.cy / 2;
    27342746
    27352747                // aptl[2]: source bottom-left
    27362748                aptl[2].x =   0
    2737                             + lClipLeft   * bmi.cx / cxIcon;
     2749                            + lClipLeft   * bmiAndXor.cx / cxIcon;
    27382750                aptl[2].y =   0
    27392751                            + lClipBottom * cySrc / cyIcon;
    27402752
    27412753                // aptl[3]: source top-right (exclusive!)
    2742                 aptl[3].x =   bmi.cx
    2743                             - lClipRight  * bmi.cx / cxIcon;
     2754                aptl[3].x =   bmiAndXor.cx
     2755                            - lClipRight  * bmiAndXor.cx / cxIcon;
    27442756                aptl[3].y =   cySrc
    27452757                            - lClipTop    * cySrc / cyIcon;
Note: See TracChangeset for help on using the changeset viewer.