diff options
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/2d/2D.h | 3 | ||||
-rw-r--r-- | gfx/cairo/libpixman/src/pixman.h | 2 | ||||
-rw-r--r-- | gfx/ipc/GPUParent.cpp | 1 | ||||
-rw-r--r-- | gfx/ipc/moz.build | 1 | ||||
-rw-r--r-- | gfx/layers/client/ContentClient.cpp | 15 | ||||
-rw-r--r-- | gfx/layers/composite/CanvasLayerComposite.cpp | 6 | ||||
-rw-r--r-- | gfx/layers/composite/ImageLayerComposite.cpp | 9 | ||||
-rw-r--r-- | gfx/layers/composite/PaintedLayerComposite.cpp | 9 | ||||
-rw-r--r-- | gfx/qcms/qcmstypes.h | 2 | ||||
-rw-r--r-- | gfx/skia/skia/src/core/SkPath.cpp | 5 | ||||
-rw-r--r-- | gfx/thebes/gfxFontconfigFonts.cpp | 7 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatformGtk.cpp | 13 | ||||
-rw-r--r-- | gfx/thebes/gfxSVGGlyphs.cpp | 38 |
13 files changed, 82 insertions, 29 deletions
diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index c1fba3463..e2020dc9e 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -488,6 +488,9 @@ public: /** * Returns a DataSourceSurface with the same data as this one, but * guaranteed to have surface->GetType() == SurfaceType::DATA. + * + * The returning surface might be null, because of OOM or gfx device reset. + * The caller needs to do null-check before using it. */ virtual already_AddRefed<DataSourceSurface> GetDataSurface() override; diff --git a/gfx/cairo/libpixman/src/pixman.h b/gfx/cairo/libpixman/src/pixman.h index 1cbf62e21..23408b028 100644 --- a/gfx/cairo/libpixman/src/pixman.h +++ b/gfx/cairo/libpixman/src/pixman.h @@ -104,8 +104,6 @@ typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; -#elif defined (_AIX) -# include <sys/inttypes.h> #else # include <stdint.h> #endif diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index 9ff6cba9e..6833f5690 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -24,7 +24,6 @@ #include "mozilla/dom/VideoDecoderManagerChild.h" #include "mozilla/layers/LayerTreeOwnerTracker.h" #include "nsDebugImpl.h" -#include "nsExceptionHandler.h" #include "nsThreadManager.h" #include "prenv.h" #include "ProcessUtils.h" diff --git a/gfx/ipc/moz.build b/gfx/ipc/moz.build index ff3a81228..309681444 100644 --- a/gfx/ipc/moz.build +++ b/gfx/ipc/moz.build @@ -70,7 +70,6 @@ IPDL_SOURCES = [ LOCAL_INCLUDES += [ '/dom/ipc', - '/toolkit/crashreporter', '/xpcom/threads', ] diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index 3373230a9..50e159a23 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -78,8 +78,21 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder) // We can't use double buffering when using image content with // Xrender support on Linux, as ContentHostDoubleBuffered is not // suited for direct uploads to the server. + // FIXME: Even though the comment above suggests that double buffering + // is supposed to be disabled when Xrender support is being enabled + // (and used), it really wasn't. Historically, + // UseImageOffscreenSurfaces() was always false in GTK2 builds, thus + // triggering the check, regardless of UseXRender(). + // Some time later, offscreen surfaces were always enabled, but the + // Xrender functionality broke due to not using Xlib-based surfaces. + // Using Xlib-based surfaces compatible with Xrender operations seems + // to lead to weird graphical artifacts (bars and stripes) on some + // hardware (Intel-based?) when displaying quickly-changing content, + // so contrary to the statement above we'd better enable double + // buffering - which also seems to not have any negative performance + // impact. if (!gfxPlatformGtk::GetPlatform()->UseImageOffscreenSurfaces() || - !gfxVars::UseXRender()) + gfxVars::UseXRender()) #endif { useDoubleBuffering = (LayerManagerComposite::SupportsDirectTexturing() && diff --git a/gfx/layers/composite/CanvasLayerComposite.cpp b/gfx/layers/composite/CanvasLayerComposite.cpp index 3c8299e05..86f25b1ee 100644 --- a/gfx/layers/composite/CanvasLayerComposite.cpp +++ b/gfx/layers/composite/CanvasLayerComposite.cpp @@ -43,9 +43,13 @@ bool CanvasLayerComposite::SetCompositableHost(CompositableHost* aHost) { switch (aHost->GetType()) { - case CompositableType::IMAGE: + case CompositableType::IMAGE: { + if (mCompositableHost && aHost != mCompositableHost) { + mCompositableHost->Detach(this); + } mCompositableHost = aHost; return true; + } default: return false; } diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp index bac9f3790..6867aaa22 100644 --- a/gfx/layers/composite/ImageLayerComposite.cpp +++ b/gfx/layers/composite/ImageLayerComposite.cpp @@ -50,9 +50,14 @@ bool ImageLayerComposite::SetCompositableHost(CompositableHost* aHost) { switch (aHost->GetType()) { - case CompositableType::IMAGE: - mImageHost = static_cast<ImageHost*>(aHost); + case CompositableType::IMAGE: { + ImageHost* newImageHost = static_cast<ImageHost*>(aHost); + if (mImageHost && newImageHost != mImageHost) { + mImageHost->Detach(this); + } + mImageHost = newImageHost; return true; + } default: return false; } diff --git a/gfx/layers/composite/PaintedLayerComposite.cpp b/gfx/layers/composite/PaintedLayerComposite.cpp index b58f5d690..232cc4ef4 100644 --- a/gfx/layers/composite/PaintedLayerComposite.cpp +++ b/gfx/layers/composite/PaintedLayerComposite.cpp @@ -49,9 +49,14 @@ PaintedLayerComposite::SetCompositableHost(CompositableHost* aHost) switch (aHost->GetType()) { case CompositableType::CONTENT_TILED: case CompositableType::CONTENT_SINGLE: - case CompositableType::CONTENT_DOUBLE: - mBuffer = static_cast<ContentHost*>(aHost); + case CompositableType::CONTENT_DOUBLE: { + ContentHost* newBuffer = static_cast<ContentHost*>(aHost); + if (mBuffer && newBuffer != mBuffer) { + mBuffer->Detach(this); + } + mBuffer = newBuffer; return true; + } default: return false; } diff --git a/gfx/qcms/qcmstypes.h b/gfx/qcms/qcmstypes.h index d36779183..d5f843f79 100644 --- a/gfx/qcms/qcmstypes.h +++ b/gfx/qcms/qcmstypes.h @@ -38,8 +38,6 @@ typedef unsigned __int64 uintptr_t; typedef unsigned long uintptr_t; #endif -#elif defined (_AIX) -# include <sys/inttypes.h> #else # include <stdint.h> #endif diff --git a/gfx/skia/skia/src/core/SkPath.cpp b/gfx/skia/skia/src/core/SkPath.cpp index fc3db3ee5..88a449993 100644 --- a/gfx/skia/skia/src/core/SkPath.cpp +++ b/gfx/skia/skia/src/core/SkPath.cpp @@ -1620,10 +1620,10 @@ void SkPath::reverseAddPath(const SkPath& srcPath) { src = tmp.set(srcPath); } - SkPathRef::Editor ed(&fPathRef, src->fPathRef->countPoints(), src->fPathRef->countVerbs()); + SkPathRef::Editor ed(&fPathRef, src->countPoints(), src->countVerbs()); const SkPoint* pts = src->fPathRef->pointsEnd(); - // we will iterator through src's verbs backwards + // we will iterate through src's verbs backwards const uint8_t* verbs = src->fPathRef->verbsMemBegin(); // points at the last verb const uint8_t* verbsEnd = src->fPathRef->verbs(); // points just past the first verb const SkScalar* conicWeights = src->fPathRef->conicWeightsEnd(); @@ -1743,6 +1743,7 @@ void SkPath::transform(const SkMatrix& matrix, SkPath* dst) const { SkPathRef::CreateTransformedCopy(&dst->fPathRef, *fPathRef.get(), matrix); if (this != dst) { + dst->fLastMoveToIndex = fLastMoveToIndex; dst->fFillType = fFillType; dst->fConvexity = kUnknown_Convexity; dst->fIsVolatile = fIsVolatile; diff --git a/gfx/thebes/gfxFontconfigFonts.cpp b/gfx/thebes/gfxFontconfigFonts.cpp index bbcbbabf9..9caecc4c0 100644 --- a/gfx/thebes/gfxFontconfigFonts.cpp +++ b/gfx/thebes/gfxFontconfigFonts.cpp @@ -1096,15 +1096,8 @@ gfxFcFontSet::SortPreferredFonts(bool &aWaitForUserFont) FcFontSet *sets[1] = { fontSet }; FcResult result; -#ifdef SOLARIS - // Get around a crash of FcFontSetSort when FcConfig is nullptr - // Solaris's FcFontSetSort needs an FcConfig (bug 474758) - fontSet.own(FcFontSetSort(FcConfigGetCurrent(), sets, 1, mSortPattern, - FcFalse, nullptr, &result)); -#else fontSet.own(FcFontSetSort(nullptr, sets, 1, mSortPattern, FcFalse, nullptr, &result)); -#endif if (truncateMarker != nullptr && fontSet) { nsAutoRef<FcFontSet> truncatedSet(FcFontSetCreate()); diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index be75332d6..6b5593524 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -156,7 +156,7 @@ gfxPlatformGtk::CreateOffscreenSurface(const IntSize& aSize, if (gdkScreen) { // When forcing PaintedLayers to use image surfaces for content, // force creation of gfxImageSurface surfaces. - if (gfxVars::UseXRender() && !UseImageOffscreenSurfaces()) { + if (gfxVars::UseXRender()) { Screen *screen = gdk_x11_screen_get_xscreen(gdkScreen); XRenderPictFormat* xrenderFormat = gfxXlibSurface::FindRenderFormat(DisplayOfScreen(screen), @@ -166,13 +166,6 @@ gfxPlatformGtk::CreateOffscreenSurface(const IntSize& aSize, newSurface = gfxXlibSurface::Create(screen, xrenderFormat, aSize); } - } else { - // We're not going to use XRender, so we don't need to - // search for a render format - newSurface = new gfxImageSurface(aSize, aFormat); - // The gfxImageSurface ctor zeroes this for us, no need to - // waste time clearing again - needsClear = false; } } #endif @@ -182,6 +175,10 @@ gfxPlatformGtk::CreateOffscreenSurface(const IntSize& aSize, // e.g., no display, no RENDER, bad size, etc. // Fall back to image surface for the data. newSurface = new gfxImageSurface(aSize, aFormat); + + // The gfxImageSurface ctor zeroes this for us, no need to + // waste time clearing again + needsClear = false; } if (newSurface->CairoStatus()) { diff --git a/gfx/thebes/gfxSVGGlyphs.cpp b/gfx/thebes/gfxSVGGlyphs.cpp index a7615eca8..23f68f590 100644 --- a/gfx/thebes/gfxSVGGlyphs.cpp +++ b/gfx/thebes/gfxSVGGlyphs.cpp @@ -31,6 +31,7 @@ #include "nsSMILAnimationController.h" #include "gfxContext.h" #include "harfbuzz/hb.h" +#include "zlib.h" #include "mozilla/dom/ImageTracker.h" #define SVG_CONTENT_TYPE NS_LITERAL_CSTRING("image/svg+xml") @@ -285,7 +286,44 @@ gfxSVGGlyphsDocument::gfxSVGGlyphsDocument(const uint8_t *aBuffer, gfxSVGGlyphs *aSVGGlyphs) : mOwner(aSVGGlyphs) { + if (aBufLen >= 14 && aBuffer[0] == 31 && aBuffer[1] == 139) { + // It's a gzip-compressed document; decompress it before parsing. + // The original length (modulo 2^32) is found in the last 4 bytes + // of the data, stored in little-endian format. We read it as + // individual bytes to avoid possible alignment issues. + // (Note that if the original length was >2^32, then origLen here + // will be incorrect; but then the inflate() call will not return + // Z_STREAM_END and we'll bail out safely.) + size_t origLen = (size_t(aBuffer[aBufLen - 1]) << 24) + + (size_t(aBuffer[aBufLen - 2]) << 16) + + (size_t(aBuffer[aBufLen - 3]) << 8) + + size_t(aBuffer[aBufLen - 4]); + AutoTArray<uint8_t, 4096> outBuf; + if (outBuf.SetLength(origLen, mozilla::fallible)) { + z_stream s = {0}; + s.next_in = const_cast<Byte*>(aBuffer); + s.avail_in = aBufLen; + s.next_out = outBuf.Elements(); + s.avail_out = outBuf.Length(); + // The magic number 16 here is the zlib flag to expect gzip format, + // see http://www.zlib.net/manual.html#Advanced + if (Z_OK == inflateInit2(&s, 16 + MAX_WBITS)) { + int result = inflate(&s, Z_FINISH); + if (Z_STREAM_END == result) { + MOZ_ASSERT(size_t(s.next_out - outBuf.Elements()) == origLen); + ParseDocument(outBuf.Elements(), outBuf.Length()); + } else { + NS_WARNING("Failed to decompress SVG glyphs document"); + } + inflateEnd(&s); + } + } else { + NS_WARNING("Failed to allocate memory for SVG glyphs document"); + } + } else { ParseDocument(aBuffer, aBufLen); + } + if (!mDocument) { NS_WARNING("Could not parse SVG glyphs document"); return; |