2010-05-24 08:28:51 -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-05-24 08:28:51 -07:00
|
|
|
|
2011-02-16 14:43:30 -08:00
|
|
|
#ifndef GFX_CANVASLAYERD3D9_H
|
|
|
|
#define GFX_CANVASLAYERD3D9_H
|
2010-05-24 08:28:51 -07:00
|
|
|
|
2011-10-17 11:52:12 -07:00
|
|
|
#include "LayerManagerD3D9.h"
|
2013-09-06 19:11:41 -07:00
|
|
|
#include "GLContextTypes.h"
|
2013-09-24 13:45:14 -07:00
|
|
|
|
|
|
|
class gfxASurface;
|
2010-05-24 08:28:51 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2011-07-04 06:15:05 -07:00
|
|
|
|
2013-05-29 14:59:24 -07:00
|
|
|
class CanvasLayerD3D9 :
|
2010-05-24 08:28:51 -07:00
|
|
|
public CanvasLayer,
|
|
|
|
public LayerD3D9
|
|
|
|
{
|
|
|
|
public:
|
2013-09-06 19:11:41 -07:00
|
|
|
CanvasLayerD3D9(LayerManagerD3D9 *aManager);
|
2010-05-24 08:28:51 -07:00
|
|
|
~CanvasLayerD3D9();
|
|
|
|
|
|
|
|
// CanvasLayer implementation
|
|
|
|
virtual void Initialize(const Data& aData);
|
|
|
|
|
|
|
|
// LayerD3D9 implementation
|
|
|
|
virtual Layer* GetLayer();
|
2010-11-08 01:06:15 -08:00
|
|
|
virtual void RenderLayer();
|
2010-09-14 03:56:56 -07:00
|
|
|
virtual void CleanResources();
|
2010-09-15 15:15:49 -07:00
|
|
|
virtual void LayerManagerDestroyed();
|
2010-05-24 08:28:51 -07:00
|
|
|
|
2010-09-14 03:57:03 -07:00
|
|
|
void CreateTexture();
|
|
|
|
|
2010-05-24 08:28:51 -07:00
|
|
|
protected:
|
|
|
|
typedef mozilla::gl::GLContext GLContext;
|
|
|
|
|
2011-03-27 16:59:46 -07:00
|
|
|
void UpdateSurface();
|
|
|
|
|
2010-05-24 08:28:51 -07:00
|
|
|
nsRefPtr<gfxASurface> mSurface;
|
|
|
|
nsRefPtr<GLContext> mGLContext;
|
2010-11-08 01:06:15 -08:00
|
|
|
nsRefPtr<IDirect3DTexture9> mTexture;
|
2011-11-17 20:00:37 -08:00
|
|
|
RefPtr<gfx::DrawTarget> mDrawTarget;
|
2010-07-18 22:01:14 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDataIsPremultiplied;
|
|
|
|
bool mNeedsYFlip;
|
|
|
|
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
|
|
|
{
|
|
|
|
if (!mCachedTempBlob || aSize != mCachedTempBlob_Size) {
|
2012-08-22 08:56:38 -07:00
|
|
|
mCachedTempBlob = new uint8_t[aSize];
|
2012-03-25 12:50:26 -07:00
|
|
|
mCachedTempBlob_Size = aSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mCachedTempBlob;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiscardTempBlob()
|
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
mCachedTempBlob = nullptr;
|
2012-03-25 12:50:26 -07:00
|
|
|
}
|
2010-05-24 08:28:51 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* layers */
|
|
|
|
} /* mozilla */
|
|
|
|
#endif /* GFX_CANVASLAYERD3D9_H */
|