Backed out changeset 8dc53499b0c0 (bug 1019753)

This commit is contained in:
Carsten "Tomcat" Book 2014-06-04 10:31:06 +02:00
parent d591ed6c4f
commit 3645127e55
3 changed files with 14 additions and 30 deletions

View File

@ -2,14 +2,11 @@
* 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 "mozilla/RefPtr.h"
#include "gfxImageSurface.h"
#include "gfxPattern.h"
#include "nsICanvasRenderingContextInternal.h"
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::ipc;
DocumentRendererParent::DocumentRendererParent()
@ -31,12 +28,12 @@ void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize,
if (!mCanvas || !mCanvasContext)
return;
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());
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);
gfxRect rect(gfxPoint(0, 0), gfxSize(aSize.width, aSize.height));
mCanvasContext->NewPath();

View File

@ -3,13 +3,9 @@
* 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 {
@ -286,28 +282,19 @@ 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.
RefPtr<DataSourceSurface> emptyCanvas =
Factory::CreateDataSourceSurfaceWithStride(IntSize(aSize.width, aSize.height),
SurfaceFormat::B8G8R8A8,
4 * aSize.width);
if (!emptyCanvas) {
NS_ERROR("Failded to create DataSourceSurface");
nsRefPtr<gfxImageSurface> emptyCanvas =
new gfxImageSurface(gfxIntSize(aSize.width, aSize.height),
gfxImageFormat::ARGB32);
if (emptyCanvas->CairoStatus()) {
return NS_ERROR_INVALID_ARG;
}
ClearDataSourceSurface(emptyCanvas);
DataSourceSurface::MappedSurface map;
if (!emptyCanvas->Map(DataSourceSurface::MapType::WRITE, &map)) {
return NS_ERROR_INVALID_ARG;
}
rv = aEncoder->InitFromData(map.mData,
rv = aEncoder->InitFromData(emptyCanvas->Data(),
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);
}

View File

@ -30,7 +30,7 @@ load 256-height.ico
# frame.
HTTP load delayedframe.sjs
asserts-if(winWidget,0-1) load 681190.html # asserts can't create such a big surface
load 681190.html
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