зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1727807 - Remove unused gfxASurface::CreateSimilarSurface. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D123789
This commit is contained in:
Родитель
a926de70ee
Коммит
70703f7b42
|
@ -249,24 +249,6 @@ void gfxASurface::Finish() {
|
|||
cairo_surface_finish(mSurface);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface> gfxASurface::CreateSimilarSurface(
|
||||
gfxContentType aContent, const IntSize& aSize) {
|
||||
if (!mSurface || !mSurfaceValid) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cairo_surface_t* surface = cairo_surface_create_similar(
|
||||
mSurface, cairo_content_t(int(aContent)), aSize.width, aSize.height);
|
||||
if (cairo_surface_status(surface)) {
|
||||
cairo_surface_destroy(surface);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<gfxASurface> result = Wrap(surface, aSize);
|
||||
cairo_surface_destroy(surface);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<gfxImageSurface> gfxASurface::CopyToARGB32ImageSurface() {
|
||||
if (!mSurface || !mSurfaceValid) {
|
||||
return nullptr;
|
||||
|
|
|
@ -73,14 +73,6 @@ class gfxASurface {
|
|||
|
||||
virtual void Finish();
|
||||
|
||||
/**
|
||||
* Create an offscreen surface that can be efficiently copied into
|
||||
* this surface (at least if tiling is not involved).
|
||||
* Returns null on error.
|
||||
*/
|
||||
virtual already_AddRefed<gfxASurface> CreateSimilarSurface(
|
||||
gfxContentType aType, const mozilla::gfx::IntSize& aSize);
|
||||
|
||||
/**
|
||||
* Returns an image surface for this surface, or nullptr if not supported.
|
||||
* This will not copy image data, just wraps an image surface around
|
||||
|
|
|
@ -65,42 +65,6 @@ void gfxWindowsSurface::InitWithDC(uint32_t flags) {
|
|||
}
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface> gfxWindowsSurface::CreateSimilarSurface(
|
||||
gfxContentType aContent, const mozilla::gfx::IntSize& aSize) {
|
||||
if (!mSurface || !mSurfaceValid) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cairo_surface_t* surface;
|
||||
if (GetContentType() == gfxContentType::COLOR_ALPHA) {
|
||||
// When creating a similar surface to a transparent surface, ensure
|
||||
// the new surface uses a DIB. cairo_surface_create_similar won't
|
||||
// use a DIB for a gfxContentType::COLOR surface if this surface doesn't
|
||||
// have a DIB (e.g. if we're a transparent window surface). But
|
||||
// we need a DIB to perform well if the new surface is composited into
|
||||
// a surface that's the result of
|
||||
// create_similar(gfxContentType::COLOR_ALPHA) (e.g. a backbuffer for the
|
||||
// window) --- that new surface *would* have a DIB.
|
||||
gfxImageFormat gformat =
|
||||
gfxPlatform::GetPlatform()->OptimalFormatForContent(aContent);
|
||||
cairo_format_t cformat = GfxFormatToCairoFormat(gformat);
|
||||
surface =
|
||||
cairo_win32_surface_create_with_dib(cformat, aSize.width, aSize.height);
|
||||
} else {
|
||||
surface = cairo_surface_create_similar(
|
||||
mSurface, (cairo_content_t)(int)aContent, aSize.width, aSize.height);
|
||||
}
|
||||
|
||||
if (cairo_surface_status(surface)) {
|
||||
cairo_surface_destroy(surface);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<gfxASurface> result = Wrap(surface, aSize);
|
||||
cairo_surface_destroy(surface);
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
gfxWindowsSurface::~gfxWindowsSurface() {
|
||||
if (mOwnsDC) {
|
||||
if (mWnd)
|
||||
|
|
|
@ -32,9 +32,6 @@ class gfxWindowsSurface : public gfxASurface {
|
|||
|
||||
explicit gfxWindowsSurface(cairo_surface_t* csurf);
|
||||
|
||||
virtual already_AddRefed<gfxASurface> CreateSimilarSurface(
|
||||
gfxContentType aType, const mozilla::gfx::IntSize& aSize);
|
||||
|
||||
void InitWithDC(uint32_t flags);
|
||||
|
||||
virtual ~gfxWindowsSurface();
|
||||
|
|
|
@ -199,60 +199,6 @@ already_AddRefed<gfxXlibSurface> gfxXlibSurface::Create(
|
|||
return result.forget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<gfxXlibSurface> gfxXlibSurface::Create(
|
||||
Screen* screen, XRenderPictFormat* format, const gfx::IntSize& size,
|
||||
Drawable relatedDrawable) {
|
||||
Drawable drawable =
|
||||
CreatePixmap(screen, size, format->depth, relatedDrawable);
|
||||
if (!drawable) return nullptr;
|
||||
|
||||
RefPtr<gfxXlibSurface> result =
|
||||
new gfxXlibSurface(screen, drawable, format, size);
|
||||
result->TakePixmap();
|
||||
|
||||
if (result->CairoStatus() != 0) return nullptr;
|
||||
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
static bool GetForce24bppPref() {
|
||||
return Preferences::GetBool("mozilla.widget.force-24bpp", false);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface> gfxXlibSurface::CreateSimilarSurface(
|
||||
gfxContentType aContent, const gfx::IntSize& aSize) {
|
||||
if (!mSurface || !mSurfaceValid) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aContent == gfxContentType::COLOR) {
|
||||
// cairo_surface_create_similar will use a matching visual if it can.
|
||||
// However, systems with 16-bit or indexed default visuals may benefit
|
||||
// from rendering with 24-bit formats.
|
||||
static bool force24bpp = GetForce24bppPref();
|
||||
if (force24bpp && cairo_xlib_surface_get_depth(CairoSurface()) != 24) {
|
||||
XRenderPictFormat* format =
|
||||
XRenderFindStandardFormat(*mDisplay, PictStandardRGB24);
|
||||
if (format) {
|
||||
// Cairo only performs simple self-copies as desired if it
|
||||
// knows that this is a Pixmap surface. It only knows that
|
||||
// surfaces are pixmap surfaces if it creates the Pixmap
|
||||
// itself, so we use cairo_surface_create_similar with a
|
||||
// temporary reference surface to indicate the format.
|
||||
Screen* screen = cairo_xlib_surface_get_screen(CairoSurface());
|
||||
RefPtr<gfxXlibSurface> depth24reference = gfxXlibSurface::Create(
|
||||
screen, format, gfx::IntSize(1, 1), mDrawable);
|
||||
if (depth24reference)
|
||||
return depth24reference->gfxASurface::CreateSimilarSurface(aContent,
|
||||
aSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gfxASurface::CreateSimilarSurface(aContent, aSize);
|
||||
}
|
||||
|
||||
void gfxXlibSurface::Finish() {
|
||||
if (mPixmapTaken && mGLXPixmap) {
|
||||
gl::sGLXLibrary.DestroyPixmap(*mDisplay, mGLXPixmap);
|
||||
|
|
|
@ -57,14 +57,9 @@ class gfxXlibSurface final : public gfxASurface {
|
|||
static cairo_surface_t* CreateCairoSurface(
|
||||
::Screen* screen, Visual* visual, const mozilla::gfx::IntSize& size,
|
||||
Drawable relatedDrawable = X11None);
|
||||
static already_AddRefed<gfxXlibSurface> Create(
|
||||
::Screen* screen, XRenderPictFormat* format,
|
||||
const mozilla::gfx::IntSize& size, Drawable relatedDrawable = X11None);
|
||||
|
||||
virtual ~gfxXlibSurface();
|
||||
|
||||
already_AddRefed<gfxASurface> CreateSimilarSurface(
|
||||
gfxContentType aType, const mozilla::gfx::IntSize& aSize) override;
|
||||
void Finish() override;
|
||||
|
||||
const mozilla::gfx::IntSize GetSize() const override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче