gfx/layers/composite/ImageHost.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/composite/ImageHost.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,92 @@
     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 MOZILLA_GFX_IMAGEHOST_H
    1.10 +#define MOZILLA_GFX_IMAGEHOST_H
    1.11 +
    1.12 +#include <stdio.h>                      // for FILE
    1.13 +#include "CompositableHost.h"           // for CompositableHost
    1.14 +#include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
    1.15 +#include "mozilla/RefPtr.h"             // for RefPtr
    1.16 +#include "mozilla/gfx/Point.h"          // for Point
    1.17 +#include "mozilla/gfx/Rect.h"           // for Rect
    1.18 +#include "mozilla/gfx/Types.h"          // for Filter
    1.19 +#include "mozilla/layers/CompositorTypes.h"  // for TextureInfo, etc
    1.20 +#include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
    1.21 +#include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
    1.22 +#include "mozilla/layers/TextureHost.h"  // for TextureHost, etc
    1.23 +#include "mozilla/mozalloc.h"           // for operator delete
    1.24 +#include "nsCOMPtr.h"                   // for already_AddRefed
    1.25 +#include "nsRect.h"                     // for nsIntRect
    1.26 +#include "nscore.h"                     // for nsACString
    1.27 +
    1.28 +class nsIntRegion;
    1.29 +
    1.30 +namespace mozilla {
    1.31 +namespace gfx {
    1.32 +class Matrix4x4;
    1.33 +}
    1.34 +namespace layers {
    1.35 +
    1.36 +class Compositor;
    1.37 +class ISurfaceAllocator;
    1.38 +struct EffectChain;
    1.39 +
    1.40 +/**
    1.41 + * ImageHost. Works with ImageClientSingle and ImageClientBuffered
    1.42 + */
    1.43 +class ImageHost : public CompositableHost
    1.44 +{
    1.45 +public:
    1.46 +  ImageHost(const TextureInfo& aTextureInfo);
    1.47 +  ~ImageHost();
    1.48 +
    1.49 +  virtual CompositableType GetType() { return mTextureInfo.mCompositableType; }
    1.50 +
    1.51 +  virtual void Composite(EffectChain& aEffectChain,
    1.52 +                         float aOpacity,
    1.53 +                         const gfx::Matrix4x4& aTransform,
    1.54 +                         const gfx::Filter& aFilter,
    1.55 +                         const gfx::Rect& aClipRect,
    1.56 +                         const nsIntRegion* aVisibleRegion = nullptr,
    1.57 +                         TiledLayerProperties* aLayerProperties = nullptr) MOZ_OVERRIDE;
    1.58 +
    1.59 +  virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
    1.60 +
    1.61 +  virtual void RemoveTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
    1.62 +
    1.63 +  virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE;
    1.64 +
    1.65 +  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
    1.66 +
    1.67 +  virtual void SetPictureRect(const nsIntRect& aPictureRect) MOZ_OVERRIDE
    1.68 +  {
    1.69 +    mPictureRect = aPictureRect;
    1.70 +    mHasPictureRect = true;
    1.71 +  }
    1.72 +
    1.73 +  virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
    1.74 +
    1.75 +  virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
    1.76 +
    1.77 +#ifdef MOZ_DUMP_PAINTING
    1.78 +  virtual void Dump(FILE* aFile = nullptr,
    1.79 +                    const char* aPrefix = "",
    1.80 +                    bool aDumpHtml = false) MOZ_OVERRIDE;
    1.81 +
    1.82 +  virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
    1.83 +#endif
    1.84 +
    1.85 +protected:
    1.86 +
    1.87 +  RefPtr<TextureHost> mFrontBuffer;
    1.88 +  nsIntRect mPictureRect;
    1.89 +  bool mHasPictureRect;
    1.90 +};
    1.91 +
    1.92 +}
    1.93 +}
    1.94 +
    1.95 +#endif

mercurial