mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1019753, part 2 - Use Moz2D DataSourceSurfaces instead of Thebes gfxImageSurfaces in DocumentRendererParent.cpp and ImageEncoder.cpp. r=mattwoodrow
This commit is contained in:
parent
e10aeadf72
commit
4bd806b7d0
@ -2,11 +2,14 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/ipc/DocumentRendererParent.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "gfxPattern.h"
|
||||
#include "nsICanvasRenderingContextInternal.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
DocumentRendererParent::DocumentRendererParent()
|
||||
@ -28,12 +31,12 @@ void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize,
|
||||
if (!mCanvas || !mCanvasContext)
|
||||
return;
|
||||
|
||||
nsRefPtr<gfxImageSurface> surf =
|
||||
new gfxImageSurface(reinterpret_cast<uint8_t*>(const_cast<nsCString&>(aData).BeginWriting()),
|
||||
gfxIntSize(aSize.width, aSize.height),
|
||||
aSize.width * 4,
|
||||
gfxImageFormat::ARGB32);
|
||||
nsRefPtr<gfxPattern> pat = new gfxPattern(surf);
|
||||
RefPtr<DataSourceSurface> dataSurface =
|
||||
Factory::CreateWrappingDataSourceSurface(reinterpret_cast<uint8_t*>(const_cast<nsCString&>(aData).BeginWriting()),
|
||||
aSize.width * 4,
|
||||
IntSize(aSize.width, aSize.height),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
nsRefPtr<gfxPattern> pat = new gfxPattern(dataSurface, Matrix());
|
||||
|
||||
gfxRect rect(gfxPoint(0, 0), gfxSize(aSize.width, aSize.height));
|
||||
mCanvasContext->NewPath();
|
||||
|
@ -3,9 +3,13 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "gfxImageSurface.h"
|
||||
#include "ImageEncoder.h"
|
||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/DataSurfaceHelpers.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -282,19 +286,28 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
|
||||
// note that if we didn't have a current context, the spec says we're
|
||||
// supposed to just return transparent black pixels of the canvas
|
||||
// dimensions.
|
||||
nsRefPtr<gfxImageSurface> emptyCanvas =
|
||||
new gfxImageSurface(gfxIntSize(aSize.width, aSize.height),
|
||||
gfxImageFormat::ARGB32);
|
||||
if (emptyCanvas->CairoStatus()) {
|
||||
RefPtr<DataSourceSurface> emptyCanvas =
|
||||
Factory::CreateDataSourceSurfaceWithStride(IntSize(aSize.width, aSize.height),
|
||||
SurfaceFormat::B8G8R8A8,
|
||||
4 * aSize.width);
|
||||
|
||||
if (!emptyCanvas) {
|
||||
NS_ERROR("Failded to create DataSourceSurface");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
rv = aEncoder->InitFromData(emptyCanvas->Data(),
|
||||
ClearDataSourceSurface(emptyCanvas);
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (!emptyCanvas->Map(DataSourceSurface::MapType::WRITE, &map)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
rv = aEncoder->InitFromData(map.mData,
|
||||
aSize.width * aSize.height * 4,
|
||||
aSize.width,
|
||||
aSize.height,
|
||||
aSize.width * 4,
|
||||
imgIEncoder::INPUT_FORMAT_HOSTARGB,
|
||||
aOptions);
|
||||
emptyCanvas->Unmap();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
imgStream = do_QueryInterface(aEncoder);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ load 256-height.ico
|
||||
# frame.
|
||||
HTTP load delayedframe.sjs
|
||||
|
||||
load 681190.html
|
||||
asserts-if(winWidget,0-1) load 681190.html # asserts can't create such a big surface
|
||||
skip-if(Android&&smallScreen) skip-if(B2G) load 694165-1.xhtml # nexus-s Android 2.3.6, bug 876275 for B2G on a VM
|
||||
load 732319-1.html
|
||||
load 844403-1.html
|
||||
|
Loading…
Reference in New Issue
Block a user