gecko/gfx/layers/d3d9/ThebesLayerD3D9.h
Benoit Jacob 67a17b1047 Bug 959448 - Convert most of LayersTypes.h to typed enums - r=nrc
find content/media dom/ipc widget/ gfx/tests gfx/ipc/ gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)LAYERS_\(NONE\|BASIC\|OPENGL\|D3D9\|D3D10\|D3D11\|CLIENT\|LAST\)\($\|[^A-Za-z0-9_]\)/\1LayersBackend::LAYERS_\2\3/g'

find widget gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)BUFFER_\(NONE\)\($\|[^A-Za-z0-9_]\)/\1BufferMode::BUFFER_\2\3/g'

find widget gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)BUFFER_\(BUFFERED\)\($\|[^A-Za-z0-9_]\)/\1BufferMode::\2\3/g'

find gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)CLIP_\(DRAW\|DRAW_SNAPPED\)\($\|[^A-Za-z0-9_]\)/\1DrawRegionClip::\2\3/g'

find gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)CLIP_\(NONE\)\($\|[^A-Za-z0-9_]\)/\1DrawRegionClip::CLIP_\2\3/g'

find gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)SURFACE_\(NONE\|OPAQUE\|SINGLE_CHANNEL_ALPHA\|COMPONENT_ALPHA\)\($\|[^A-Za-z0-9_]\)/\1SurfaceMode::SURFACE_\2\3/g'

find gfx/ipc/ gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)SCALE_\(STRETCH\|SENTINEL\)\($\|[^A-Za-z0-9_]\)/\1ScaleMode::\2\3/g'

find gfx/ipc/ gfx/layers/ layout/ -type f | xargs sed -i 's/\(^\|[^A-Za-z0-9_]\)SCALE_\(NONE\)\($\|[^A-Za-z0-9_]\)/\1ScaleMode::SCALE_\2\3/g'
2014-01-23 13:26:41 -05:00

86 lines
2.6 KiB
C++

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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/. */
#ifndef GFX_THEBESLAYERD3D9_H
#define GFX_THEBESLAYERD3D9_H
#include "Layers.h"
#include "LayerManagerD3D9.h"
#include "gfxImageSurface.h"
#include "ReadbackProcessor.h"
namespace mozilla {
namespace layers {
class ReadbackProcessor;
class ThebesLayerD3D9 : public ThebesLayer,
public LayerD3D9
{
public:
ThebesLayerD3D9(LayerManagerD3D9 *aManager);
virtual ~ThebesLayerD3D9();
/* ThebesLayer implementation */
void InvalidateRegion(const nsIntRegion& aRegion);
/* LayerD3D9 implementation */
Layer* GetLayer();
virtual bool IsEmpty();
virtual void RenderLayer() { RenderThebesLayer(nullptr); }
virtual void CleanResources();
virtual void LayerManagerDestroyed();
void RenderThebesLayer(ReadbackProcessor* aReadback);
private:
/*
* D3D9 texture
*/
nsRefPtr<IDirect3DTexture9> mTexture;
/*
* D3D9 texture for render-on-white when doing component alpha
*/
nsRefPtr<IDirect3DTexture9> mTextureOnWhite;
/**
* Visible region bounds used when we drew the contents of the textures
*/
nsIntRect mTextureRect;
bool HaveTextures(SurfaceMode aMode)
{
return mTexture && (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mTextureOnWhite);
}
/* Checks if our surface has the right content type */
void VerifyContentType(SurfaceMode aMode);
/* Ensures we have the necessary texture object(s) and that they correspond
* to mVisibleRegion.GetBounds(). This creates new texture objects as
* necessary and also copies existing valid texture data if necessary.
*/
void UpdateTextures(SurfaceMode aMode);
/* Render the rectangles of mVisibleRegion with D3D9 using the currently
* bound textures, target, shaders, etc.
*/
void RenderRegion(const nsIntRegion& aRegion);
/* Have a region of our layer drawn */
void DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
const nsTArray<ReadbackProcessor::Update>& aReadbackUpdates);
/* Create a new texture */
void CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode);
void CopyRegion(IDirect3DTexture9* aSrc, const nsIntPoint &aSrcOffset,
IDirect3DTexture9* aDest, const nsIntPoint &aDestOffset,
const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion);
};
} /* layers */
} /* mozilla */
#endif /* GFX_THEBESLAYERD3D9_H */