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