Bug 593604. Part 4: Create Layer::GetSurfaceMode to help determine what kind of alpha support the layer needs. r=vlad,a=blocking
authorRobert O'Callahan <robert@ocallahan.org>
Mon, 03 Jan 2011 14:48:09 +1300
changeset 59769 10ea906a2791939711136630367bdbe01ee5626e
parent 59768 e427b4ea7e2ff980769e1acd92f4730c5ed3654f
child 59770 77cb8bb83b129b791f959b792ee3faf91e36ed46
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersvlad, blocking
bugs593604
milestone2.0b9pre
Bug 593604. Part 4: Create Layer::GetSurfaceMode to help determine what kind of alpha support the layer needs. r=vlad,a=blocking
gfx/layers/Layers.h
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -626,16 +626,30 @@ public:
 
   // Returns true if it's OK to save the contents of aLayer in an
   // opaque surface (a surface without an alpha channel).
   // If we can use a surface without an alpha channel, we should, because
   // it will often make painting of antialiased text faster and higher
   // quality.
   PRBool CanUseOpaqueSurface();
 
+  enum SurfaceMode {
+    SURFACE_OPAQUE,
+    SURFACE_SINGLE_CHANNEL_ALPHA,
+    SURFACE_COMPONENT_ALPHA
+  };
+  SurfaceMode GetSurfaceMode()
+  {
+    if (CanUseOpaqueSurface())
+      return SURFACE_OPAQUE;
+    if (mContentFlags & CONTENT_COMPONENT_ALPHA)
+      return SURFACE_COMPONENT_ALPHA;
+    return SURFACE_SINGLE_CHANNEL_ALPHA;
+  }
+
   /**
    * This setter can be used anytime. The user data for all keys is
    * initially null. Ownership pases to the layer manager.
    */
   void SetUserData(void* aKey, LayerUserData* aData)
   { mUserData.Set(aKey, aData); }
   /**
    * This can be used anytime. Ownership passes to the caller!