Bug 1025489 - Stop using gfxImageSurface in the GL code. r=Bas

This commit is contained in:
Jonathan Watt 2014-06-17 18:35:50 +01:00
Родитель 3963ab573b
Коммит a33aed0216
7 изменённых файлов: 34 добавлений и 35 удалений

Просмотреть файл

@ -8,8 +8,6 @@
#include "GLContext.h"
#include "OGLShaderProgram.h"
#include "gfxTypes.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "ScopedGLHelpers.h"
#include "mozilla/gfx/2D.h"
#include "gfx2DGlue.h"
@ -491,24 +489,29 @@ static TemporaryRef<DataSourceSurface> YInvertImageSurface(DataSourceSurface* aS
Factory::CreateDataSourceSurfaceWithStride(aSurf->GetSize(),
aSurf->GetFormat(),
aSurf->Stride());
if (!temp) {
return nullptr;
}
DataSourceSurface::MappedSurface map;
if (!temp->Map(DataSourceSurface::MapType::WRITE, &map)) {
return nullptr;
}
RefPtr<DrawTarget> dt =
Factory::CreateDrawTargetForData(BackendType::CAIRO,
temp->GetData(),
map.mData,
temp->GetSize(),
temp->Stride(),
map.mStride,
temp->GetFormat());
nsRefPtr<gfxContext> ctx = new gfxContext(dt);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->Scale(1.0, -1.0);
ctx->Translate(-gfxPoint(0.0, aSurf->GetSize().height));
nsRefPtr<gfxImageSurface> thebesSurf =
new gfxImageSurface(aSurf->GetData(),
ThebesIntSize(aSurf->GetSize()),
aSurf->Stride(),
SurfaceFormatToImageFormat(aSurf->GetFormat()));
ctx->SetSource(thebesSurf);
ctx->Paint();
if (!dt) {
temp->Unmap();
return nullptr;
}
dt->SetTransform(Matrix::Translation(0.0, aSurf->GetSize().height) *
Matrix::Scaling(1.0, -1.0));
Rect rect(0, 0, aSurf->GetSize().width, aSurf->GetSize().height);
dt->DrawSurface(aSurf, rect, rect, DrawSurfaceOptions(),
DrawOptions(1.0, CompositionOp::OP_SOURCE, AntialiasMode::NONE));
temp->Unmap();
return temp.forget();
}

Просмотреть файл

@ -14,8 +14,6 @@
#include "mozilla/RefPtr.h"
#include "mozilla/gfx/Types.h"
class gfxImageSurface;
namespace mozilla {
namespace gfx {

Просмотреть файл

@ -6,7 +6,6 @@
#include "GLScreenBuffer.h"
#include <cstring>
#include "gfxImageSurface.h"
#include "GLContext.h"
#include "GLBlitHelper.h"
#include "GLReadTexImageHelper.h"

Просмотреть файл

@ -22,9 +22,6 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Point.h"
// Forwards:
class gfxImageSurface;
namespace mozilla {
namespace gfx {
class SurfaceStream;

Просмотреть файл

@ -6,11 +6,11 @@
#include "GLTextureImage.h"
#include "GLContext.h"
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "gfxPlatform.h"
#include "gfxUtils.h"
#include "gfx2DGlue.h"
#include "gfxImageSurface.h"
#include "mozilla/gfx/2D.h"
#include "ScopedGLHelpers.h"
#include "GLUploadHelpers.h"
@ -19,6 +19,8 @@
#include "TextureImageCGL.h"
#endif
using namespace mozilla::gfx;
namespace mozilla {
namespace gl {
@ -516,10 +518,6 @@ TiledTextureImage::EndUpdate()
RefPtr<gfx::SourceSurface> updateSnapshot = mUpdateDrawTarget->Snapshot();
RefPtr<gfx::DataSourceSurface> updateData = updateSnapshot->GetDataSurface();
nsRefPtr<gfxASurface> updateSurface = new gfxImageSurface(updateData->GetData(),
gfx::ThebesIntSize(updateData->GetSize()),
updateData->Stride(),
gfx::SurfaceFormatToImageFormat(updateData->GetFormat()));
// upload tiles from temp surface
for (unsigned i = 0; i < mImages.Length(); i++) {
@ -535,11 +533,18 @@ TiledTextureImage::EndUpdate()
subregion.MoveBy(-xPos, -yPos); // Tile-local space
// copy tile from temp target
gfx::DrawTarget* drawTarget = mImages[i]->BeginUpdate(subregion);
nsRefPtr<gfxContext> ctx = new gfxContext(drawTarget);
gfxUtils::ClipToRegion(ctx, subregion);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->SetSource(updateSurface, gfxPoint(-xPos, -yPos));
ctx->Paint();
MOZ_ASSERT(drawTarget->GetType() == BackendType::CAIRO,
"updateSnapshot should not have been converted to data");
gfxUtils::ClipToRegion(drawTarget, subregion);
Size size(updateData->GetSize().width,
updateData->GetSize().height);
drawTarget->DrawSurface(updateData,
Rect(Point(-xPos, -yPos), size),
Rect(Point(0, 0), size),
DrawSurfaceOptions(),
DrawOptions(1.0, CompositionOp::OP_SOURCE,
AntialiasMode::NONE));
drawTarget->PopClip();
mImages[i]->EndUpdate();
}

Просмотреть файл

@ -7,7 +7,6 @@
#include "GLContext.h"
#include "GLBlitHelper.h"
#include "ScopedGLHelpers.h"
#include "gfxImageSurface.h"
#include "mozilla/gfx/2D.h"
#include "GLReadTexImageHelper.h"

Просмотреть файл

@ -6,7 +6,6 @@
#ifndef SHARED_SURFACEIO_H_
#define SHARED_SURFACEIO_H_
#include "gfxImageSurface.h"
#include "SharedSurfaceGL.h"
#include "mozilla/RefPtr.h"
@ -54,7 +53,6 @@ private:
SharedSurface_IOSurface(MacIOSurface* surface, GLContext* gl, const gfx::IntSize& size, bool hasAlpha);
RefPtr<MacIOSurface> mSurface;
nsRefPtr<gfxImageSurface> mImageSurface;
GLuint mProdTex;
const GLContext* mCurConsGL;
GLuint mConsTex;