nanogui: Thread: blitting with more than 8bpp


[<<] [<] Page 1 of 1 [>] [>>]
Subject: blitting with more than 8bpp
From: Kyle Harris ####@####.####
Date: 22 Dec 1999 18:52:25 -0000
Message-Id: <38611C38.EC43E772@nexus-tech.net>

There appears to be a bug in the bit blitting when the color depth is
more than 8bpp. It seems the following patch for fblin16.c should work,
but it doesn't. I must be overlooking something.

--- fblin16.c   Wed Dec 22 21:25:48 1999
+++ fblin16.c~  Wed Dec 22 21:30:22 1999
@@ -133,11 +133,8 @@
        assert (srcy+h <= srcpsd->yres);

        DRAWON;
-       dst = dstpsd->addr + (dstx + dsty * dlinelen)*2;
-       src = srcpsd->addr + (srcx + srcy * slinelen)*2;
-       w *= 2;
-       dlinelen *= 2;
-       slinelen *= 2;
+       dst = dstpsd->addr + dstx + dsty * dlinelen;
+       src = srcpsd->addr + srcx + srcy * slinelen;
        while(--h >= 0) {
 #if 0
                /* a _fast_ memcpy is a _must_ in this routine*/

Subject: Re: blitting with more than 8bpp
From: "Greg Haerr" ####@####.####
Date: 23 Dec 1999 17:47:40 -0000
Message-Id: <008f01bf4d5c$4c80c260$15320cd0@gregh>

Kyle - 
    Other folks have reported that 16bpp works, but perhaps
they're not running the blit demo.

Your patch also will fail in the for loop:
    for(i=0; i<w; ++i)
        *dst++ = *src++;

because you have doubled "w", and dst and src
are ADDR16's, not addr8's.

I sugguest you try a different patch, on the original code:
set "dst = dstpsd->addr; src = srcpsd->addr"


and then change the lines
    dst = dstpsd->addr + dstx + ...
    src = srcpsd->addr + srcx + ...

to 
    dst += dstx + ...
    src+= srcx + ...

Let me know how this goes...

Greg


: --- fblin16.c   Wed Dec 22 21:25:48 1999
: +++ fblin16.c~  Wed Dec 22 21:30:22 1999
: @@ -133,11 +133,8 @@
:         assert (srcy+h <= srcpsd->yres);
: 
:         DRAWON;
: -       dst = dstpsd->addr + (dstx + dsty * dlinelen)*2;
: -       src = srcpsd->addr + (srcx + srcy * slinelen)*2;
: -       w *= 2;
: -       dlinelen *= 2;
: -       slinelen *= 2;
: +       dst = dstpsd->addr + dstx + dsty * dlinelen;
: +       src = srcpsd->addr + srcx + srcy * slinelen;
:         while(--h >= 0) {
:  #if 0
:                 /* a _fast_ memcpy is a _must_ in this routine*/
: 
: 
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: ####@####.####
: For additional commands, e-mail: ####@####.####
: 
: 

Subject: Re: blitting with more than 8bpp
From: Kyle Harris ####@####.####
Date: 7 Jan 2000 16:34:58 -0000
Message-Id: <38761143.D5ED40E5@nexus-tech.net>


Greg Haerr wrote:
> 
> Kyle -
>     Other folks have reported that 16bpp works, but perhaps
> they're not running the blit demo.
> 
> Your patch also will fail in the for loop:
>     for(i=0; i<w; ++i)
>         *dst++ = *src++;
> 
[snip..]

I finally got back around to looking at this (busy with Y2K bugs... just
kidding :). I think there is a bug here. I missed the fact that dst and
src are pointers to shorts. So, my original patch was wrong. But, the
initialization of these two pointers do not appear to consider the bpp
correctly. Here's a patch that seems to work.

--- fblin16.c   Fri Jan  7 05:59:41 2000
+++ fblin16.c.orig      Fri Jan  7 05:56:06 2000
@@ -133,8 +133,8 @@
        assert (srcy+h <= srcpsd->yres);

        DRAWON;
-       dst = dstpsd->addr + (dstx + dsty * dlinelen)*2;
-       src = srcpsd->addr + (srcx + srcy * slinelen)*2;
+       dst = dstpsd->addr + dstx + dsty * dlinelen;
+       src = srcpsd->addr + srcx + srcy * slinelen;
        while(--h >= 0) {
 #if 0
                /* a _fast_ memcpy is a _must_ in this routine*/


On a slightly different note. I need to read a jpeg image into memory
and then blit it to screen. I beleive you mentioned providing a
GrCopyArea function. Will this provide this feature or do I need
something else?

Thanks, Kyle.

Subject: RE: blitting with more than 8bpp
From: Greg Haerr ####@####.####
Date: 7 Jan 2000 17:41:54 -0000
Message-Id: <C1962B36D9BBD311B0F80060083DFEFB01E60D@SYS.CenSoft.COM>

:I missed the fact that dst and
: src are pointers to shorts. So, my original patch was wrong. But, the
: initialization of these two pointers do not appear to consider the bpp
: correctly. Here's a patch that seems to work.
: 
: --- fblin16.c   Fri Jan  7 05:59:41 2000
: +++ fblin16.c.orig      Fri Jan  7 05:56:06 2000
: @@ -133,8 +133,8 @@
:         assert (srcy+h <= srcpsd->yres);
: 
:         DRAWON;
: -       dst = dstpsd->addr + (dstx + dsty * dlinelen)*2;
: -       src = srcpsd->addr + (srcx + srcy * slinelen)*2;
: +       dst = dstpsd->addr + dstx + dsty * dlinelen;
: +       src = srcpsd->addr + srcx + srcy * slinelen;
:         while(--h >= 0) {

Kyle - I'm a little confused here.  My source already matches
your patch "+'" lines.  Your original source doesn't match.
Perhaps you should check your fblin16.c with the most recent
sources (any 0.87pre2 or pre3)


: 
: 
: On a slightly different note. I need to read a jpeg image into memory
: and then blit it to screen. I beleive you mentioned providing a
: GrCopyArea function. Will this provide this feature or do I need
: something else?
:

I have written GrCopyArea for Nano-X yet; yes that's what you need.
However, Nano-X also will need to support off-screen drawing, so
that you can "draw" offscreen using the normal functions.

However - folks are using the already implemented GrArea()
function which will draw directly to the screen.  So if your
jpeg decoder just sets bits in GrArea() format (PF_PIXELVAL
and PF_RGB formats are supported), then you can make
this work now.  In addition,  Martin Joliceour is working on this
as well.

Regards,

Greg

Subject: Re: blitting with more than 8bpp
From: Alistair Riddoch ####@####.####
Date: 7 Jan 2000 17:51:24 -0000
Message-Id: <20000107185756.A16304@impulse.ecs.soton.ac.uk>

On Fri, Jan 07, 2000 at 10:38:17AM -0700, Greg Haerr wrote:
> :I missed the fact that dst and
> : src are pointers to shorts. So, my original patch was wrong. But, the
> : initialization of these two pointers do not appear to consider the bpp
> : correctly. Here's a patch that seems to work.
> : 
> : --- fblin16.c   Fri Jan  7 05:59:41 2000
> : +++ fblin16.c.orig      Fri Jan  7 05:56:06 2000
> : @@ -133,8 +133,8 @@
> :         assert (srcy+h <= srcpsd->yres);
> : 
> :         DRAWON;
> : -       dst = dstpsd->addr + (dstx + dsty * dlinelen)*2;
> : -       src = srcpsd->addr + (srcx + srcy * slinelen)*2;
> : +       dst = dstpsd->addr + dstx + dsty * dlinelen;
> : +       src = srcpsd->addr + srcx + srcy * slinelen;
> :         while(--h >= 0) {
> 
> Kyle - I'm a little confused here.  My source already matches
> your patch "+'" lines.  Your original source doesn't match.
> Perhaps you should check your fblin16.c with the most recent
> sources (any 0.87pre2 or pre3)

It looks as though the patch was generated backwards from the header
(fblin16.c -> fblin16.c.orig).

The lines with + are the original, the - lines are the updated ones.

Al
[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.