gfx/layers/composite/CanvasLayerComposite.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/composite/CanvasLayerComposite.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,72 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; 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_CanvasLayerComposite_H
    1.10 +#define GFX_CanvasLayerComposite_H
    1.11 +
    1.12 +#include "Layers.h"                     // for CanvasLayer, etc
    1.13 +#include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
    1.14 +#include "mozilla/RefPtr.h"             // for RefPtr
    1.15 +#include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
    1.16 +#include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
    1.17 +#include "nsDebug.h"                    // for NS_RUNTIMEABORT
    1.18 +#include "nsRect.h"                     // for nsIntRect
    1.19 +#include "nscore.h"                     // for nsACString
    1.20 +struct nsIntPoint;
    1.21 +
    1.22 +namespace mozilla {
    1.23 +namespace layers {
    1.24 +
    1.25 +class CompositableHost;
    1.26 +// Canvas layers use ImageHosts (but CanvasClients) because compositing a
    1.27 +// canvas is identical to compositing an image.
    1.28 +class ImageHost;
    1.29 +
    1.30 +class CanvasLayerComposite : public CanvasLayer,
    1.31 +                             public LayerComposite
    1.32 +{
    1.33 +public:
    1.34 +  CanvasLayerComposite(LayerManagerComposite* aManager);
    1.35 +
    1.36 +  virtual ~CanvasLayerComposite();
    1.37 +
    1.38 +  // CanvasLayer impl
    1.39 +  virtual void Initialize(const Data& aData) MOZ_OVERRIDE
    1.40 +  {
    1.41 +    NS_RUNTIMEABORT("Incompatibe surface type");
    1.42 +  }
    1.43 +
    1.44 +  virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
    1.45 +
    1.46 +  virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
    1.47 +
    1.48 +  virtual void Disconnect() MOZ_OVERRIDE
    1.49 +  {
    1.50 +    Destroy();
    1.51 +  }
    1.52 +
    1.53 +  virtual Layer* GetLayer() MOZ_OVERRIDE;
    1.54 +  virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
    1.55 +
    1.56 +  virtual void CleanupResources() MOZ_OVERRIDE;
    1.57 +
    1.58 +  CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
    1.59 +
    1.60 +  virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
    1.61 +
    1.62 +  void SetBounds(nsIntRect aBounds) { mBounds = aBounds; }
    1.63 +
    1.64 +  virtual const char* Name() const MOZ_OVERRIDE { return "CanvasLayerComposite"; }
    1.65 +
    1.66 +protected:
    1.67 +  virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
    1.68 +
    1.69 +private:
    1.70 +  RefPtr<CompositableHost> mImageHost;
    1.71 +};
    1.72 +
    1.73 +} /* layers */
    1.74 +} /* mozilla */
    1.75 +#endif /* GFX_CanvasLayerComposite_H */

mercurial