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