2010-09-30 22:53:49 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 11:12:37 +00:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-09-30 22:53:49 +00:00
|
|
|
|
2011-02-16 22:43:30 +00:00
|
|
|
#ifndef GFX_CANVASLAYERD3D10_H
|
|
|
|
#define GFX_CANVASLAYERD3D10_H
|
2010-09-30 22:53:49 +00:00
|
|
|
|
|
|
|
#include "LayerManagerD3D10.h"
|
|
|
|
|
2012-08-22 03:29:06 +00:00
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
|
2013-09-24 20:45:14 +00:00
|
|
|
class gfxASurface;
|
|
|
|
|
2010-09-30 22:53:49 +00:00
|
|
|
namespace mozilla {
|
2013-09-04 12:14:52 +00:00
|
|
|
|
|
|
|
namespace gl {
|
|
|
|
class GLContext;
|
|
|
|
}
|
|
|
|
|
2010-09-30 22:53:49 +00:00
|
|
|
namespace layers {
|
|
|
|
|
2013-05-29 21:59:24 +00:00
|
|
|
class CanvasLayerD3D10 : public CanvasLayer,
|
|
|
|
public LayerD3D10
|
2010-09-30 22:53:49 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-09-04 12:14:52 +00:00
|
|
|
CanvasLayerD3D10(LayerManagerD3D10 *aManager);
|
2010-09-30 22:53:49 +00:00
|
|
|
~CanvasLayerD3D10();
|
|
|
|
|
|
|
|
// CanvasLayer implementation
|
|
|
|
virtual void Initialize(const Data& aData);
|
|
|
|
|
|
|
|
// LayerD3D10 implementation
|
|
|
|
virtual Layer* GetLayer();
|
2010-11-08 09:06:15 +00:00
|
|
|
virtual void RenderLayer();
|
2010-09-30 22:53:49 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
typedef mozilla::gl::GLContext GLContext;
|
|
|
|
|
2011-03-27 23:59:46 +00:00
|
|
|
void UpdateSurface();
|
|
|
|
|
2010-09-30 22:53:49 +00:00
|
|
|
nsRefPtr<gfxASurface> mSurface;
|
2011-06-24 17:41:18 +00:00
|
|
|
mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
|
2010-09-30 22:53:49 +00:00
|
|
|
nsRefPtr<GLContext> mGLContext;
|
|
|
|
nsRefPtr<ID3D10Texture2D> mTexture;
|
2013-02-13 23:26:24 +00:00
|
|
|
nsRefPtr<ID3D10ShaderResourceView> mUploadSRView;
|
2010-09-30 22:53:49 +00:00
|
|
|
nsRefPtr<ID3D10ShaderResourceView> mSRView;
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mDataIsPremultiplied;
|
|
|
|
bool mNeedsYFlip;
|
|
|
|
bool mIsD2DTexture;
|
|
|
|
bool mHasAlpha;
|
2012-08-22 03:29:06 +00:00
|
|
|
bool mForceReadback;
|
2012-03-25 19:50:26 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsAutoArrayPtr<uint8_t> mCachedTempBlob;
|
|
|
|
uint32_t mCachedTempBlob_Size;
|
2012-03-25 19:50:26 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t* GetTempBlob(const uint32_t aSize)
|
2012-03-25 19:50:26 +00:00
|
|
|
{
|
2013-02-13 23:26:24 +00:00
|
|
|
if (!mCachedTempBlob || aSize != mCachedTempBlob_Size) {
|
|
|
|
mCachedTempBlob = new uint8_t[aSize];
|
|
|
|
mCachedTempBlob_Size = aSize;
|
|
|
|
}
|
2012-03-25 19:50:26 +00:00
|
|
|
|
2013-02-13 23:26:24 +00:00
|
|
|
return mCachedTempBlob;
|
2012-03-25 19:50:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DiscardTempBlob()
|
|
|
|
{
|
2013-02-13 23:26:24 +00:00
|
|
|
mCachedTempBlob = nullptr;
|
2012-03-25 19:50:26 +00:00
|
|
|
}
|
2010-09-30 22:53:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* layers */
|
|
|
|
} /* mozilla */
|
|
|
|
#endif /* GFX_CANVASLAYERD3D10_H */
|