2010-10-01 02:53:49 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 15:12:37 +04: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-10-01 02:53:49 +04:00
|
|
|
|
2011-02-17 01:43:30 +03:00
|
|
|
#ifndef GFX_CANVASLAYERD3D10_H
|
|
|
|
#define GFX_CANVASLAYERD3D10_H
|
2010-10-01 02:53:49 +04:00
|
|
|
|
|
|
|
#include "LayerManagerD3D10.h"
|
|
|
|
#include "gfxASurface.h"
|
|
|
|
|
2012-08-22 07:29:06 +04:00
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
|
2010-10-01 02:53:49 +04:00
|
|
|
namespace mozilla {
|
2013-09-04 16:14:52 +04:00
|
|
|
|
|
|
|
namespace gl {
|
|
|
|
class GLContext;
|
|
|
|
}
|
|
|
|
|
2010-10-01 02:53:49 +04:00
|
|
|
namespace layers {
|
|
|
|
|
2013-05-30 01:59:24 +04:00
|
|
|
class CanvasLayerD3D10 : public CanvasLayer,
|
|
|
|
public LayerD3D10
|
2010-10-01 02:53:49 +04:00
|
|
|
{
|
|
|
|
public:
|
2013-09-04 16:14:52 +04:00
|
|
|
CanvasLayerD3D10(LayerManagerD3D10 *aManager);
|
2010-10-01 02:53:49 +04:00
|
|
|
~CanvasLayerD3D10();
|
|
|
|
|
|
|
|
// CanvasLayer implementation
|
|
|
|
virtual void Initialize(const Data& aData);
|
|
|
|
|
|
|
|
// LayerD3D10 implementation
|
|
|
|
virtual Layer* GetLayer();
|
2010-11-08 12:06:15 +03:00
|
|
|
virtual void RenderLayer();
|
2010-10-01 02:53:49 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
typedef mozilla::gl::GLContext GLContext;
|
|
|
|
|
2011-03-28 03:59:46 +04:00
|
|
|
void UpdateSurface();
|
|
|
|
|
2010-10-01 02:53:49 +04:00
|
|
|
nsRefPtr<gfxASurface> mSurface;
|
2011-06-24 21:41:18 +04:00
|
|
|
mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
|
2010-10-01 02:53:49 +04:00
|
|
|
nsRefPtr<GLContext> mGLContext;
|
|
|
|
nsRefPtr<ID3D10Texture2D> mTexture;
|
2013-02-14 03:26:24 +04:00
|
|
|
nsRefPtr<ID3D10ShaderResourceView> mUploadSRView;
|
2010-10-01 02:53:49 +04:00
|
|
|
nsRefPtr<ID3D10ShaderResourceView> mSRView;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mDataIsPremultiplied;
|
|
|
|
bool mNeedsYFlip;
|
|
|
|
bool mIsD2DTexture;
|
|
|
|
bool mHasAlpha;
|
2012-08-22 07:29:06 +04:00
|
|
|
bool mForceReadback;
|
2012-03-25 23:50:26 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsAutoArrayPtr<uint8_t> mCachedTempBlob;
|
|
|
|
uint32_t mCachedTempBlob_Size;
|
2012-03-25 23:50:26 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t* GetTempBlob(const uint32_t aSize)
|
2012-03-25 23:50:26 +04:00
|
|
|
{
|
2013-02-14 03:26:24 +04:00
|
|
|
if (!mCachedTempBlob || aSize != mCachedTempBlob_Size) {
|
|
|
|
mCachedTempBlob = new uint8_t[aSize];
|
|
|
|
mCachedTempBlob_Size = aSize;
|
|
|
|
}
|
2012-03-25 23:50:26 +04:00
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
return mCachedTempBlob;
|
2012-03-25 23:50:26 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void DiscardTempBlob()
|
|
|
|
{
|
2013-02-14 03:26:24 +04:00
|
|
|
mCachedTempBlob = nullptr;
|
2012-03-25 23:50:26 +04:00
|
|
|
}
|
2010-10-01 02:53:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* layers */
|
|
|
|
} /* mozilla */
|
|
|
|
#endif /* GFX_CANVASLAYERD3D10_H */
|