Bug 1170390 - Detect 16bpp cairo xlib surface format. r=jrmuizel

This commit is contained in:
Lee Salzman 2015-07-06 20:19:56 -04:00
Родитель 9486e52615
Коммит 6f442f976d
2 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -675,6 +675,23 @@ DrawTargetCairo::GetSize()
return mSize;
}
SurfaceFormat
GfxFormatForCairoSurface(cairo_surface_t* surface)
{
cairo_surface_type_t type = cairo_surface_get_type(surface);
if (type == CAIRO_SURFACE_TYPE_IMAGE) {
return CairoFormatToGfxFormat(cairo_image_surface_get_format(surface));
}
#ifdef CAIRO_HAS_XLIB_SURFACE
// xlib is currently the only Cairo backend that creates 16bpp surfaces
if (type == CAIRO_SURFACE_TYPE_XLIB &&
cairo_xlib_surface_get_depth(surface) == 16) {
return SurfaceFormat::R5G6B5;
}
#endif
return CairoContentToGfxFormat(cairo_surface_get_content(surface));
}
already_AddRefed<SourceSurface>
DrawTargetCairo::Snapshot()
{

Просмотреть файл

@ -234,15 +234,7 @@ CairoFormatToGfxFormat(cairo_format_t format)
}
}
static inline SurfaceFormat
GfxFormatForCairoSurface(cairo_surface_t* surface)
{
if (cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_IMAGE) {
return CairoFormatToGfxFormat(cairo_image_surface_get_format(surface));
}
return CairoContentToGfxFormat(cairo_surface_get_content(surface));
}
SurfaceFormat GfxFormatForCairoSurface(cairo_surface_t* surface);
static inline void
GfxMatrixToCairoMatrix(const Matrix& mat, cairo_matrix_t& retval)