зеркало из https://github.com/mozilla/pjs.git
Numerous whitespace fixes in D3D9 layers code.
This commit is contained in:
Родитель
0b53d0c3d4
Коммит
cb83242bf3
|
@ -162,7 +162,7 @@ CanvasLayerD3D9::Updated(const nsIntRect& aRect)
|
|||
aRect.width * 4);
|
||||
}
|
||||
|
||||
mTexture->UnlockRect(0);
|
||||
mTexture->UnlockRect(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ CanvasLayerD3D9::RenderLayer()
|
|||
* and size. To get pixel perfect mapping we offset the quad half a pixel
|
||||
* to the top-left. We also flip the Y axis here, note we can only do this
|
||||
* because we are in CULL_NONE mode!
|
||||
*
|
||||
*
|
||||
* See: http://msdn.microsoft.com/en-us/library/bb219690%28VS.85%29.aspx
|
||||
*/
|
||||
memset(&quadTransform, 0, sizeof(quadTransform));
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
mTexture(0),
|
||||
mGLBufferIsPremultiplied(PR_FALSE),
|
||||
mNeedsYFlip(PR_FALSE)
|
||||
{
|
||||
{
|
||||
mImplData = static_cast<LayerD3D9*>(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ ColorLayerD3D9::GetLayer()
|
|||
void
|
||||
ColorLayerD3D9::RenderLayer()
|
||||
{
|
||||
// XXX we might be able to improve performance by using
|
||||
// XXX we might be able to improve performance by using
|
||||
// IDirect3DDevice9::Clear
|
||||
|
||||
float quadTransform[4][4];
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
ColorLayerD3D9(LayerManagerD3D9 *aManager)
|
||||
: ColorLayer(aManager, NULL)
|
||||
, LayerD3D9(aManager)
|
||||
{
|
||||
{
|
||||
mImplData = static_cast<LayerD3D9*>(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter)
|
|||
NS_ADDREF(aChild);
|
||||
return;
|
||||
}
|
||||
for (Layer *child = GetFirstChild();
|
||||
for (Layer *child = GetFirstChild();
|
||||
child; child = child->GetNextSibling()) {
|
||||
if (aAfter == child) {
|
||||
Layer *oldNextSibling = child->GetNextSibling();
|
||||
|
@ -116,7 +116,7 @@ ContainerLayerD3D9::RemoveChild(Layer *aChild)
|
|||
return;
|
||||
}
|
||||
Layer *lastChild = nsnull;
|
||||
for (Layer *child = GetFirstChild(); child;
|
||||
for (Layer *child = GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child == aChild) {
|
||||
// We're sure this is not our first child. So lastChild != NULL.
|
||||
|
@ -170,8 +170,8 @@ ContainerLayerD3D9::RenderLayer()
|
|||
if (useIntermediate) {
|
||||
device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget));
|
||||
device()->CreateTexture(mVisibleRect.width, mVisibleRect.height, 1,
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(renderTexture),
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(renderTexture),
|
||||
NULL);
|
||||
nsRefPtr<IDirect3DSurface9> renderSurface;
|
||||
renderTexture->GetSurfaceLevel(0, getter_AddRefs(renderSurface));
|
||||
|
@ -183,7 +183,7 @@ ContainerLayerD3D9::RenderLayer()
|
|||
|
||||
float viewMatrix[4][4];
|
||||
/*
|
||||
* Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
|
||||
* Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
|
||||
* <1.0, -1.0> bottomright)
|
||||
*/
|
||||
memset(&viewMatrix, 0, sizeof(viewMatrix));
|
||||
|
@ -193,7 +193,7 @@ ContainerLayerD3D9::RenderLayer()
|
|||
viewMatrix[3][0] = -1.0f;
|
||||
viewMatrix[3][1] = 1.0f;
|
||||
viewMatrix[3][3] = 1.0f;
|
||||
|
||||
|
||||
device()->GetVertexShaderConstantF(8, &oldViewMatrix[0][0], 4);
|
||||
device()->SetVertexShaderConstantF(8, &viewMatrix[0][0], 4);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ ContainerLayerD3D9::RenderLayer()
|
|||
* Matrix to transform the <0.0,0.0>, <1.0,1.0> quad to the correct position
|
||||
* and size. To get pixel perfect mapping we offset the quad half a pixel
|
||||
* to the top-left.
|
||||
*
|
||||
*
|
||||
* See: http://msdn.microsoft.com/en-us/library/bb219690%28VS.85%29.aspx
|
||||
*/
|
||||
memset(&quadTransform, 0, sizeof(quadTransform));
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class ContainerLayerD3D9 : public ContainerLayer,
|
||||
class ContainerLayerD3D9 : public ContainerLayer,
|
||||
public LayerD3D9
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -270,7 +270,7 @@ PlanarYCbCrImageD3D9::SetData(const PlanarYCbCrImage::Data &aData)
|
|||
mData.mCbCrSize.height = aData.mPicSize.height >> height_shift;
|
||||
mData.mYSize = aData.mPicSize;
|
||||
mData.mYStride = mData.mYSize.width;
|
||||
|
||||
|
||||
mBuffer = new PRUint8[mData.mCbCrStride * mData.mCbCrSize.height * 2 +
|
||||
mData.mYStride * mData.mYSize.height];
|
||||
mData.mYChannel = mBuffer;
|
||||
|
@ -390,7 +390,7 @@ PlanarYCbCrImageD3D9::GetAsSurface()
|
|||
{
|
||||
nsRefPtr<gfxImageSurface> imageSurface =
|
||||
new gfxImageSurface(mSize, gfxASurface::ImageFormatRGB24);
|
||||
|
||||
|
||||
// Convert from YCbCr to RGB now
|
||||
gfx::ConvertYCbCrToRGB32(mData.mYChannel,
|
||||
mData.mCbChannel,
|
||||
|
@ -403,7 +403,7 @@ PlanarYCbCrImageD3D9::GetAsSurface()
|
|||
mData.mYStride,
|
||||
mData.mCbCrStride,
|
||||
imageSurface->Stride(),
|
||||
gfx::YV12);
|
||||
gfx::YV12);
|
||||
|
||||
return imageSurface.forget().get();
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
ImageLayerD3D9(LayerManagerD3D9 *aManager)
|
||||
: ImageLayer(aManager, NULL)
|
||||
, LayerD3D9(aManager)
|
||||
{
|
||||
{
|
||||
mImplData = static_cast<LayerD3D9*>(this);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
PRBool HasData() { return mHasData; }
|
||||
|
||||
virtual already_AddRefed<gfxASurface> GetAsSurface();
|
||||
|
||||
|
||||
nsAutoArrayPtr<PRUint8> mBuffer;
|
||||
LayerManagerD3D9 *mManager;
|
||||
Data mData;
|
||||
|
|
|
@ -163,7 +163,7 @@ LayerManagerD3D9::Initialize()
|
|||
if (FAILED(hr)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
vertices[0].x = vertices[0].y = 0;
|
||||
vertices[1].x = 1; vertices[1].y = 0;
|
||||
vertices[2].x = 0; vertices[2].y = 1;
|
||||
|
@ -181,12 +181,12 @@ LayerManagerD3D9::Initialize()
|
|||
D3DDECLUSAGE_POSITION, 0 },
|
||||
D3DDECL_END()
|
||||
};
|
||||
|
||||
|
||||
mDevice->CreateVertexDeclaration(elements, getter_AddRefs(mVD));
|
||||
|
||||
SetupRenderState();
|
||||
|
||||
nsCOMPtr<nsIConsoleService>
|
||||
nsCOMPtr<nsIConsoleService>
|
||||
console(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||
|
||||
D3DADAPTER_IDENTIFIER9 identifier;
|
||||
|
@ -328,7 +328,7 @@ LayerManagerD3D9::Render()
|
|||
mDevice->Clear(0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0, 0);
|
||||
|
||||
mDevice->BeginScene();
|
||||
|
||||
|
||||
if (mRootLayer) {
|
||||
const nsIntRect *clipRect = mRootLayer->GetLayer()->GetClipRect();
|
||||
RECT r;
|
||||
|
@ -374,7 +374,7 @@ LayerManagerD3D9::SetupPipeline()
|
|||
|
||||
float viewMatrix[4][4];
|
||||
/*
|
||||
* Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
|
||||
* Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
|
||||
* <1.0, -1.0> bottomright)
|
||||
*/
|
||||
memset(&viewMatrix, 0, sizeof(viewMatrix));
|
||||
|
@ -384,7 +384,7 @@ LayerManagerD3D9::SetupPipeline()
|
|||
viewMatrix[3][0] = -1.0f;
|
||||
viewMatrix[3][1] = 1.0f;
|
||||
viewMatrix[3][3] = 1.0f;
|
||||
|
||||
|
||||
HRESULT hr = mDevice->SetVertexShaderConstantF(8, &viewMatrix[0][0], 4);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
|
@ -397,7 +397,7 @@ LayerManagerD3D9::SetupBackBuffer()
|
|||
{
|
||||
nsRefPtr<IDirect3DSurface9> backBuffer;
|
||||
mDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO,
|
||||
getter_AddRefs(backBuffer));
|
||||
getter_AddRefs(backBuffer));
|
||||
|
||||
D3DSURFACE_DESC desc;
|
||||
nsIntRect rect;
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
PRBool Initialize();
|
||||
|
||||
/*
|
||||
* Sets the clipping region for this layer manager. This is important on
|
||||
* Sets the clipping region for this layer manager. This is important on
|
||||
* windows because using OGL we no longer have GDI's native clipping. Therefor
|
||||
* widget must tell us what part of the screen is being invalidated,
|
||||
* and we should clip to this.
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
const CallbackInfo &GetCallbackInfo() { return mCurrentCallbackInfo; }
|
||||
|
||||
void SetRoot(Layer* aLayer);
|
||||
|
||||
|
||||
virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
|
||||
|
||||
virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
|
||||
|
@ -140,7 +140,7 @@ private:
|
|||
|
||||
/* Widget associated with this layer manager */
|
||||
nsIWidget *mWidget;
|
||||
/*
|
||||
/*
|
||||
* Context target, NULL when drawing directly to our swap chain.
|
||||
*/
|
||||
nsRefPtr<gfxContext> mTarget;
|
||||
|
@ -170,7 +170,7 @@ private:
|
|||
|
||||
/* Callback info for current transaction */
|
||||
CallbackInfo mCurrentCallbackInfo;
|
||||
|
||||
|
||||
/*
|
||||
* Region we're clipping our current drawing to.
|
||||
*/
|
||||
|
@ -214,7 +214,7 @@ public:
|
|||
|
||||
enum LayerType { TYPE_THEBES, TYPE_CONTAINER, TYPE_IMAGE, TYPE_COLOR,
|
||||
TYPE_CANVAS };
|
||||
|
||||
|
||||
virtual LayerType GetType() = 0;
|
||||
|
||||
virtual LayerD3D9 *GetFirstChildD3D9() { return nsnull; }
|
||||
|
|
|
@ -51,7 +51,7 @@ float4 YCbCrShader(const VS_OUTPUT aVertex) : COLOR
|
|||
color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;
|
||||
color.b = yuv.g * 1.164 + yuv.b * 2.018;
|
||||
color.a = 1.0f;
|
||||
|
||||
|
||||
return color * fLayerOpacity;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ ThebesLayerD3D9::SetVisibleRegion(const nsIntRegion &aRegion)
|
|||
mVisibleRect = aRegion.GetBounds();
|
||||
|
||||
device()->CreateTexture(mVisibleRect.width, mVisibleRect.height, 1,
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
|
||||
|
||||
mInvalidatedRect = mVisibleRect;
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ ThebesLayerD3D9::RenderLayer()
|
|||
{
|
||||
if (!mTexture) {
|
||||
device()->CreateTexture(mVisibleRect.width, mVisibleRect.height, 1,
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
|
||||
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
|
||||
mInvalidatedRect = mVisibleRect;
|
||||
}
|
||||
if (!mInvalidatedRect.IsEmpty()) {
|
||||
|
@ -118,11 +118,11 @@ ThebesLayerD3D9::RenderLayer()
|
|||
context->Translate(gfxPoint(-mInvalidatedRect.x, -mInvalidatedRect.y));
|
||||
LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
|
||||
cbInfo.Callback(this, context, region, cbInfo.CallbackData);
|
||||
|
||||
|
||||
nsRefPtr<IDirect3DTexture9> tmpTexture;
|
||||
device()->CreateTexture(mInvalidatedRect.width, mInvalidatedRect.height, 1,
|
||||
0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), NULL);
|
||||
0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), NULL);
|
||||
|
||||
D3DLOCKED_RECT r;
|
||||
tmpTexture->LockRect(0, &r, NULL, 0);
|
||||
|
@ -145,22 +145,22 @@ ThebesLayerD3D9::RenderLayer()
|
|||
|
||||
nsRefPtr<IDirect3DSurface9> srcSurface;
|
||||
nsRefPtr<IDirect3DSurface9> dstSurface;
|
||||
|
||||
|
||||
mTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
|
||||
tmpTexture->GetSurfaceLevel(0, getter_AddRefs(srcSurface));
|
||||
|
||||
|
||||
POINT point;
|
||||
point.x = mInvalidatedRect.x - mVisibleRect.x;
|
||||
point.y = mInvalidatedRect.y - mVisibleRect.y;
|
||||
device()->UpdateSurface(srcSurface, NULL, dstSurface, &point);
|
||||
}
|
||||
|
||||
|
||||
float quadTransform[4][4];
|
||||
/*
|
||||
* Matrix to transform the <0.0,0.0>, <1.0,1.0> quad to the correct position
|
||||
* and size. To get pixel perfect mapping we offset the quad half a pixel
|
||||
* to the top-left.
|
||||
*
|
||||
*
|
||||
* See: http://msdn.microsoft.com/en-us/library/bb219690%28VS.85%29.aspx
|
||||
*/
|
||||
memset(&quadTransform, 0, sizeof(quadTransform));
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class ThebesLayerD3D9 : public ThebesLayer,
|
||||
class ThebesLayerD3D9 : public ThebesLayer,
|
||||
public LayerD3D9
|
||||
{
|
||||
public:
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
const nsIntRect &GetInvalidatedRect();
|
||||
|
||||
private:
|
||||
/*
|
||||
/*
|
||||
* Visible rectangle, this is used to know the size and position of the quad
|
||||
* when doing the rendering of this layer.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче