gfx/layers/basic/BasicContainerLayer.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/basic/BasicContainerLayer.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef GFX_BASICCONTAINERLAYER_H
    1.10 +#define GFX_BASICCONTAINERLAYER_H
    1.11 +
    1.12 +#include "BasicImplData.h"              // for BasicImplData
    1.13 +#include "BasicLayers.h"                // for BasicLayerManager
    1.14 +#include "Layers.h"                     // for Layer, ContainerLayer
    1.15 +#include "nsDebug.h"                    // for NS_ASSERTION
    1.16 +#include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR
    1.17 +#include "nsISupportsUtils.h"           // for NS_ADDREF, NS_RELEASE
    1.18 +struct nsIntRect;
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace layers {
    1.22 +
    1.23 +class BasicContainerLayer : public ContainerLayer, public BasicImplData {
    1.24 +public:
    1.25 +  BasicContainerLayer(BasicLayerManager* aManager) :
    1.26 +    ContainerLayer(aManager,
    1.27 +                   static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST()))
    1.28 +  {
    1.29 +    MOZ_COUNT_CTOR(BasicContainerLayer);
    1.30 +    mSupportsComponentAlphaChildren = true;
    1.31 +  }
    1.32 +  virtual ~BasicContainerLayer();
    1.33 +
    1.34 +  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
    1.35 +  {
    1.36 +    NS_ASSERTION(BasicManager()->InConstruction(),
    1.37 +                 "Can only set properties in construction phase");
    1.38 +    ContainerLayer::SetVisibleRegion(aRegion);
    1.39 +  }
    1.40 +  virtual bool InsertAfter(Layer* aChild, Layer* aAfter)
    1.41 +  {
    1.42 +    if (!BasicManager()->InConstruction()) {
    1.43 +      NS_ERROR("Can only set properties in construction phase");
    1.44 +      return false;
    1.45 +    }
    1.46 +    return ContainerLayer::InsertAfter(aChild, aAfter);
    1.47 +  }
    1.48 +
    1.49 +  virtual bool RemoveChild(Layer* aChild)
    1.50 +  { 
    1.51 +    if (!BasicManager()->InConstruction()) {
    1.52 +      NS_ERROR("Can only set properties in construction phase");
    1.53 +      return false;
    1.54 +    }
    1.55 +    return ContainerLayer::RemoveChild(aChild);
    1.56 +  }
    1.57 +
    1.58 +  virtual bool RepositionChild(Layer* aChild, Layer* aAfter)
    1.59 +  {
    1.60 +    if (!BasicManager()->InConstruction()) {
    1.61 +      NS_ERROR("Can only set properties in construction phase");
    1.62 +      return false;
    1.63 +    }
    1.64 +    return ContainerLayer::RepositionChild(aChild, aAfter);
    1.65 +  }
    1.66 +
    1.67 +  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface);
    1.68 +
    1.69 +  /**
    1.70 +   * Returns true when:
    1.71 +   * a) no (non-hidden) childrens' visible areas overlap in
    1.72 +   * (aInRect intersected with this layer's visible region).
    1.73 +   * b) the (non-hidden) childrens' visible areas cover
    1.74 +   * (aInRect intersected with this layer's visible region).
    1.75 +   * c) this layer and all (non-hidden) children have transforms that are translations
    1.76 +   * by integers.
    1.77 +   * aInRect is in the root coordinate system.
    1.78 +   * Child layers with opacity do not contribute to the covered area in check b).
    1.79 +   * This method can be conservative; it's OK to return false under any
    1.80 +   * circumstances.
    1.81 +   */
    1.82 +  bool ChildrenPartitionVisibleRegion(const nsIntRect& aInRect);
    1.83 +
    1.84 +  void ForceIntermediateSurface() { mUseIntermediateSurface = true; }
    1.85 +
    1.86 +  void SetSupportsComponentAlphaChildren(bool aSupports) { mSupportsComponentAlphaChildren = aSupports; }
    1.87 +
    1.88 +  virtual void Validate(LayerManager::DrawThebesLayerCallback aCallback,
    1.89 +                        void* aCallbackData) MOZ_OVERRIDE;
    1.90 +
    1.91 +protected:
    1.92 +  BasicLayerManager* BasicManager()
    1.93 +  {
    1.94 +    return static_cast<BasicLayerManager*>(mManager);
    1.95 +  }
    1.96 +};
    1.97 +}
    1.98 +}
    1.99 +
   1.100 +#endif

mercurial