gfx/layers/d3d10/CanvasLayerD3D10.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:842ac5330efc
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/. */
5
6 #ifndef GFX_CANVASLAYERD3D10_H
7 #define GFX_CANVASLAYERD3D10_H
8
9 #include "LayerManagerD3D10.h"
10
11 #include "mozilla/Preferences.h"
12
13 namespace mozilla {
14
15 namespace gl {
16 class GLContext;
17 }
18
19 namespace layers {
20
21 class CanvasLayerD3D10 : public CanvasLayer,
22 public LayerD3D10
23 {
24 public:
25 CanvasLayerD3D10(LayerManagerD3D10 *aManager);
26 ~CanvasLayerD3D10();
27
28 // CanvasLayer implementation
29 virtual void Initialize(const Data& aData);
30
31 // LayerD3D10 implementation
32 virtual Layer* GetLayer();
33 virtual void RenderLayer();
34
35 private:
36 typedef mozilla::gl::GLContext GLContext;
37
38 void UpdateSurface();
39
40 RefPtr<gfx::SourceSurface> mSurface;
41 mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
42 nsRefPtr<GLContext> mGLContext;
43 nsRefPtr<ID3D10Texture2D> mTexture;
44 nsRefPtr<ID3D10ShaderResourceView> mUploadSRView;
45 nsRefPtr<ID3D10ShaderResourceView> mSRView;
46
47 bool mDataIsPremultiplied;
48 bool mNeedsYFlip;
49 bool mIsD2DTexture;
50 bool mHasAlpha;
51
52 nsAutoArrayPtr<uint8_t> mCachedTempBlob;
53 uint32_t mCachedTempBlob_Size;
54
55 uint8_t* GetTempBlob(const uint32_t aSize)
56 {
57 if (!mCachedTempBlob || aSize != mCachedTempBlob_Size) {
58 mCachedTempBlob = new uint8_t[aSize];
59 mCachedTempBlob_Size = aSize;
60 }
61
62 return mCachedTempBlob;
63 }
64
65 void DiscardTempBlob()
66 {
67 mCachedTempBlob = nullptr;
68 }
69 };
70
71 } /* layers */
72 } /* mozilla */
73 #endif /* GFX_CANVASLAYERD3D10_H */

mercurial