mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
7d5a3be591
--HG-- rename : gfx/layers/basic/BasicThebesLayer.cpp => gfx/layers/basic/BasicPaintedLayer.cpp rename : gfx/layers/basic/BasicThebesLayer.h => gfx/layers/basic/BasicPaintedLayer.h rename : gfx/layers/client/ClientThebesLayer.cpp => gfx/layers/client/ClientPaintedLayer.cpp rename : gfx/layers/client/ClientThebesLayer.h => gfx/layers/client/ClientPaintedLayer.h rename : gfx/layers/client/ClientTiledThebesLayer.cpp => gfx/layers/client/ClientTiledPaintedLayer.cpp rename : gfx/layers/client/ClientTiledThebesLayer.h => gfx/layers/client/ClientTiledPaintedLayer.h rename : gfx/layers/composite/ThebesLayerComposite.cpp => gfx/layers/composite/PaintedLayerComposite.cpp rename : gfx/layers/composite/ThebesLayerComposite.h => gfx/layers/composite/PaintedLayerComposite.h rename : gfx/layers/d3d10/ThebesLayerD3D10.cpp => gfx/layers/d3d10/PaintedLayerD3D10.cpp rename : gfx/layers/d3d10/ThebesLayerD3D10.h => gfx/layers/d3d10/PaintedLayerD3D10.h rename : gfx/layers/d3d9/ThebesLayerD3D9.cpp => gfx/layers/d3d9/PaintedLayerD3D9.cpp rename : gfx/layers/d3d9/ThebesLayerD3D9.h => gfx/layers/d3d9/PaintedLayerD3D9.h
85 lines
2.6 KiB
C++
85 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_PAINTEDLAYERD3D9_H
|
|
#define GFX_PAINTEDLAYERD3D9_H
|
|
|
|
#include "Layers.h"
|
|
#include "LayerManagerD3D9.h"
|
|
#include "ReadbackProcessor.h"
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
class ReadbackProcessor;
|
|
|
|
class PaintedLayerD3D9 : public PaintedLayer,
|
|
public LayerD3D9
|
|
{
|
|
public:
|
|
PaintedLayerD3D9(LayerManagerD3D9 *aManager);
|
|
virtual ~PaintedLayerD3D9();
|
|
|
|
/* PaintedLayer implementation */
|
|
void InvalidateRegion(const nsIntRegion& aRegion);
|
|
|
|
/* LayerD3D9 implementation */
|
|
Layer* GetLayer();
|
|
virtual bool IsEmpty();
|
|
virtual void RenderLayer() { RenderPaintedLayer(nullptr); }
|
|
virtual void CleanResources();
|
|
virtual void LayerManagerDestroyed();
|
|
|
|
void RenderPaintedLayer(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_PAINTEDLAYERD3D9_H */
|