graphicscomposition/openwfcompositionengine/composition/src/wfcpipeline.c
changeset 152 9f1c3fea0f87
parent 36 01a6848ebfd7
--- a/graphicscomposition/openwfcompositionengine/composition/src/wfcpipeline.c	Tue Jul 06 15:45:57 2010 +0300
+++ b/graphicscomposition/openwfcompositionengine/composition/src/wfcpipeline.c	Wed Aug 18 11:05:09 2010 +0300
@@ -1,4 +1,5 @@
 /* Copyright (c) 2009-2010 The Khronos Group Inc.
+ * Portions copyright (c) 2009-2010  Nokia Corporation and/or its subsidiary(-ies)
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and/or associated documentation files (the
@@ -103,10 +104,6 @@
     state->blendInfo.mask                  = state->originalMaskImage ? state->maskImage : NULL;
     state->blendInfo.globalAlpha           = state->globalAlpha;
     
-    /* composition does not use these values ever */
-    state->blendInfo.tsColor                = NULL;
-    state->blendInfo.destinationFullyOpaque = OWF_FALSE;    
-    
     DPRINT(("  globalAplha = %f", state->globalAlpha));
     /* no need to check with OWF_ALPHA_MIN_VALUE as it is zero */
     OWF_ASSERT(state->blendInfo.globalAlpha <= OWF_ALPHA_MAX_VALUE);    
@@ -337,7 +334,6 @@
         return NULL;
     }
 
-    
     /* setup temporary images used in composition. since the original
        source data must not be altered, we must copy it to scratch buffer
        and work it there. another scratch buffer is needed for scaling
@@ -352,7 +348,22 @@
     state->globalAlpha = element->globalAlpha;
     state->sourceScaleFilter = element->sourceScaleFilter;
     state->transparencyTypes = element->transparencyTypes;
-    /* replicate the source viewport rectangle and target extent rectangle */
+
+    if (state->transparencyTypes & WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA)
+        {
+        if (state->globalAlpha == OWF_FULLY_TRANSPARENT)
+            {
+            /* Fully transparent element - no contribution. */
+            return NULL;
+            }
+        if (state->globalAlpha == OWF_FULLY_OPAQUE)
+            {
+            /* Fully opaque global alpha - global alpha can be ignored */
+            state->transparencyTypes &= ~WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA;
+            }
+        }
+    
+/* replicate the source viewport rectangle and target extent rectangle */
     for (x = 0; x < 4; x++)
     {
         state->sourceRect[x] = element->srcRect[x];