mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 00:17:32 +09:00
CWebRender pt2
This commit is contained in:
parent
1190eb1c6a
commit
fe181d242f
22 changed files with 1623 additions and 489 deletions
|
|
@ -10,12 +10,14 @@
|
|||
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
||||
#include "mozilla/gfx/BaseRect.h" // for BaseRect
|
||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||
#include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
|
||||
#include "mozilla/layers/Effects.h" // for TexturedEffect, Effect, etc
|
||||
#include "mozilla/layers/LayersMessages.h" // for ThebesBufferData
|
||||
#include "nsAString.h"
|
||||
#include "nsPrintfCString.h" // for nsPrintfCString
|
||||
#include "nsString.h" // for nsAutoCString
|
||||
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
|
||||
#include "gfxPrefs.h" // for gfxPrefs::WebRenderEnabled
|
||||
|
||||
namespace mozilla {
|
||||
using namespace gfx;
|
||||
|
|
@ -69,6 +71,15 @@ ContentHostTexture::Composite(LayerComposite* aLayer,
|
|||
|
||||
aEffectChain.mPrimaryEffect = effect;
|
||||
|
||||
CompositorOGL* compositorOGL = GetCompositor()->AsCompositorOGL();
|
||||
bool canUseWebRender =
|
||||
gfxPrefs::WebRenderEnabled() && compositorOGL &&
|
||||
effect->mType == EffectTypes::RGB && !mTextureSourceOnWhite &&
|
||||
!mTextureSource->AsBigImageIterator() && aTransform.Is2D() &&
|
||||
!aEffectChain.mSecondaryEffects[EffectTypes::MASK] &&
|
||||
!aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE] &&
|
||||
aSamplingFilter == SamplingFilter::LINEAR;
|
||||
|
||||
nsIntRegion tmpRegion;
|
||||
const nsIntRegion* renderRegion;
|
||||
if (PaintWillResample()) {
|
||||
|
|
@ -176,7 +187,13 @@ ContentHostTexture::Composite(LayerComposite* aLayer,
|
|||
Float(tileRegionRect.y) / texRect.height,
|
||||
Float(tileRegionRect.width) / texRect.width,
|
||||
Float(tileRegionRect.height) / texRect.height);
|
||||
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain, aOpacity, aTransform);
|
||||
if (!canUseWebRender ||
|
||||
!compositorOGL->DrawWebRenderImage(
|
||||
effect->mTexture, rect, effect->mTextureCoords, aOpacity,
|
||||
aTransform, aClipRect, effect->mPremultiplied)) {
|
||||
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
}
|
||||
if (usingTiles) {
|
||||
DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT | DiagnosticFlags::BIGIMAGE;
|
||||
if (iterOnWhite) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "composite/CompositableHost.h" // for CompositableHost, etc
|
||||
#include "ipc/IPCMessageUtils.h" // for null_t
|
||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||
#include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
|
||||
#include "mozilla/layers/Effects.h" // for TexturedEffect, Effect, etc
|
||||
#include "mozilla/layers/ImageContainerParent.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h" // for TexturedEffect, Effect, etc
|
||||
|
|
@ -16,6 +17,7 @@
|
|||
#include "nsDebug.h" // for NS_WARNING, NS_ASSERTION
|
||||
#include "nsPrintfCString.h" // for nsPrintfCString
|
||||
#include "nsString.h" // for nsAutoCString
|
||||
#include "gfxPrefs.h" // for gfxPrefs::WebRenderEnabled
|
||||
|
||||
#define BIAS_TIME_MS 1.0
|
||||
|
||||
|
|
@ -381,6 +383,16 @@ ImageHost::Composite(LayerComposite* aLayer,
|
|||
mLastProducerID = img->mProducerID;
|
||||
}
|
||||
aEffectChain.mPrimaryEffect = effect;
|
||||
CompositorOGL* compositorOGL = GetCompositor()->AsCompositorOGL();
|
||||
auto drawWebRenderImage = [&](const gfx::Rect& rect) {
|
||||
return gfxPrefs::WebRenderEnabled() && compositorOGL &&
|
||||
effect->mType == EffectTypes::RGB && aTransform.Is2D() &&
|
||||
!aEffectChain.mSecondaryEffects[EffectTypes::MASK] &&
|
||||
!aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE] &&
|
||||
compositorOGL->DrawWebRenderImage(
|
||||
effect->mTexture, rect, effect->mTextureCoords, aOpacity,
|
||||
aTransform, aClipRect, effect->mPremultiplied);
|
||||
};
|
||||
gfx::Rect pictureRect(0, 0, img->mPictureRect.width, img->mPictureRect.height);
|
||||
BigImageIterator* it = mCurrentTextureSource->AsBigImageIterator();
|
||||
if (it) {
|
||||
|
|
@ -414,8 +426,10 @@ ImageHost::Composite(LayerComposite* aLayer,
|
|||
effect->mTextureCoords.y = effect->mTextureCoords.YMost();
|
||||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
}
|
||||
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
if (!drawWebRenderImage(rect)) {
|
||||
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
}
|
||||
GetCompositor()->DrawDiagnostics(diagnosticFlags | DiagnosticFlags::BIGIMAGE,
|
||||
rect, aClipRect, aTransform, mFlashCounter);
|
||||
} while (it->NextTile());
|
||||
|
|
@ -435,8 +449,10 @@ ImageHost::Composite(LayerComposite* aLayer,
|
|||
effect->mTextureCoords.height = -effect->mTextureCoords.height;
|
||||
}
|
||||
|
||||
GetCompositor()->DrawQuad(pictureRect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
if (!drawWebRenderImage(pictureRect)) {
|
||||
GetCompositor()->DrawQuad(pictureRect, aClipRect, aEffectChain,
|
||||
aOpacity, aTransform);
|
||||
}
|
||||
GetCompositor()->DrawDiagnostics(diagnosticFlags,
|
||||
pictureRect, aClipRect,
|
||||
aTransform, mFlashCounter);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
||||
#include "mozilla/gfx/Point.h" // for IntSize
|
||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||
#include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
|
||||
//#include "mozilla/layers/CompositorBridgeParent.h" // for CompositorBridgeParent
|
||||
#include "mozilla/layers/Effects.h" // for TexturedEffect, Effect, etc
|
||||
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
|
||||
|
|
@ -486,6 +487,15 @@ TiledContentHost::RenderTile(TileHost& aTile,
|
|||
float opacity = aTile.GetFadeInOpacity(aOpacity);
|
||||
aEffectChain.mPrimaryEffect = effect;
|
||||
|
||||
CompositorOGL* compositorOGL = mCompositor->AsCompositorOGL();
|
||||
bool canUseWebRender =
|
||||
gfxPrefs::WebRenderEnabled() && compositorOGL &&
|
||||
effect->mType == EffectTypes::RGB && !aTile.mTextureHostOnWhite &&
|
||||
aTransform.Is2D() &&
|
||||
!aEffectChain.mSecondaryEffects[EffectTypes::MASK] &&
|
||||
!aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE] &&
|
||||
aSamplingFilter == gfx::SamplingFilter::LINEAR;
|
||||
|
||||
for (auto iter = aScreenRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
Rect graphicsRect(rect.x, rect.y, rect.width, rect.height);
|
||||
|
|
@ -496,7 +506,13 @@ TiledContentHost::RenderTile(TileHost& aTile,
|
|||
textureRect.y / aTextureBounds.height,
|
||||
textureRect.width / aTextureBounds.width,
|
||||
textureRect.height / aTextureBounds.height);
|
||||
mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, opacity, aTransform, aVisibleRect);
|
||||
if (!canUseWebRender ||
|
||||
!compositorOGL->DrawWebRenderImage(
|
||||
effect->mTexture, graphicsRect, effect->mTextureCoords, opacity,
|
||||
aTransform, aClipRect, effect->mPremultiplied)) {
|
||||
mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, opacity,
|
||||
aTransform, aVisibleRect);
|
||||
}
|
||||
}
|
||||
DiagnosticFlags flags = DiagnosticFlags::CONTENT | DiagnosticFlags::TILE;
|
||||
if (aTile.mTextureHostOnWhite) {
|
||||
|
|
@ -562,6 +578,10 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
return;
|
||||
}
|
||||
|
||||
CompositorOGL* compositorOGL = mCompositor->AsCompositorOGL();
|
||||
bool canUseWebRenderSolid =
|
||||
gfxPrefs::WebRenderEnabled() && compositorOGL && aTransform.Is2D();
|
||||
|
||||
if (aBackgroundColor) {
|
||||
nsIntRegion backgroundRegion = compositeRegion;
|
||||
backgroundRegion.ScaleRoundOut(resolution, resolution);
|
||||
|
|
@ -570,7 +590,12 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
|
|||
for (auto iter = backgroundRegion.RectIter(); !iter.Done(); iter.Next()) {
|
||||
const IntRect& rect = iter.Get();
|
||||
Rect graphicsRect(rect.x, rect.y, rect.width, rect.height);
|
||||
mCompositor->DrawQuad(graphicsRect, aClipRect, effect, 1.0, aTransform);
|
||||
if (!canUseWebRenderSolid ||
|
||||
!compositorOGL->DrawWebRenderRect(
|
||||
graphicsRect, *aBackgroundColor, 1.0, aTransform, aClipRect)) {
|
||||
mCompositor->DrawQuad(graphicsRect, aClipRect, effect, 1.0,
|
||||
aTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue