зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1100448 - Protect against null cairo_surface_t when getting the underlying surface from DrawTargetCairo. r=Bas
This commit is contained in:
Родитель
2ff4d387d6
Коммит
fe181325e2
|
@ -87,16 +87,18 @@ DCFromDrawTarget::DCFromDrawTarget(DrawTarget& aDrawTarget)
|
|||
if (aDrawTarget.GetBackendType() == BackendType::CAIRO) {
|
||||
cairo_surface_t *surf = (cairo_surface_t*)
|
||||
aDrawTarget.GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE);
|
||||
cairo_surface_type_t surfaceType = cairo_surface_get_type(surf);
|
||||
if (surfaceType == CAIRO_SURFACE_TYPE_WIN32 ||
|
||||
surfaceType == CAIRO_SURFACE_TYPE_WIN32_PRINTING) {
|
||||
mDC = cairo_win32_surface_get_dc(surf);
|
||||
mNeedsRelease = false;
|
||||
SaveDC(mDC);
|
||||
cairo_t* ctx = (cairo_t*)
|
||||
aDrawTarget.GetNativeSurface(NativeSurfaceType::CAIRO_CONTEXT);
|
||||
cairo_scaled_font_t* scaled = cairo_get_scaled_font(ctx);
|
||||
cairo_win32_scaled_font_select_font(scaled, mDC);
|
||||
if (surf) {
|
||||
cairo_surface_type_t surfaceType = cairo_surface_get_type(surf);
|
||||
if (surfaceType == CAIRO_SURFACE_TYPE_WIN32 ||
|
||||
surfaceType == CAIRO_SURFACE_TYPE_WIN32_PRINTING) {
|
||||
mDC = cairo_win32_surface_get_dc(surf);
|
||||
mNeedsRelease = false;
|
||||
SaveDC(mDC);
|
||||
cairo_t* ctx = (cairo_t*)
|
||||
aDrawTarget.GetNativeSurface(NativeSurfaceType::CAIRO_CONTEXT);
|
||||
cairo_scaled_font_t* scaled = cairo_get_scaled_font(ctx);
|
||||
cairo_win32_scaled_font_select_font(scaled, mDC);
|
||||
}
|
||||
}
|
||||
if (!mDC) {
|
||||
mDC = GetDC(nullptr);
|
||||
|
|
Загрузка…
Ссылка в новой задаче