gfx/layers/d3d10/CanvasLayerD3D10.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/d3d10/CanvasLayerD3D10.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     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_CANVASLAYERD3D10_H
    1.10 +#define GFX_CANVASLAYERD3D10_H
    1.11 +
    1.12 +#include "LayerManagerD3D10.h"
    1.13 +
    1.14 +#include "mozilla/Preferences.h"
    1.15 +
    1.16 +namespace mozilla {
    1.17 +
    1.18 +namespace gl {
    1.19 +class GLContext;
    1.20 +}
    1.21 +
    1.22 +namespace layers {
    1.23 +
    1.24 +class CanvasLayerD3D10 : public CanvasLayer,
    1.25 +                         public LayerD3D10
    1.26 +{
    1.27 +public:
    1.28 +  CanvasLayerD3D10(LayerManagerD3D10 *aManager);
    1.29 +  ~CanvasLayerD3D10();
    1.30 +
    1.31 +  // CanvasLayer implementation
    1.32 +  virtual void Initialize(const Data& aData);
    1.33 +
    1.34 +  // LayerD3D10 implementation
    1.35 +  virtual Layer* GetLayer();
    1.36 +  virtual void RenderLayer();
    1.37 +
    1.38 +private:
    1.39 +  typedef mozilla::gl::GLContext GLContext;
    1.40 +
    1.41 +  void UpdateSurface();
    1.42 +
    1.43 +  RefPtr<gfx::SourceSurface> mSurface;
    1.44 +  mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
    1.45 +  nsRefPtr<GLContext> mGLContext;
    1.46 +  nsRefPtr<ID3D10Texture2D> mTexture;
    1.47 +  nsRefPtr<ID3D10ShaderResourceView> mUploadSRView;
    1.48 +  nsRefPtr<ID3D10ShaderResourceView> mSRView;
    1.49 +
    1.50 +  bool mDataIsPremultiplied;
    1.51 +  bool mNeedsYFlip;
    1.52 +  bool mIsD2DTexture;
    1.53 +  bool mHasAlpha;
    1.54 +
    1.55 +  nsAutoArrayPtr<uint8_t> mCachedTempBlob;
    1.56 +  uint32_t mCachedTempBlob_Size;
    1.57 +
    1.58 +  uint8_t* GetTempBlob(const uint32_t aSize)
    1.59 +  {
    1.60 +    if (!mCachedTempBlob || aSize != mCachedTempBlob_Size) {
    1.61 +      mCachedTempBlob = new uint8_t[aSize];
    1.62 +      mCachedTempBlob_Size = aSize;
    1.63 +    }
    1.64 +
    1.65 +    return mCachedTempBlob;
    1.66 +  }
    1.67 +
    1.68 +  void DiscardTempBlob()
    1.69 +  {
    1.70 +    mCachedTempBlob = nullptr;
    1.71 +  }
    1.72 +};
    1.73 +
    1.74 +} /* layers */
    1.75 +} /* mozilla */
    1.76 +#endif /* GFX_CANVASLAYERD3D10_H */

mercurial