mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 253889 - part 1: Get rid of nsIPresShell from gfx r=jwatt
`gfxUtils::WriteAsPNG()` is the only user of `nsIPresShell` in `gfx`, but nobody calls it. So, we can get rid of it with `nsIPresShell` reference. Differential Revision: https://phabricator.services.mozilla.com/D29310 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
2b2dc014eb
commit
982428a83e
@ -17,10 +17,10 @@
|
||||
#include "nsRefreshDriver.h"
|
||||
|
||||
class nsIContentViewer;
|
||||
class nsIPresShell;
|
||||
class gfxSVGGlyphs;
|
||||
|
||||
namespace mozilla {
|
||||
class PresShell;
|
||||
class SVGContextPaint;
|
||||
namespace dom {
|
||||
class Document;
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "nsIClipboardHelper.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIGfxInfo.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsRegion.h"
|
||||
@ -1228,24 +1227,6 @@ void gfxUtils::WriteAsPNG(DrawTarget* aDT, const char* aFile) {
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void gfxUtils::WriteAsPNG(nsIPresShell* aShell, const char* aFile) {
|
||||
int32_t width = 1000, height = 1000;
|
||||
nsRect r(0, 0, aShell->GetPresContext()->DevPixelsToAppUnits(width),
|
||||
aShell->GetPresContext()->DevPixelsToAppUnits(height));
|
||||
|
||||
RefPtr<mozilla::gfx::DrawTarget> dt =
|
||||
gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
|
||||
IntSize(width, height), SurfaceFormat::B8G8R8A8);
|
||||
NS_ENSURE_TRUE(dt && dt->IsValid(), /*void*/);
|
||||
|
||||
RefPtr<gfxContext> context = gfxContext::CreateOrNull(dt);
|
||||
MOZ_ASSERT(context); // already checked the draw target above
|
||||
aShell->RenderDocument(r, RenderDocumentFlags::None, NS_RGB(255, 255, 0),
|
||||
context);
|
||||
WriteAsPNG(dt.get(), aFile);
|
||||
}
|
||||
|
||||
/* static */
|
||||
void gfxUtils::DumpAsDataURI(SourceSurface* aSurface, FILE* aFile) {
|
||||
EncodeSourceSurface(aSurface, ImageType::PNG, EmptyString(), eDataURIEncode,
|
||||
|
@ -24,7 +24,6 @@ class gfxDrawable;
|
||||
struct gfxQuad;
|
||||
class nsIInputStream;
|
||||
class nsIGfxInfo;
|
||||
class nsIPresShell;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -267,7 +266,6 @@ class gfxUtils {
|
||||
static void WriteAsPNG(SourceSurface* aSurface, const char* aFile);
|
||||
static void WriteAsPNG(DrawTarget* aDT, const nsAString& aFile);
|
||||
static void WriteAsPNG(DrawTarget* aDT, const char* aFile);
|
||||
static void WriteAsPNG(nsIPresShell* aShell, const char* aFile);
|
||||
|
||||
/**
|
||||
* Dump as a PNG encoded Data URL to a FILE stream (using stdout by
|
||||
|
Loading…
Reference in New Issue
Block a user