DrvCopyBits not called from MS Paint

Discussion in 'Windows Vista Drivers' started by Luminita, Oct 7, 2004.

  1. Luminita

    Luminita Guest

    Hello

    I am writing a virtual printer driver and I have next problem when
    printing from MSPaint:
    - if I use a device-managed surface, created with
    EngCreateDeviceSurface(), for each page there is a call of
    DrvCopyBits() - everything works fine
    - if I use an engine-managed surface created with EngCreateBitmap(),
    there is no call of DrvCopyBits() (actually no call between
    DrvStartPage() and DrvSendPage()). The other hooks are working
    (DrvBitBlt, DrvStretchBlt,...) when painting from other applications.

    I do not have a good reason to use device-managed surface, there is
    lot more work for them and I would prefer to use the engine-managed
    surface. The only problem (so far) is that I cannot paint from
    MSPaint.

    Can you help me please, why isn't DrvCopyBits called for
    engine-managed bitmaps?

    Thanks
     
    Luminita, Oct 7, 2004
    #1
    1. Advertisements

  2. Hi luminita,

    I hope my answer will clear your doubt.

    If we see the MSDN we can have the following observation:

    From MSDN:
    "If a driver supports a device-managed surface or bitmap, the driver must
    implement the DrvCopyBits function. At a minimum, the driver must do the
    following when DrvCopyBits"

    So, in your case you were having a device-managed surface with
    hooking of DrvBitBlt,DrvStretchBlt,DrvCopyBits.
    Please note that DrvCopyBits is the minimum thing you have to hook
    It does not mean that GDI will call DrvCopyBits always. Since you are
    also hooking DrvBitBlt,DrvStretchBlt it will call them instead of calling
    lower level drvcopybits which is tedious task and time taking.

    Say some 'X' number of Drvcopybits are equal to on DrvBitBlt. So, GDI
    will prefer calling DrvBitBlt,DrvStretchBlt instead of DrvCopyBits.

    If you want to really make sure. Don't hook DrvBitBlt,DrvStretchBlt in your
    case ( for device managed surface). GDI will definetely call DrvCopyBits.

    I hope I cleared your confusion. Its something like prioritising options
    available. Why call DrvcopyBits when DrvStretchBlt is there..

    thanks
    LPrasannaKumar

    Perform a block transfer to and from a bitmap, in the device's preferred
    format, and to the device surface.
    Perform the transfer with the SRCCOPY (0xCCCC) ROP.
    Allow arbitrary clipping.
     
    LPrasannaKumar, Oct 7, 2004
    #2
    1. Advertisements

  3. Luminita

    Luminita Guest

    Hi

    Thanks for the explanation. You are right, I tested the behavior of
    DrvBitBlt / DrvStretchBlt / DrvCopyBits and it is working as you said,
    for device-managed surfaces: one call of DrvBitBlt can be replaced by
    several calls of DrvCopyBits, in case the driver does not handle
    DrvBitBlt.

    The problem is I want to use engine-managed surfaces.

    I am in this situation now:
    - I use an engine-managed bitmap surface
    - I hook all next functions: DrvBitBlt, DrvStretchBlt, DrvCopyBits
    - All above 3 hooks are working fine when printing from a different
    application (MSWord, Adobe Photoshop,...)
    - none of these 3 Drv functions is called when printing from MSPaint

    If I make the change in the driver to use a device-managed surface,
    then DrvCopyBits() is called when printing from MSPaint.

    Is it possible that the MSPaint calls EngCopyBits() directly when the
    driver is using engine-managed surfaces, so the Drv... functions are
    skipped?

    Thanks
     
    Luminita, Oct 7, 2004
    #3
  4. Can you help me please, why isn't DrvCopyBits called for
    From what I know, DrvCopyBits is used for driver-managed surfaces only, to
    convert the bitmap from the GDI standard formats to the driver's internal
    format, and vice versa.
     
    Maxim S. Shatskih, Oct 8, 2004
    #4
  5. Luminita

    Luminita Guest

    Actually DrvCopyBits is called for engine-managed surfaces when
    printing from Adobe Photoshop - I tested this.
     
    Luminita, Oct 8, 2004
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.