2010-07-21 22:06:33 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 15:12:37 +04: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-03-04 00:37:04 +03:00
|
|
|
|
2013-11-27 04:29:46 +04:00
|
|
|
#ifndef ROTATEDBUFFER_H_
|
|
|
|
#define ROTATEDBUFFER_H_
|
2010-03-04 00:37:04 +03:00
|
|
|
|
2014-04-16 04:41:40 +04:00
|
|
|
#include "gfxTypes.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include <stdint.h> // for uint32_t
|
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/gfx/2D.h" // for DrawTarget, etc
|
2017-07-05 18:18:48 +03:00
|
|
|
#include "mozilla/gfx/MatrixFwd.h" // for Matrix
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/mozalloc.h" // for operator delete
|
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
|
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
2014-02-27 01:36:35 +04:00
|
|
|
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "nsRegion.h" // for nsIntRegion
|
2013-11-06 23:10:50 +04:00
|
|
|
#include "LayersTypes.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
|
2010-03-04 00:37:04 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2017-08-03 18:50:32 +03:00
|
|
|
class CapturedPaintState;
|
|
|
|
|
|
|
|
typedef bool (*PrepDrawTargetForPaintingCallback)(CapturedPaintState*);
|
|
|
|
|
2013-12-05 22:39:22 +04:00
|
|
|
class TextureClient;
|
2014-09-26 21:06:08 +04:00
|
|
|
class PaintedLayer;
|
2010-03-04 00:37:04 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a cairo/Thebes surface, but with a literal twist. Scrolling
|
|
|
|
* causes the layer's visible region to move. We want to keep
|
|
|
|
* reusing the same surface if the region size hasn't changed, but we don't
|
|
|
|
* want to keep moving the contents of the surface around in memory. So
|
|
|
|
* we use a trick.
|
|
|
|
* Consider just the vertical case, and suppose the buffer is H pixels
|
|
|
|
* high and we're scrolling down by N pixels. Instead of copying the
|
|
|
|
* buffer contents up by N pixels, we leave the buffer contents in place,
|
|
|
|
* and paint content rows H to H+N-1 into rows 0 to N-1 of the buffer.
|
|
|
|
* Then we can refresh the screen by painting rows N to H-1 of the buffer
|
|
|
|
* at row 0 on the screen, and then painting rows 0 to N-1 of the buffer
|
|
|
|
* at row H-N on the screen.
|
|
|
|
* mBufferRotation.y would be N in this example.
|
|
|
|
*/
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
class RotatedBuffer {
|
|
|
|
public:
|
2013-09-25 00:45:13 +04:00
|
|
|
typedef gfxContentType ContentType;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
2015-04-21 18:04:57 +03:00
|
|
|
RotatedBuffer(const gfx::IntRect& aBufferRect,
|
|
|
|
const gfx::IntPoint& aBufferRotation)
|
2014-07-30 17:38:46 +04:00
|
|
|
: mBufferRect(aBufferRect)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
, mBufferRotation(aBufferRotation)
|
2013-11-19 23:56:57 +04:00
|
|
|
, mDidSelfCopy(false)
|
|
|
|
{ }
|
|
|
|
RotatedBuffer()
|
|
|
|
: mDidSelfCopy(false)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
{ }
|
|
|
|
|
2013-04-22 06:40:52 +04:00
|
|
|
/*
|
|
|
|
* Which buffer should be drawn to/read from.
|
|
|
|
*/
|
|
|
|
enum ContextSource {
|
|
|
|
BUFFER_BLACK, // The normal buffer, or buffer with black background when using component alpha.
|
|
|
|
BUFFER_WHITE, // The buffer with white background, only valid with component alpha.
|
|
|
|
BUFFER_BOTH // The combined black/white buffers, only valid for writing operations, not reading.
|
|
|
|
};
|
2014-01-09 04:57:52 +04:00
|
|
|
// It is the callers repsonsibility to ensure aTarget is flushed after calling
|
|
|
|
// this method.
|
2013-04-22 06:40:52 +04:00
|
|
|
void DrawBufferWithRotation(gfx::DrawTarget* aTarget, ContextSource aSource,
|
|
|
|
float aOpacity = 1.0,
|
2014-01-10 23:06:17 +04:00
|
|
|
gfx::CompositionOp aOperator = gfx::CompositionOp::OP_OVER,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
gfx::SourceSurface* aMask = nullptr,
|
|
|
|
const gfx::Matrix* aMaskTransform = nullptr) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* |BufferRect()| is the rect of device pixels that this
|
2013-11-27 04:29:46 +04:00
|
|
|
* RotatedBuffer covers. That is what DrawBufferWithRotation()
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
* will paint when it's called.
|
|
|
|
*/
|
2015-04-21 18:04:57 +03:00
|
|
|
const gfx::IntRect& BufferRect() const { return mBufferRect; }
|
|
|
|
const gfx::IntPoint& BufferRotation() const { return mBufferRotation; }
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
2014-07-30 17:38:46 +04:00
|
|
|
virtual bool HaveBuffer() const = 0;
|
|
|
|
virtual bool HaveBufferOnWhite() const = 0;
|
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const = 0;
|
2013-04-22 06:40:52 +04:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
enum XSide {
|
|
|
|
LEFT, RIGHT
|
|
|
|
};
|
|
|
|
enum YSide {
|
|
|
|
TOP, BOTTOM
|
|
|
|
};
|
2015-04-21 18:04:57 +03:00
|
|
|
gfx::IntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
2013-11-05 08:50:57 +04:00
|
|
|
gfx::Rect GetSourceRectangle(XSide aXSide, YSide aYSide) const;
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
/*
|
|
|
|
* If aMask is non-null, then it is used as an alpha mask for rendering this
|
|
|
|
* buffer. aMaskTransform must be non-null if aMask is non-null, and is used
|
|
|
|
* to adjust the coordinate space of the mask.
|
|
|
|
*/
|
|
|
|
void DrawBufferQuadrant(gfx::DrawTarget* aTarget, XSide aXSide, YSide aYSide,
|
2013-04-22 06:40:52 +04:00
|
|
|
ContextSource aSource,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
float aOpacity,
|
2013-09-11 09:08:53 +04:00
|
|
|
gfx::CompositionOp aOperator,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
gfx::SourceSurface* aMask,
|
|
|
|
const gfx::Matrix* aMaskTransform) const;
|
|
|
|
|
2014-09-26 21:06:08 +04:00
|
|
|
/** The area of the PaintedLayer that is covered by the buffer as a whole */
|
2015-04-21 18:04:57 +03:00
|
|
|
gfx::IntRect mBufferRect;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
/**
|
|
|
|
* The x and y rotation of the buffer. Conceptually the buffer
|
|
|
|
* has its origin translated to mBufferRect.TopLeft() - mBufferRotation,
|
|
|
|
* is tiled to fill the plane, and the result is clipped to mBufferRect.
|
|
|
|
* So the pixel at mBufferRotation within the buffer is what gets painted at
|
|
|
|
* mBufferRect.TopLeft().
|
|
|
|
* This is "rotation" in the sense of rotating items in a linear buffer,
|
|
|
|
* where items falling off the end of the buffer are returned to the
|
|
|
|
* buffer at the other end, not 2D rotation!
|
|
|
|
*/
|
2015-04-21 18:04:57 +03:00
|
|
|
gfx::IntPoint mBufferRotation;
|
2013-10-12 00:47:47 +04:00
|
|
|
// When this is true it means that all pixels have moved inside the buffer.
|
|
|
|
// It's not possible to sync with another buffer without a full copy.
|
|
|
|
bool mDidSelfCopy;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
};
|
|
|
|
|
2014-07-30 17:38:46 +04:00
|
|
|
class SourceRotatedBuffer : public RotatedBuffer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SourceRotatedBuffer(gfx::SourceSurface* aSource, gfx::SourceSurface* aSourceOnWhite,
|
2015-04-21 18:04:57 +03:00
|
|
|
const gfx::IntRect& aBufferRect,
|
|
|
|
const gfx::IntPoint& aBufferRotation)
|
2014-07-30 17:38:46 +04:00
|
|
|
: RotatedBuffer(aBufferRect, aBufferRotation)
|
|
|
|
, mSource(aSource)
|
|
|
|
, mSourceOnWhite(aSourceOnWhite)
|
|
|
|
{ }
|
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const;
|
2014-07-30 17:38:46 +04:00
|
|
|
|
|
|
|
virtual bool HaveBuffer() const { return !!mSource; }
|
|
|
|
virtual bool HaveBufferOnWhite() const { return !!mSourceOnWhite; }
|
|
|
|
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gfx::SourceSurface> mSource;
|
|
|
|
RefPtr<gfx::SourceSurface> mSourceOnWhite;
|
2014-07-30 17:38:46 +04:00
|
|
|
};
|
|
|
|
|
2014-01-08 01:09:34 +04:00
|
|
|
// Mixin class for classes which need logic for loaning out a draw target.
|
|
|
|
// See comments on BorrowDrawTargetForQuadrantUpdate.
|
|
|
|
class BorrowDrawTarget
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
void ReturnDrawTarget(gfx::DrawTarget*& aReturned);
|
|
|
|
|
|
|
|
// The draw target loaned by BorrowDrawTargetForQuadrantUpdate. It should not
|
|
|
|
// be used, we just keep a reference to ensure it is kept alive and so we can
|
|
|
|
// correctly restore state when it is returned.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gfx::DrawTarget> mLoanedDrawTarget;
|
2014-01-08 01:09:34 +04:00
|
|
|
gfx::Matrix mLoanedTransform;
|
2017-08-24 21:03:16 +03:00
|
|
|
|
|
|
|
// This flag denotes whether or not a transform was already applied
|
|
|
|
// to mLoanedDrawTarget and thus needs to be reset to mLoanedTransform
|
|
|
|
// upon returning the drawtarget.
|
|
|
|
bool mSetTransform;
|
2014-01-08 01:09:34 +04:00
|
|
|
};
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
/**
|
2014-09-26 21:06:08 +04:00
|
|
|
* This class encapsulates the buffer used to retain PaintedLayer contents,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
* i.e., the contents of the layer's GetVisibleRegion().
|
|
|
|
*/
|
2014-01-08 01:09:34 +04:00
|
|
|
class RotatedContentBuffer : public RotatedBuffer
|
|
|
|
, public BorrowDrawTarget
|
|
|
|
{
|
2010-03-04 00:37:04 +03:00
|
|
|
public:
|
2013-09-25 00:45:13 +04:00
|
|
|
typedef gfxContentType ContentType;
|
2010-07-21 22:06:33 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Controls the size of the backing buffer of this.
|
|
|
|
* - SizedToVisibleBounds: the backing buffer is exactly the same
|
2014-09-26 21:06:08 +04:00
|
|
|
* size as the bounds of PaintedLayer's visible region
|
2010-07-21 22:06:33 +04:00
|
|
|
* - ContainsVisibleBounds: the backing buffer is large enough to
|
|
|
|
* fit visible bounds. May be larger.
|
|
|
|
*/
|
|
|
|
enum BufferSizePolicy {
|
|
|
|
SizedToVisibleBounds,
|
|
|
|
ContainsVisibleBounds
|
|
|
|
};
|
|
|
|
|
2014-08-20 08:55:14 +04:00
|
|
|
explicit RotatedContentBuffer(BufferSizePolicy aBufferSizePolicy)
|
2014-04-01 10:28:23 +04:00
|
|
|
: mBufferProvider(nullptr)
|
2013-04-22 06:40:52 +04:00
|
|
|
, mBufferProviderOnWhite(nullptr)
|
2010-07-21 22:06:33 +04:00
|
|
|
, mBufferSizePolicy(aBufferSizePolicy)
|
2010-03-04 00:37:04 +03:00
|
|
|
{
|
2013-11-27 04:29:46 +04:00
|
|
|
MOZ_COUNT_CTOR(RotatedContentBuffer);
|
2010-03-04 00:37:04 +03:00
|
|
|
}
|
2013-11-27 04:29:46 +04:00
|
|
|
virtual ~RotatedContentBuffer()
|
2010-03-04 00:37:04 +03:00
|
|
|
{
|
2013-11-27 04:29:46 +04:00
|
|
|
MOZ_COUNT_DTOR(RotatedContentBuffer);
|
2010-03-04 00:37:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wipe out all retained contents. Call this when the entire
|
|
|
|
* buffer becomes invalid.
|
|
|
|
*/
|
|
|
|
void Clear()
|
|
|
|
{
|
2017-02-04 08:53:30 +03:00
|
|
|
UnlockBuffers();
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
mDTBuffer = nullptr;
|
2013-04-22 06:40:52 +04:00
|
|
|
mDTBufferOnWhite = nullptr;
|
2012-09-12 14:41:34 +04:00
|
|
|
mBufferProvider = nullptr;
|
2013-04-22 06:40:52 +04:00
|
|
|
mBufferProviderOnWhite = nullptr;
|
2011-04-19 07:07:23 +04:00
|
|
|
mBufferRect.SetEmpty();
|
2010-03-04 00:37:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-01-08 01:09:34 +04:00
|
|
|
* This is returned by BeginPaint. The caller should draw into mTarget.
|
2010-03-04 00:37:04 +03:00
|
|
|
* mRegionToDraw must be drawn. mRegionToInvalidate has been invalidated
|
2013-11-27 04:29:46 +04:00
|
|
|
* by RotatedContentBuffer and must be redrawn on the screen.
|
2010-03-04 00:37:04 +03:00
|
|
|
* mRegionToInvalidate is set when the buffer has changed from
|
|
|
|
* opaque to transparent or vice versa, since the details of rendering can
|
2011-03-12 08:22:39 +03:00
|
|
|
* depend on the buffer type. mDidSelfCopy is true if we kept our buffer
|
|
|
|
* but used MovePixels() to shift its content.
|
2010-03-04 00:37:04 +03:00
|
|
|
*/
|
|
|
|
struct PaintState {
|
2011-08-18 01:52:48 +04:00
|
|
|
PaintState()
|
2014-07-04 00:31:06 +04:00
|
|
|
: mRegionToDraw()
|
|
|
|
, mRegionToInvalidate()
|
|
|
|
, mMode(SurfaceMode::SURFACE_NONE)
|
2014-10-01 09:25:25 +04:00
|
|
|
, mClip(DrawRegionClip::NONE)
|
2014-01-30 13:39:11 +04:00
|
|
|
, mContentType(gfxContentType::SENTINEL)
|
2014-01-08 01:09:34 +04:00
|
|
|
, mDidSelfCopy(false)
|
2011-08-18 01:52:48 +04:00
|
|
|
{}
|
|
|
|
|
2010-03-04 00:37:04 +03:00
|
|
|
nsIntRegion mRegionToDraw;
|
|
|
|
nsIntRegion mRegionToInvalidate;
|
2014-01-17 18:00:00 +04:00
|
|
|
SurfaceMode mMode;
|
2014-01-08 01:27:14 +04:00
|
|
|
DrawRegionClip mClip;
|
2014-01-30 13:39:11 +04:00
|
|
|
ContentType mContentType;
|
2014-01-08 01:09:34 +04:00
|
|
|
bool mDidSelfCopy;
|
2010-03-04 00:37:04 +03:00
|
|
|
};
|
2010-07-21 22:06:33 +04:00
|
|
|
|
2011-03-01 23:30:16 +03:00
|
|
|
enum {
|
2012-03-19 04:01:47 +04:00
|
|
|
PAINT_WILL_RESAMPLE = 0x01,
|
2014-04-09 13:15:17 +04:00
|
|
|
PAINT_NO_ROTATION = 0x02,
|
|
|
|
PAINT_CAN_DRAW_ROTATED = 0x04
|
2011-03-01 23:30:16 +03:00
|
|
|
};
|
2010-03-04 00:37:04 +03:00
|
|
|
/**
|
2010-07-16 01:08:10 +04:00
|
|
|
* Start a drawing operation. This returns a PaintState describing what
|
2010-03-04 00:37:04 +03:00
|
|
|
* needs to be drawn to bring the buffer up to date in the visible region.
|
|
|
|
* This queries aLayer to get the currently valid and visible regions.
|
2014-01-08 01:09:34 +04:00
|
|
|
* The returned mTarget may be null if mRegionToDraw is empty.
|
2010-03-04 00:37:04 +03:00
|
|
|
* Otherwise it must not be null.
|
|
|
|
* mRegionToInvalidate will contain mRegionToDraw.
|
2011-03-01 23:30:16 +03:00
|
|
|
* @param aFlags when PAINT_WILL_RESAMPLE is passed, this indicates that
|
|
|
|
* buffer will be resampled when rendering (i.e the effective transform
|
|
|
|
* combined with the scale for the resolution is not just an integer
|
|
|
|
* translation). This will disable buffer rotation (since we don't want
|
|
|
|
* to resample across the rotation boundary) and will ensure that we
|
|
|
|
* make the entire buffer contents valid (since we don't want to sample
|
|
|
|
* invalid pixels outside the visible region, if the visible region doesn't
|
|
|
|
* fill the buffer bounds).
|
2014-04-09 13:15:17 +04:00
|
|
|
* PAINT_CAN_DRAW_ROTATED can be passed if the caller supports drawing
|
|
|
|
* rotated content that crosses the physical buffer boundary. The caller
|
|
|
|
* will need to call BorrowDrawTargetForPainting multiple times to achieve
|
|
|
|
* this.
|
2010-03-04 00:37:04 +03:00
|
|
|
*/
|
2014-09-26 21:06:08 +04:00
|
|
|
PaintState BeginPaint(PaintedLayer* aLayer,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aFlags);
|
2010-07-21 22:06:33 +04:00
|
|
|
|
2014-04-09 13:15:17 +04:00
|
|
|
struct DrawIterator {
|
|
|
|
friend class RotatedContentBuffer;
|
|
|
|
DrawIterator()
|
|
|
|
: mCount(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
nsIntRegion mDrawRegion;
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t mCount;
|
|
|
|
};
|
|
|
|
|
2014-01-12 23:57:17 +04:00
|
|
|
/**
|
|
|
|
* Fetch a DrawTarget for rendering. The DrawTarget remains owned by
|
|
|
|
* this. See notes on BorrowDrawTargetForQuadrantUpdate.
|
|
|
|
* May return null. If the return value is non-null, it must be
|
|
|
|
* 'un-borrowed' using ReturnDrawTarget.
|
2014-04-09 13:15:17 +04:00
|
|
|
*
|
|
|
|
* If PAINT_CAN_DRAW_ROTATED was specified for BeginPaint, then the caller
|
|
|
|
* must call this function repeatedly (with an iterator) until it returns
|
|
|
|
* nullptr. The caller should draw the mDrawRegion of the iterator instead
|
|
|
|
* of mRegionToDraw in the PaintState.
|
|
|
|
*
|
|
|
|
* @param aPaintState Paint state data returned by a call to BeginPaint
|
|
|
|
* @param aIter Paint state iterator. Only required if PAINT_CAN_DRAW_ROTATED
|
|
|
|
* was specified to BeginPaint.
|
2014-01-12 23:57:17 +04:00
|
|
|
*/
|
2014-05-23 01:08:21 +04:00
|
|
|
gfx::DrawTarget* BorrowDrawTargetForPainting(PaintState& aPaintState,
|
2014-04-09 13:15:17 +04:00
|
|
|
DrawIterator* aIter = nullptr);
|
2014-01-12 23:57:17 +04:00
|
|
|
|
2017-08-04 06:51:30 +03:00
|
|
|
/**
|
2017-08-24 21:03:16 +03:00
|
|
|
* Borrow a draw target for recording. The required transform for correct painting
|
|
|
|
* is not applied to the returned DrawTarget by default, BUT it is
|
|
|
|
* required to be whenever drawing does happen.
|
2017-08-04 06:51:30 +03:00
|
|
|
*/
|
2017-08-05 21:25:45 +03:00
|
|
|
RefPtr<CapturedPaintState> BorrowDrawTargetForRecording(PaintState& aPaintState,
|
2017-08-24 21:03:16 +03:00
|
|
|
DrawIterator* aIter,
|
|
|
|
bool aSetTransform = false);
|
2017-08-03 18:50:32 +03:00
|
|
|
|
2017-08-09 19:39:07 +03:00
|
|
|
nsIntRegion ExpandDrawRegion(PaintState& aPaintState,
|
|
|
|
DrawIterator* aIter,
|
|
|
|
gfx::BackendType aBackendType);
|
2017-08-03 18:50:32 +03:00
|
|
|
|
|
|
|
static bool PrepareDrawTargetForPainting(CapturedPaintState*);
|
2011-04-01 01:33:46 +04:00
|
|
|
enum {
|
2013-04-22 06:40:52 +04:00
|
|
|
BUFFER_COMPONENT_ALPHA = 0x02 // Dual buffers should be created for drawing with
|
|
|
|
// component alpha.
|
2011-04-01 01:33:46 +04:00
|
|
|
};
|
2010-03-04 00:37:04 +03:00
|
|
|
/**
|
2010-07-21 22:06:33 +04:00
|
|
|
* Return a new surface of |aSize| and |aType|.
|
2014-11-25 22:19:04 +03:00
|
|
|
*
|
2013-09-12 08:53:46 +04:00
|
|
|
* If the created buffer supports azure content, then the result(s) will
|
|
|
|
* be returned in aBlackDT/aWhiteDT, otherwise aBlackSurface/aWhiteSurface
|
|
|
|
* will be used.
|
2010-03-04 00:37:04 +03:00
|
|
|
*/
|
2013-09-12 08:53:46 +04:00
|
|
|
virtual void
|
2015-04-21 18:04:57 +03:00
|
|
|
CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags,
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) = 0;
|
2010-03-04 00:37:04 +03:00
|
|
|
|
2010-07-16 01:08:10 +04:00
|
|
|
/**
|
|
|
|
* Get the underlying buffer, if any. This is useful because we can pass
|
|
|
|
* in the buffer as the default "reference surface" if there is one.
|
|
|
|
* Don't use it for anything else!
|
|
|
|
*/
|
2013-08-09 03:30:18 +04:00
|
|
|
gfx::DrawTarget* GetDTBuffer() { return mDTBuffer; }
|
|
|
|
gfx::DrawTarget* GetDTBufferOnWhite() { return mDTBufferOnWhite; }
|
2010-07-16 01:08:10 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const;
|
2014-07-30 17:38:46 +04:00
|
|
|
|
2010-09-14 09:23:08 +04:00
|
|
|
/**
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
* Complete the drawing operation. The region to draw must have been
|
|
|
|
* drawn before this is called. The contents of the buffer are drawn
|
|
|
|
* to aTarget.
|
2010-09-14 09:23:08 +04:00
|
|
|
*/
|
2014-09-26 21:06:08 +04:00
|
|
|
void DrawTo(PaintedLayer* aLayer,
|
2014-01-08 01:09:34 +04:00
|
|
|
gfx::DrawTarget* aTarget,
|
|
|
|
float aOpacity,
|
|
|
|
gfx::CompositionOp aOp,
|
2014-04-09 13:15:19 +04:00
|
|
|
gfx::SourceSurface* aMask,
|
2014-01-28 00:25:20 +04:00
|
|
|
const gfx::Matrix* aMaskTransform);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
|
|
|
protected:
|
2013-12-05 22:39:22 +04:00
|
|
|
// new texture client versions
|
|
|
|
void SetBufferProvider(TextureClient* aClient)
|
|
|
|
{
|
|
|
|
// Only this buffer provider can give us a buffer. If we
|
|
|
|
// already have one, something has gone wrong.
|
2016-04-13 10:56:00 +03:00
|
|
|
MOZ_ASSERT(!aClient || !mDTBuffer || !mDTBuffer->IsValid());
|
2013-12-05 22:39:22 +04:00
|
|
|
|
|
|
|
mBufferProvider = aClient;
|
|
|
|
if (!mBufferProvider) {
|
|
|
|
mDTBuffer = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetBufferProviderOnWhite(TextureClient* aClient)
|
2013-11-28 01:16:33 +04:00
|
|
|
{
|
|
|
|
// Only this buffer provider can give us a buffer. If we
|
|
|
|
// already have one, something has gone wrong.
|
2016-04-13 10:56:00 +03:00
|
|
|
MOZ_ASSERT(!aClient || !mDTBufferOnWhite || !mDTBufferOnWhite->IsValid());
|
2013-11-28 01:16:33 +04:00
|
|
|
|
2013-11-28 01:16:35 +04:00
|
|
|
mBufferProviderOnWhite = aClient;
|
|
|
|
if (!mBufferProviderOnWhite) {
|
2013-11-28 01:16:33 +04:00
|
|
|
mDTBufferOnWhite = nullptr;
|
2014-04-01 10:28:23 +04:00
|
|
|
}
|
2013-04-22 06:40:52 +04:00
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
2010-11-05 10:17:07 +03:00
|
|
|
/**
|
2014-01-08 01:09:34 +04:00
|
|
|
* Get a draw target at the specified resolution for updating |aBounds|,
|
2010-11-05 10:17:07 +03:00
|
|
|
* which must be contained within a single quadrant.
|
2013-05-10 01:02:50 +04:00
|
|
|
*
|
2014-01-08 01:09:34 +04:00
|
|
|
* The result should only be held temporarily by the caller (it will be kept
|
|
|
|
* alive by this). Once used it should be returned using ReturnDrawTarget.
|
|
|
|
* BorrowDrawTargetForQuadrantUpdate may not be called more than once without
|
|
|
|
* first calling ReturnDrawTarget.
|
|
|
|
*
|
2017-08-04 06:51:30 +03:00
|
|
|
* ReturnDrawTarget will by default restore the transform on the draw target.
|
|
|
|
* But it is the callers responsibility to restore the clip.
|
|
|
|
* The caller should flush the draw target, if necessary.
|
2017-08-24 21:03:16 +03:00
|
|
|
* If aSetTransform is false, the required transform will be set in aOutTransform.
|
2010-11-05 10:17:07 +03:00
|
|
|
*/
|
2014-01-08 01:09:34 +04:00
|
|
|
gfx::DrawTarget*
|
2015-04-21 18:04:57 +03:00
|
|
|
BorrowDrawTargetForQuadrantUpdate(const gfx::IntRect& aBounds,
|
2014-04-10 12:42:29 +04:00
|
|
|
ContextSource aSource,
|
2017-08-04 06:51:30 +03:00
|
|
|
DrawIterator* aIter,
|
|
|
|
bool aSetTransform = true,
|
|
|
|
gfx::Matrix* aOutTransform = nullptr);
|
2010-11-05 10:17:07 +03:00
|
|
|
|
2014-01-08 01:09:34 +04:00
|
|
|
static bool IsClippingCheap(gfx::DrawTarget* aTarget, const nsIntRegion& aRegion);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
|
|
|
protected:
|
2012-09-12 14:41:34 +04:00
|
|
|
/**
|
|
|
|
* Return the buffer's content type. Requires a valid buffer or
|
|
|
|
* buffer provider.
|
|
|
|
*/
|
2013-09-25 00:45:13 +04:00
|
|
|
gfxContentType BufferContentType();
|
2015-03-29 17:59:08 +03:00
|
|
|
bool BufferSizeOkFor(const gfx::IntSize& aSize);
|
2012-09-12 14:41:34 +04:00
|
|
|
/**
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
* If the buffer hasn't been mapped, map it.
|
2012-09-12 14:41:34 +04:00
|
|
|
*/
|
2013-11-22 02:07:55 +04:00
|
|
|
bool EnsureBuffer();
|
|
|
|
bool EnsureBufferOnWhite();
|
2014-01-09 04:57:52 +04:00
|
|
|
|
|
|
|
// Flush our buffers if they are mapped.
|
|
|
|
void FlushBuffers();
|
|
|
|
|
2012-09-12 14:41:34 +04:00
|
|
|
/**
|
|
|
|
* True if we have a buffer where we can get it (but not necessarily
|
|
|
|
* mapped currently).
|
|
|
|
*/
|
2013-04-22 06:40:52 +04:00
|
|
|
virtual bool HaveBuffer() const;
|
|
|
|
virtual bool HaveBufferOnWhite() const;
|
2010-07-21 22:06:33 +04:00
|
|
|
|
2014-01-12 23:54:40 +04:00
|
|
|
/**
|
|
|
|
* Any actions that should be performed at the last moment before we begin
|
|
|
|
* rendering the next frame. I.e., after we calculate what we will draw,
|
|
|
|
* but before we rotate the buffer and possibly create new buffers.
|
|
|
|
* aRegionToDraw is the region which is guaranteed to be overwritten when
|
|
|
|
* drawing the next frame.
|
|
|
|
*/
|
|
|
|
virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) {}
|
|
|
|
|
2017-02-04 08:53:30 +03:00
|
|
|
virtual bool LockBuffers() { return true; }
|
|
|
|
virtual void UnlockBuffers() {}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gfx::DrawTarget> mDTBuffer;
|
|
|
|
RefPtr<gfx::DrawTarget> mDTBufferOnWhite;
|
2014-07-30 17:38:46 +04:00
|
|
|
|
2012-09-12 14:41:34 +04:00
|
|
|
/**
|
2013-11-27 04:29:46 +04:00
|
|
|
* These members are only set transiently. They're used to map mDTBuffer
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
* when we're using surfaces that require explicit map/unmap. Only one
|
|
|
|
* may be used at a time.
|
2012-09-12 14:41:34 +04:00
|
|
|
*/
|
2013-12-05 22:39:22 +04:00
|
|
|
TextureClient* mBufferProvider;
|
|
|
|
TextureClient* mBufferProviderOnWhite;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
|
2010-07-21 22:06:33 +04:00
|
|
|
BufferSizePolicy mBufferSizePolicy;
|
2010-03-04 00:37:04 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2010-03-04 00:37:04 +03:00
|
|
|
|
2013-11-27 04:29:46 +04:00
|
|
|
#endif /* ROTATEDBUFFER_H_ */
|