mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1034257 - Implement CreateSourceSurfaceForNativeSurface for Cairo surface types, to enable Xlib surfaces to be drawn properly when using Skia content rendering r=jrmuizel
This commit is contained in:
parent
cf08ba484c
commit
258cd60ddb
@ -4,6 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "DrawTargetSkia.h"
|
||||
#include "SourceSurfaceCairo.h"
|
||||
#include "SourceSurfaceSkia.h"
|
||||
#include "ScaledFontBase.h"
|
||||
#include "ScaledFontCairo.h"
|
||||
@ -657,6 +658,16 @@ DrawTargetSkia::OptimizeSourceSurface(SourceSurface *aSurface) const
|
||||
TemporaryRef<SourceSurface>
|
||||
DrawTargetSkia::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const
|
||||
{
|
||||
if (aSurface.mType == NativeSurfaceType::CAIRO_SURFACE) {
|
||||
if (aSurface.mSize.width <= 0 ||
|
||||
aSurface.mSize.height <= 0) {
|
||||
gfxWarning() << "Can't create a SourceSurface without a valid size";
|
||||
return nullptr;
|
||||
}
|
||||
cairo_surface_t* surf = static_cast<cairo_surface_t*>(aSurface.mSurface);
|
||||
return new SourceSurfaceCairo(surf, aSurface.mSize, aSurface.mFormat);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user