зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1031055 - Get rid of the Thebes backed gfxContexts in FrameLayerBuilder.cpp, and get rid of gfxASurface::DumpAsDataURL. r=mattwoodrow
This commit is contained in:
Родитель
deb2077580
Коммит
0a412a04d6
|
@ -14,7 +14,6 @@
|
|||
#include "LayerSorter.h" // for SortLayersBy3DZOrder
|
||||
#include "LayersLogging.h" // for AppendToString
|
||||
#include "ReadbackLayer.h" // for ReadbackLayer
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxPlatform.h" // for gfxPlatform
|
||||
#include "gfxUtils.h" // for gfxUtils, etc
|
||||
#include "gfx2DGlue.h"
|
||||
|
@ -1232,18 +1231,13 @@ void WriteSnapshotLinkToDumpFile(T* aObj, std::stringstream& aStream)
|
|||
template <typename T>
|
||||
void WriteSnapshotToDumpFile_internal(T* aObj, DataSourceSurface* aSurf)
|
||||
{
|
||||
nsRefPtr<gfxImageSurface> deprecatedSurf =
|
||||
new gfxImageSurface(aSurf->GetData(),
|
||||
ThebesIntSize(aSurf->GetSize()),
|
||||
aSurf->Stride(),
|
||||
SurfaceFormatToImageFormat(aSurf->GetFormat()));
|
||||
nsCString string(aObj->Name());
|
||||
string.Append('-');
|
||||
string.AppendInt((uint64_t)aObj);
|
||||
if (gfxUtils::sDumpPaintFile) {
|
||||
fprintf_stderr(gfxUtils::sDumpPaintFile, "array[\"%s\"]=\"", string.BeginReading());
|
||||
}
|
||||
deprecatedSurf->DumpAsDataURL(gfxUtils::sDumpPaintFile);
|
||||
gfxUtils::DumpAsDataURI(aSurf, gfxUtils::sDumpPaintFile);
|
||||
if (gfxUtils::sDumpPaintFile) {
|
||||
fprintf_stderr(gfxUtils::sDumpPaintFile, "\";");
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <utility> // for pair
|
||||
#include "ContentHost.h" // for ContentHostDoubleBuffered, etc
|
||||
#include "Effects.h" // for EffectMask, Effect, etc
|
||||
#include "gfxUtils.h"
|
||||
#include "ImageHost.h" // for ImageHostBuffered, etc
|
||||
#include "TiledContentHost.h" // for TiledContentHost
|
||||
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
||||
|
@ -227,12 +228,8 @@ CompositableHost::DumpTextureHost(std::stringstream& aStream, TextureHost* aText
|
|||
dSurf->GetSize(),
|
||||
dSurf->Stride(),
|
||||
dSurf->GetFormat());
|
||||
nsRefPtr<gfxASurface> surf = platform->GetThebesSurfaceForDrawTarget(dt);
|
||||
if (!surf) {
|
||||
return;
|
||||
}
|
||||
// TODO stream surface
|
||||
surf->DumpAsDataURL(stderr);
|
||||
gfxUtils::DumpAsDataURI(dt, stderr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -695,12 +695,6 @@ gfxASurface::WriteAsPNG(const char* aFile)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfxASurface::DumpAsDataURL(FILE* aOutput)
|
||||
{
|
||||
WriteAsPNG_internal(aOutput, false);
|
||||
}
|
||||
|
||||
void
|
||||
gfxASurface::CopyAsDataURL()
|
||||
{
|
||||
|
|
|
@ -184,11 +184,6 @@ public:
|
|||
*/
|
||||
void WriteAsPNG(const char* aFile);
|
||||
|
||||
/**
|
||||
* Write as a PNG encoded Data URL to a file.
|
||||
*/
|
||||
void DumpAsDataURL(FILE* aOutput = stdout);
|
||||
|
||||
/**
|
||||
* Copy a PNG encoded Data URL to the clipboard.
|
||||
*/
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "gfxColor.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "gfxASurface.h"
|
||||
#include "gfxPattern.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
@ -1968,12 +1969,11 @@ gfxContext::WriteAsPNG(const char* aFile)
|
|||
|
||||
void
|
||||
gfxContext::DumpAsDataURL()
|
||||
{
|
||||
nsRefPtr<gfxASurface> surf = CurrentSurface();
|
||||
if (surf) {
|
||||
surf->DumpAsDataURL();
|
||||
{
|
||||
if (mDT) {
|
||||
gfxUtils::DumpAsDataURI(mDT);
|
||||
} else {
|
||||
NS_WARNING("No surface found!");
|
||||
NS_WARNING("No DrawTarget found!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "FrameLayerBuilder.h"
|
||||
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
@ -2309,13 +2310,13 @@ ContainerState::FindThebesLayerFor(nsDisplayItem* aItem,
|
|||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
static void
|
||||
DumpPaintedImage(nsDisplayItem* aItem, gfxASurface* aSurf)
|
||||
DumpPaintedImage(nsDisplayItem* aItem, SourceSurface* aSurface)
|
||||
{
|
||||
nsCString string(aItem->Name());
|
||||
string.Append('-');
|
||||
string.AppendInt((uint64_t)aItem);
|
||||
fprintf_stderr(gfxUtils::sDumpPaintFile, "array[\"%s\"]=\"", string.BeginReading());
|
||||
aSurf->DumpAsDataURL(gfxUtils::sDumpPaintFile);
|
||||
gfxUtils::DumpAsDataURI(aSurface, gfxUtils::sDumpPaintFile);
|
||||
fprintf_stderr(gfxUtils::sDumpPaintFile, "\";");
|
||||
}
|
||||
#endif
|
||||
|
@ -2336,12 +2337,14 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
|
|||
nsIntRect itemVisibleRect =
|
||||
aItem->GetVisibleRect().ToOutsidePixels(appUnitsPerDevPixel);
|
||||
|
||||
nsRefPtr<gfxASurface> surf;
|
||||
RefPtr<DrawTarget> tempDT;
|
||||
if (gfxUtils::sDumpPainting) {
|
||||
surf = gfxPlatform::GetPlatform()->CreateOffscreenSurface(itemVisibleRect.Size().ToIntSize(),
|
||||
gfxContentType::COLOR_ALPHA);
|
||||
surf->SetDeviceOffset(-itemVisibleRect.TopLeft());
|
||||
context = new gfxContext(surf);
|
||||
tempDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
|
||||
itemVisibleRect.Size().ToIntSize(),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
context = new gfxContext(tempDT);
|
||||
context->SetMatrix(gfxMatrix().Translate(-gfxPoint(itemVisibleRect.x,
|
||||
itemVisibleRect.y)));
|
||||
}
|
||||
#endif
|
||||
basic->BeginTransaction();
|
||||
|
@ -2364,12 +2367,14 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
if (gfxUtils::sDumpPainting) {
|
||||
DumpPaintedImage(aItem, surf);
|
||||
RefPtr<SourceSurface> surface = tempDT->Snapshot();
|
||||
DumpPaintedImage(aItem, surface);
|
||||
|
||||
DrawTarget* drawTarget = aContext->GetDrawTarget();
|
||||
Rect rect(itemVisibleRect.x, itemVisibleRect.y,
|
||||
itemVisibleRect.width, itemVisibleRect.height);
|
||||
drawTarget->DrawSurface(surface, rect, Rect(Point(0,0), rect.Size()));
|
||||
|
||||
surf->SetDeviceOffset(gfxPoint(0, 0));
|
||||
aContext->SetSource(surf, itemVisibleRect.TopLeft());
|
||||
aContext->Rectangle(itemVisibleRect);
|
||||
aContext->Fill();
|
||||
aItem->SetPainted();
|
||||
}
|
||||
#endif
|
||||
|
@ -3570,22 +3575,24 @@ static void DebugPaintItem(nsRenderingContext* aDest,
|
|||
gfxRect bounds(appUnitBounds.x, appUnitBounds.y, appUnitBounds.width, appUnitBounds.height);
|
||||
bounds.ScaleInverse(aPresContext->AppUnitsPerDevPixel());
|
||||
|
||||
nsRefPtr<gfxASurface> surf =
|
||||
gfxPlatform::GetPlatform()->CreateOffscreenSurface(IntSize(bounds.width, bounds.height),
|
||||
gfxContentType::COLOR_ALPHA);
|
||||
surf->SetDeviceOffset(-bounds.TopLeft());
|
||||
nsRefPtr<gfxContext> context = new gfxContext(surf);
|
||||
RefPtr<DrawTarget> tempDT =
|
||||
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
|
||||
IntSize(bounds.width, bounds.height),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
nsRefPtr<gfxContext> context = new gfxContext(tempDT);
|
||||
context->SetMatrix(gfxMatrix().Translate(-gfxPoint(bounds.x, bounds.y)));
|
||||
nsRefPtr<nsRenderingContext> ctx = new nsRenderingContext();
|
||||
ctx->Init(aDest->DeviceContext(), context);
|
||||
|
||||
aItem->Paint(aBuilder, ctx);
|
||||
DumpPaintedImage(aItem, surf);
|
||||
aItem->SetPainted();
|
||||
RefPtr<SourceSurface> surface = tempDT->Snapshot();
|
||||
DumpPaintedImage(aItem, surface);
|
||||
|
||||
surf->SetDeviceOffset(gfxPoint(0, 0));
|
||||
aDest->ThebesContext()->SetSource(surf, bounds.TopLeft());
|
||||
aDest->ThebesContext()->Rectangle(bounds);
|
||||
aDest->ThebesContext()->Fill();
|
||||
DrawTarget* drawTarget = aDest->ThebesContext()->GetDrawTarget();
|
||||
Rect rect = ToRect(bounds);
|
||||
drawTarget->DrawSurface(surface, rect, Rect(Point(0,0), rect.Size()));
|
||||
|
||||
aItem->SetPainted();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче