2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2013-07-17 16:12:22 +04:00
|
|
|
* 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 MOZILLA_GFX_DRAWTARGETD2D1_H_
|
|
|
|
#define MOZILLA_GFX_DRAWTARGETD2D1_H_
|
|
|
|
|
|
|
|
#include "2D.h"
|
|
|
|
#include <d3d11.h>
|
|
|
|
#include <d2d1_1.h>
|
|
|
|
#include "PathD2D.h"
|
|
|
|
#include "HelpersD2D.h"
|
2017-07-18 22:15:39 +03:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2013-07-17 16:12:22 +04:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <unordered_set>
|
|
|
|
|
|
|
|
struct IDWriteFactory;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
class SourceSurfaceD2D1;
|
|
|
|
|
|
|
|
const int32_t kLayerCacheSize1 = 5;
|
|
|
|
|
|
|
|
class DrawTargetD2D1 : public DrawTarget {
|
|
|
|
public:
|
2015-12-16 18:41:21 +03:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawTargetD2D1, override)
|
2013-07-17 16:12:22 +04:00
|
|
|
DrawTargetD2D1();
|
|
|
|
virtual ~DrawTargetD2D1();
|
|
|
|
|
2019-01-23 02:09:28 +03:00
|
|
|
virtual bool IsValid() const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual DrawTargetType GetType() const override {
|
|
|
|
return DrawTargetType::HARDWARE_RASTER;
|
|
|
|
}
|
2015-12-16 18:41:21 +03:00
|
|
|
virtual BackendType GetBackendType() const override {
|
|
|
|
return BackendType::DIRECT2D1_1;
|
|
|
|
}
|
|
|
|
virtual already_AddRefed<SourceSurface> Snapshot() override;
|
2017-06-02 21:13:36 +03:00
|
|
|
virtual already_AddRefed<SourceSurface> IntoLuminanceSource(
|
|
|
|
LuminanceType aLuminanceType, float aOpacity) override;
|
2018-01-23 20:10:11 +03:00
|
|
|
virtual IntSize GetSize() const override { return mSize; }
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2015-12-16 18:41:21 +03:00
|
|
|
virtual void Flush() override;
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void DrawSurface(SourceSurface* aSurface, const Rect& aDest,
|
|
|
|
const Rect& aSource,
|
|
|
|
const DrawSurfaceOptions& aSurfOptions,
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions) override;
|
2013-11-27 15:22:56 +04:00
|
|
|
virtual void DrawFilter(FilterNode* aNode, const Rect& aSourceRect,
|
|
|
|
const Point& aDestPoint,
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void DrawSurfaceWithShadow(SourceSurface* aSurface,
|
2020-03-09 17:16:17 +03:00
|
|
|
const Point& aDest,
|
2022-04-01 22:03:29 +03:00
|
|
|
const ShadowOptions& aShadow,
|
2015-12-16 18:41:21 +03:00
|
|
|
CompositionOp aOperator) override;
|
|
|
|
virtual void ClearRect(const Rect& aRect) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void MaskSurface(
|
|
|
|
const Pattern& aSource, SourceSurface* aMask, Point aOffset,
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
|
|
|
|
virtual void CopySurface(SourceSurface* aSurface, const IntRect& aSourceRect,
|
2015-12-16 18:41:21 +03:00
|
|
|
const IntPoint& aDestination) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
|
|
|
|
virtual void FillRect(const Rect& aRect, const Pattern& aPattern,
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2019-01-17 22:29:43 +03:00
|
|
|
virtual void FillRoundedRect(
|
|
|
|
const RoundedRect& aRect, const Pattern& aPattern,
|
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2019-05-01 11:47:10 +03:00
|
|
|
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void StrokeRect(const Rect& aRect, const Pattern& aPattern,
|
|
|
|
const StrokeOptions& aStrokeOptions = StrokeOptions(),
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void StrokeLine(const Point& aStart, const Point& aEnd,
|
|
|
|
const Pattern& aPattern,
|
|
|
|
const StrokeOptions& aStrokeOptions = StrokeOptions(),
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2023-06-22 03:11:10 +03:00
|
|
|
virtual void StrokeCircle(
|
|
|
|
const Point& aOrigin, float radius, const Pattern& aPattern,
|
|
|
|
const StrokeOptions& aStrokeOptions = StrokeOptions(),
|
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void Stroke(const Path* aPath, const Pattern& aPattern,
|
|
|
|
const StrokeOptions& aStrokeOptions = StrokeOptions(),
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void Fill(const Path* aPath, const Pattern& aPattern,
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2023-06-22 03:11:10 +03:00
|
|
|
virtual void FillCircle(const Point& aOrigin, float radius,
|
|
|
|
const Pattern& aPattern,
|
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void FillGlyphs(ScaledFont* aFont, const GlyphBuffer& aBuffer,
|
|
|
|
const Pattern& aPattern,
|
2017-11-03 04:42:56 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
virtual void Mask(const Pattern& aSource, const Pattern& aMask,
|
2015-12-16 18:41:21 +03:00
|
|
|
const DrawOptions& aOptions = DrawOptions()) override;
|
|
|
|
virtual void PushClip(const Path* aPath) override;
|
|
|
|
virtual void PushClipRect(const Rect& aRect) override;
|
2016-09-22 00:03:20 +03:00
|
|
|
virtual void PushDeviceSpaceClipRects(const IntRect* aRects,
|
|
|
|
uint32_t aCount) override;
|
|
|
|
|
2015-12-16 18:41:21 +03:00
|
|
|
virtual void PopClip() override;
|
2022-11-17 06:10:35 +03:00
|
|
|
virtual bool RemoveAllClips() override;
|
|
|
|
|
2016-01-06 02:23:29 +03:00
|
|
|
virtual void PushLayer(bool aOpaque, Float aOpacity, SourceSurface* aMask,
|
|
|
|
const Matrix& aMaskTransform,
|
|
|
|
const IntRect& aBounds = IntRect(),
|
|
|
|
bool aCopyBackground = false) override;
|
|
|
|
virtual void PopLayer() override;
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<SourceSurface> CreateSourceSurfaceFromData(
|
2013-07-17 16:12:22 +04:00
|
|
|
unsigned char* aData, const IntSize& aSize, int32_t aStride,
|
2015-12-16 18:41:21 +03:00
|
|
|
SurfaceFormat aFormat) const override;
|
|
|
|
virtual already_AddRefed<SourceSurface> OptimizeSourceSurface(
|
|
|
|
SourceSurface* aSurface) const override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-12-16 18:41:21 +03:00
|
|
|
virtual already_AddRefed<SourceSurface> CreateSourceSurfaceFromNativeSurface(
|
|
|
|
const NativeSurface& aSurface) const override {
|
|
|
|
return nullptr;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<DrawTarget> CreateSimilarDrawTarget(
|
2015-12-16 18:41:21 +03:00
|
|
|
const IntSize& aSize, SurfaceFormat aFormat) const override;
|
2018-11-13 13:39:02 +03:00
|
|
|
virtual bool CanCreateSimilarDrawTarget(const IntSize& aSize,
|
|
|
|
SurfaceFormat aFormat) const override;
|
2019-06-21 12:51:00 +03:00
|
|
|
virtual RefPtr<DrawTarget> CreateClippedDrawTarget(
|
|
|
|
const Rect& aBounds, SurfaceFormat aFormat) override;
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2015-12-16 18:41:21 +03:00
|
|
|
virtual already_AddRefed<PathBuilder> CreatePathBuilder(
|
2023-03-17 22:04:40 +03:00
|
|
|
FillRule aFillRule = FillRule::FILL_WINDING) const override {
|
|
|
|
return PathBuilderD2D::Create(aFillRule);
|
|
|
|
}
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
virtual already_AddRefed<GradientStops> CreateGradientStops(
|
2013-07-17 16:12:22 +04:00
|
|
|
GradientStop* aStops, uint32_t aNumStops,
|
2015-12-16 18:41:21 +03:00
|
|
|
ExtendMode aExtendMode = ExtendMode::CLAMP) const override;
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2015-12-16 18:41:21 +03:00
|
|
|
virtual already_AddRefed<FilterNode> CreateFilter(FilterType aType) override;
|
2013-11-27 15:22:56 +04:00
|
|
|
|
2015-12-16 18:41:21 +03:00
|
|
|
virtual bool SupportsRegionClipping() const override { return false; }
|
2016-01-06 02:23:29 +03:00
|
|
|
virtual bool IsCurrentGroupOpaque() override {
|
|
|
|
return CurrentLayer().mIsOpaque;
|
|
|
|
}
|
2014-11-16 22:17:40 +03:00
|
|
|
|
2015-12-16 18:41:21 +03:00
|
|
|
virtual void* GetNativeSurface(NativeSurfaceType aType) override {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2016-07-01 11:58:13 +03:00
|
|
|
virtual void DetachAllSnapshots() override { MarkChanged(); }
|
|
|
|
|
2013-07-17 16:12:22 +04:00
|
|
|
bool Init(const IntSize& aSize, SurfaceFormat aFormat);
|
2014-09-15 01:51:27 +04:00
|
|
|
bool Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat);
|
2013-07-17 16:12:22 +04:00
|
|
|
uint32_t GetByteSize() const;
|
|
|
|
|
2016-04-28 16:22:31 +03:00
|
|
|
// This function will get an image for a surface, it may adjust the source
|
|
|
|
// transform for any transformation of the resulting image relative to the
|
2017-03-15 05:17:47 +03:00
|
|
|
// oritingal SourceSurface. By default, the surface and its transform are
|
|
|
|
// interpreted in user-space, but may be specified in device-space instead.
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<ID2D1Image> GetImageForSurface(
|
|
|
|
SourceSurface* aSurface, Matrix& aSourceTransform, ExtendMode aExtendMode,
|
2017-03-15 05:17:47 +03:00
|
|
|
const IntRect* aSourceRect = nullptr, bool aUserSpace = true);
|
2013-11-27 15:25:16 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<ID2D1Image> GetImageForSurface(SourceSurface* aSurface,
|
|
|
|
ExtendMode aExtendMode) {
|
2013-12-23 17:03:16 +04:00
|
|
|
Matrix mat;
|
2014-10-30 01:40:38 +03:00
|
|
|
return GetImageForSurface(aSurface, mat, aExtendMode, nullptr);
|
2013-12-23 17:03:16 +04:00
|
|
|
}
|
|
|
|
|
2017-07-18 22:15:39 +03:00
|
|
|
static RefPtr<ID2D1Factory1> factory();
|
2013-07-17 16:12:22 +04:00
|
|
|
static void CleanupD2D();
|
|
|
|
|
|
|
|
operator std::string() const {
|
|
|
|
std::stringstream stream;
|
|
|
|
stream << "DrawTargetD2D 1.1 (" << this << ")";
|
|
|
|
return stream.str();
|
|
|
|
}
|
|
|
|
|
2015-02-25 00:39:01 +03:00
|
|
|
static uint32_t GetMaxSurfaceSize() {
|
|
|
|
return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
|
|
|
|
}
|
|
|
|
|
2013-07-17 16:12:22 +04:00
|
|
|
static uint64_t mVRAMUsageDT;
|
|
|
|
static uint64_t mVRAMUsageSS;
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class SourceSurfaceD2D1;
|
|
|
|
|
2018-02-06 05:08:04 +03:00
|
|
|
void FlushInternal(bool aHasDependencyMutex = false);
|
2019-01-14 01:14:33 +03:00
|
|
|
bool EnsureInitialized();
|
2018-02-06 05:08:04 +03:00
|
|
|
|
2013-07-17 16:12:22 +04:00
|
|
|
typedef std::unordered_set<DrawTargetD2D1*> TargetSet;
|
|
|
|
|
|
|
|
// This function will mark the surface as changing, and make sure any
|
|
|
|
// copy-on-write snapshots are notified.
|
|
|
|
void MarkChanged();
|
2016-03-20 21:51:46 +03:00
|
|
|
bool ShouldClipTemporarySurfaceDrawing(CompositionOp aOp,
|
|
|
|
const Pattern& aPattern,
|
|
|
|
bool aClipIsComplex);
|
2020-04-02 21:27:35 +03:00
|
|
|
bool PrepareForDrawing(CompositionOp aOp, const Pattern& aPattern);
|
2017-09-20 15:57:25 +03:00
|
|
|
void FinalizeDrawing(CompositionOp aOp, const Pattern& aPattern);
|
2023-03-31 10:51:00 +03:00
|
|
|
bool MaybeClearRect(CompositionOp aOp, const Rect& aBounds);
|
2013-07-17 16:12:22 +04:00
|
|
|
void FlushTransformToDC() {
|
|
|
|
if (mTransformDirty) {
|
|
|
|
mDC->SetTransform(D2DMatrix(mTransform));
|
|
|
|
mTransformDirty = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void AddDependencyOnSource(SourceSurfaceD2D1* aSource);
|
|
|
|
|
2016-01-06 02:23:29 +03:00
|
|
|
// Must be called with all clips popped and an identity matrix set.
|
2017-09-20 15:57:25 +03:00
|
|
|
already_AddRefed<ID2D1Image> GetImageForLayerContent(
|
2022-03-31 11:58:39 +03:00
|
|
|
const IntRect* aBounds = nullptr, bool aShouldPreserveContent = true);
|
2016-01-06 02:23:29 +03:00
|
|
|
|
2016-01-05 11:03:08 +03:00
|
|
|
ID2D1Image* CurrentTarget() {
|
|
|
|
if (CurrentLayer().mCurrentList) {
|
|
|
|
return CurrentLayer().mCurrentList;
|
|
|
|
}
|
|
|
|
return mBitmap;
|
|
|
|
}
|
|
|
|
|
2014-09-15 01:51:29 +04:00
|
|
|
// This returns the clipped geometry, in addition it returns aClipBounds which
|
|
|
|
// represents the intersection of all pixel-aligned rectangular clips that
|
|
|
|
// are currently set. The returned clipped geometry must be clipped by these
|
2016-01-05 11:03:08 +03:00
|
|
|
// bounds to correctly reflect the total clip. This is in device space and
|
|
|
|
// only for clips applied to the -current layer-.
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<ID2D1Geometry> GetClippedGeometry(IntRect* aClipBounds);
|
2014-09-15 01:51:29 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<ID2D1Geometry> GetInverseClippedGeometry();
|
2015-04-10 08:09:31 +03:00
|
|
|
|
2016-01-05 11:03:08 +03:00
|
|
|
// This gives the device space clip rect applied to the -current layer-.
|
2014-09-15 01:51:29 +04:00
|
|
|
bool GetDeviceSpaceClipRect(D2D1_RECT_F& aClipRect, bool& aIsPixelAligned);
|
|
|
|
|
2013-07-17 16:12:22 +04:00
|
|
|
void PopAllClips();
|
2015-04-10 08:09:31 +03:00
|
|
|
void PushAllClips();
|
2015-05-29 15:49:19 +03:00
|
|
|
void PushClipsToDC(ID2D1DeviceContext* aDC, bool aForceIgnoreAlpha = false,
|
|
|
|
const D2D1_RECT_F& aMaxRect = D2D1::InfiniteRect());
|
2013-07-17 16:12:22 +04:00
|
|
|
void PopClipsFromDC(ID2D1DeviceContext* aDC);
|
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<ID2D1Brush> CreateTransparentBlackBrush();
|
|
|
|
already_AddRefed<ID2D1SolidColorBrush> GetSolidColorBrush(
|
|
|
|
const D2D_COLOR_F& aColor);
|
2023-03-31 10:51:00 +03:00
|
|
|
already_AddRefed<ID2D1Brush> CreateBrushForPattern(
|
|
|
|
const Pattern& aPattern, const DrawOptions& aOptions);
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2016-09-22 00:03:20 +03:00
|
|
|
void PushClipGeometry(ID2D1Geometry* aGeometry,
|
|
|
|
const D2D1_MATRIX_3X2_F& aTransform,
|
|
|
|
bool aPixelAligned = false);
|
|
|
|
|
2015-05-29 15:49:19 +03:00
|
|
|
void PushD2DLayer(ID2D1DeviceContext* aDC, ID2D1Geometry* aGeometry,
|
|
|
|
const D2D1_MATRIX_3X2_F& aTransform,
|
2016-09-22 00:03:20 +03:00
|
|
|
bool aPixelAligned = false, bool aForceIgnoreAlpha = false,
|
|
|
|
const D2D1_RECT_F& aLayerRect = D2D1::InfiniteRect());
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2017-05-10 11:22:08 +03:00
|
|
|
// This function is used to determine if the mDC is still valid; if it is
|
|
|
|
// stale, we should avoid using it to execute any draw commands.
|
2020-03-18 13:38:32 +03:00
|
|
|
bool IsDeviceContextValid() const;
|
2017-05-10 11:22:08 +03:00
|
|
|
|
2013-07-17 16:12:22 +04:00
|
|
|
IntSize mSize;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ID2D1Geometry> mCurrentClippedGeometry;
|
2013-07-17 16:12:22 +04:00
|
|
|
// This is only valid if mCurrentClippedGeometry is non-null. And will
|
|
|
|
// only be the intersection of all pixel-aligned retangular clips. This is in
|
|
|
|
// device space.
|
|
|
|
IntRect mCurrentClipBounds;
|
2015-10-18 08:24:48 +03:00
|
|
|
mutable RefPtr<ID2D1DeviceContext> mDC;
|
|
|
|
RefPtr<ID2D1Bitmap1> mBitmap;
|
2015-11-12 19:00:52 +03:00
|
|
|
RefPtr<ID2D1CommandList> mCommandList;
|
2013-07-17 16:12:22 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ID2D1SolidColorBrush> mSolidColorBrush;
|
2015-05-07 03:38:10 +03:00
|
|
|
|
2013-07-17 16:12:22 +04:00
|
|
|
// We store this to prevent excessive SetTextRenderingParams calls.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<IDWriteRenderingParams> mTextRenderingParams;
|
2013-07-17 16:12:22 +04:00
|
|
|
|
|
|
|
// List of pushed clips.
|
|
|
|
struct PushedClip {
|
|
|
|
D2D1_RECT_F mBounds;
|
2016-09-22 00:03:20 +03:00
|
|
|
// If mGeometry is non-null, the mTransform member will be used.
|
|
|
|
D2D1_MATRIX_3X2_F mTransform;
|
|
|
|
RefPtr<ID2D1Geometry> mGeometry;
|
|
|
|
// Indicates if mBounds, and when non-null, mGeometry with mTransform
|
|
|
|
// applied, are pixel-aligned.
|
|
|
|
bool mIsPixelAligned;
|
2013-07-17 16:12:22 +04:00
|
|
|
};
|
2016-01-05 11:03:08 +03:00
|
|
|
|
|
|
|
// List of pushed layers.
|
|
|
|
struct PushedLayer {
|
2016-01-06 02:23:33 +03:00
|
|
|
PushedLayer()
|
|
|
|
: mClipsArePushed(false),
|
|
|
|
mIsOpaque(false),
|
|
|
|
mOldPermitSubpixelAA(false) {}
|
2016-01-05 11:03:08 +03:00
|
|
|
|
|
|
|
std::vector<PushedClip> mPushedClips;
|
|
|
|
RefPtr<ID2D1CommandList> mCurrentList;
|
|
|
|
// True if the current clip stack is pushed to the CurrentTarget().
|
|
|
|
bool mClipsArePushed;
|
|
|
|
bool mIsOpaque;
|
2016-01-06 02:23:33 +03:00
|
|
|
bool mOldPermitSubpixelAA;
|
2016-01-05 11:03:08 +03:00
|
|
|
};
|
|
|
|
std::vector<PushedLayer> mPushedLayers;
|
|
|
|
PushedLayer& CurrentLayer() { return mPushedLayers.back(); }
|
2013-07-17 16:12:22 +04:00
|
|
|
|
|
|
|
// The latest snapshot of this surface. This needs to be told when this
|
|
|
|
// target is modified. We keep it alive as a cache.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<SourceSurfaceD2D1> mSnapshot;
|
2017-11-21 18:52:38 +03:00
|
|
|
std::shared_ptr<Mutex> mSnapshotLock;
|
2013-07-17 16:12:22 +04:00
|
|
|
// A list of targets we need to flush when we're modified.
|
|
|
|
TargetSet mDependentTargets;
|
|
|
|
// A list of targets which have this object in their mDependentTargets set
|
|
|
|
TargetSet mDependingOnTargets;
|
|
|
|
|
2016-02-11 23:35:07 +03:00
|
|
|
uint32_t mUsedCommandListsSincePurge;
|
2018-07-26 17:23:19 +03:00
|
|
|
uint32_t mTransformedGlyphsSinceLastPurge;
|
2016-08-22 14:22:01 +03:00
|
|
|
// When a BlendEffect has been drawn to a command list, and that command list
|
|
|
|
// is subsequently used -again- as an input to a blend effect for a command
|
|
|
|
// list, this causes an infinite recursion inside D2D as it tries to resolve
|
|
|
|
// the bounds. If we resolve the current command list before this happens we
|
|
|
|
// can avoid the subsequent hang. (See bug 1293586)
|
2017-09-22 20:37:02 +03:00
|
|
|
uint32_t mComplexBlendsWithListInList;
|
2016-01-11 18:38:10 +03:00
|
|
|
|
2017-07-18 22:15:39 +03:00
|
|
|
static StaticRefPtr<ID2D1Factory1> mFactory;
|
2017-05-10 11:22:08 +03:00
|
|
|
// This value is uesed to verify if the DrawTarget is created by a stale
|
|
|
|
// device.
|
|
|
|
uint32_t mDeviceSeq;
|
2017-06-02 21:13:36 +03:00
|
|
|
|
|
|
|
// List of effects we use
|
2017-06-22 20:15:37 +03:00
|
|
|
bool EnsureLuminanceEffect();
|
2017-06-02 21:13:36 +03:00
|
|
|
RefPtr<ID2D1Effect> mLuminanceEffect;
|
2019-01-14 01:14:33 +03:00
|
|
|
|
2019-01-24 14:37:28 +03:00
|
|
|
enum class InitState { Uninitialized, Success, Failure };
|
|
|
|
InitState mInitState;
|
2019-01-14 01:14:33 +03:00
|
|
|
RefPtr<IDXGISurface> mSurface;
|
2013-07-17 16:12:22 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* MOZILLA_GFX_DRAWTARGETD2D_H_ */
|