[haiku-commits] haiku: hrev47564 - src/tests/servers/app/gradients

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 24 Jul 2014 12:03:33 +0200 (CEST)

hrev47564 adds 1 changeset to branch 'master'
old head: 5f22a181ecdffd85b07ecfd5015e4b3012dbdc81
new head: a694f30d6c3d2e62beba0fbb94c4262471c87c22
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=a694f30+%5E5f22a18

----------------------------------------------------------------------------

a694f30: Add more alpha gradient test cases
  
  * Add a vertical linear gradient. This bypasses AGG and uses a faster
  code path, which works.
  * Add gradients drawn in a ClipToPicture() context. This uses an
  * unpacked scanline rasterizer, which works.
  
  This hints to the problem being the use of a packed scanline rasterizer,
  with agg gradients touching the alpha channel.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev47564
Commit:      a694f30d6c3d2e62beba0fbb94c4262471c87c22
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a694f30
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Thu Jul 24 10:01:50 2014 UTC

----------------------------------------------------------------------------

1 file changed, 41 insertions(+), 3 deletions(-)
src/tests/servers/app/gradients/main.cpp | 44 ++++++++++++++++++++++++++--

----------------------------------------------------------------------------

diff --git a/src/tests/servers/app/gradients/main.cpp 
b/src/tests/servers/app/gradients/main.cpp
index 6e1a132..52c684a 100644
--- a/src/tests/servers/app/gradients/main.cpp
+++ b/src/tests/servers/app/gradients/main.cpp
@@ -17,6 +17,7 @@
 #include <LayoutBuilder.h>
 #include <List.h>
 #include <Message.h>
+#include <Picture.h>
 #include <PopUpMenu.h>
 #include <Roster.h>
 #include <ScrollView.h>
@@ -74,7 +75,7 @@ class AlphaGradientTest : public Test {
 public:
        AlphaGradientTest()
                :
-               Test("Alpha gradient")
+               Test("Alpha gradients")
        {
        }
 
@@ -92,7 +93,7 @@ public:
                g.AddColor((rgb_color){ 0, 255, 0, 0 }, 255.0);
                view->FillEllipse(center, radius, radius, g);
 
-               // Linear gradient
+               // Linear gradient - Horizontal
                BPoint from(100, 0);
                BPoint to(200, 0);
                BGradientLinear l(from, to);
@@ -100,6 +101,15 @@ public:
                l.AddColor((rgb_color){ 0, 255, 0, 255 }, 255.0);
                view->FillRect(BRect(100, 0, 200, 100), l);
 
+               // Linear gradient - Vertical
+               // (this uses a different code path in app_server)
+               BPoint top(0, 0);
+               BPoint bot(0, 100);
+               BGradientLinear v(top, bot);
+               v.AddColor((rgb_color){ 255, 0, 0, 0 }, 0.0);
+               v.AddColor((rgb_color){ 0, 255, 0, 255 }, 255.0);
+               view->FillRect(BRect(200, 0, 300, 100), v);
+
                // These draw as opaque or almost opaque
                
                view->SetOrigin(BPoint(0, 100));
@@ -110,11 +120,39 @@ public:
                go.AddColor((rgb_color){ 0, 255, 0, 255 }, 255.0);
                view->FillEllipse(center, radius, radius, go);
 
-               // Linear gradient
+               // Linear gradient - Horizontal
                BGradientLinear lo(from, to);
                lo.AddColor((rgb_color){ 255, 0, 0, 255 }, 0.0);
                lo.AddColor((rgb_color){ 0, 255, 0, 0 }, 255.0);
                view->FillRect(BRect(100, 0, 200, 100), lo);
+
+               // Linear gradient - Vertical
+               // (this uses a different code path in app_server)
+               BGradientLinear vo(top, bot);
+               vo.AddColor((rgb_color){ 255, 0, 0, 255 }, 0.0);
+               vo.AddColor((rgb_color){ 0, 255, 0, 0 }, 255.0);
+               view->FillRect(BRect(200, 0, 300, 100), vo);
+
+               // Finally, do the same using ClipToPicture. This forces using 
an
+               // unpacked scanline rasterizer, and it works.
+               view->SetOrigin(BPoint(0, 0));
+
+               view->SetDrawingMode(B_OP_COPY);
+
+               BPicture picture;
+               view->BeginPicture(&picture);
+               view->SetHighColor(make_color(0,0,0,255));
+               view->FillRect(BRect(0, 200, 300, 300));
+               view->EndPicture();
+               view->ClipToPicture(&picture);
+
+               view->SetOrigin(BPoint(0, 200));
+
+               view->SetDrawingMode(B_OP_ALPHA);
+
+               view->FillEllipse(center, radius, radius, g);
+               view->FillRect(BRect(100, 0, 200, 100), l);
+               view->FillRect(BRect(200, 0, 300, 100), v);
        }
 };
 


Other related posts:

  • » [haiku-commits] haiku: hrev47564 - src/tests/servers/app/gradients - pulkomandy