gfx/layers/d3d9/CanvasLayerD3D9.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef GFX_CANVASLAYERD3D9_H
     7 #define GFX_CANVASLAYERD3D9_H
     9 #include "LayerManagerD3D9.h"
    10 #include "GLContextTypes.h"
    12 namespace mozilla {
    13 namespace layers {
    16 class CanvasLayerD3D9 :
    17   public CanvasLayer,
    18   public LayerD3D9
    19 {
    20 public:
    21   CanvasLayerD3D9(LayerManagerD3D9 *aManager);
    22   ~CanvasLayerD3D9();
    24   // CanvasLayer implementation
    25   virtual void Initialize(const Data& aData);
    27   // LayerD3D9 implementation
    28   virtual Layer* GetLayer();
    29   virtual void RenderLayer();
    30   virtual void CleanResources();
    31   virtual void LayerManagerDestroyed();
    33   void CreateTexture();
    35 protected:
    36   typedef mozilla::gl::GLContext GLContext;
    38   void UpdateSurface();
    40   nsRefPtr<GLContext> mGLContext;
    41   nsRefPtr<IDirect3DTexture9> mTexture;
    42   RefPtr<gfx::DrawTarget> mDrawTarget;
    44   bool mDataIsPremultiplied;
    45   bool mNeedsYFlip;
    46   bool mHasAlpha;
    48   nsAutoArrayPtr<uint8_t> mCachedTempBlob;
    49   uint32_t mCachedTempBlob_Size;
    51   uint8_t* GetTempBlob(const uint32_t aSize)
    52   {
    53       if (!mCachedTempBlob || aSize != mCachedTempBlob_Size) {
    54           mCachedTempBlob = new uint8_t[aSize];
    55           mCachedTempBlob_Size = aSize;
    56       }
    58       return mCachedTempBlob;
    59   }
    61   void DiscardTempBlob()
    62   {
    63       mCachedTempBlob = nullptr;
    64   }
    65 };
    67 } /* layers */
    68 } /* mozilla */
    69 #endif /* GFX_CANVASLAYERD3D9_H */

mercurial