Bug 389498 - <mask> not rendered correctly when scrolling. r=longsonr, sr+a=roc

This commit is contained in:
tor@cs.brown.edu 2007-09-17 08:20:35 -07:00
Родитель 4f5ec8077b
Коммит 5c14246b41
3 изменённых файлов: 31 добавлений и 1 удалений

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

@ -168,6 +168,7 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
return nsnull;
nsRefPtr<gfxASurface> surface = pattern->GetSurface();
surface->SetDeviceOffset(gfxPoint(0,0));
gfxRect clipExtents = gfx->GetClipExtents();
@ -197,7 +198,7 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
gfxContext transferCtx(image);
transferCtx.SetOperator(gfxContext::OPERATOR_SOURCE);
transferCtx.SetSource(surface, -clipExtents.pos);
transferCtx.SetSource(surface);
transferCtx.Paint();
PRUint8 *data = image->Data();

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

@ -1456,6 +1456,29 @@ nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame)
return PR_FALSE;
}
#ifdef DEBUG
void
nsSVGUtils::WritePPM(const char *fname, gfxImageSurface *aSurface)
{
FILE *f = fopen(fname, "wb");
if (!f)
return;
gfxIntSize size = aSurface->GetSize();
fprintf(f, "P6\n%d %d\n255\n", size.width, size.height);
unsigned char *data = aSurface->Data();
PRInt32 stride = aSurface->Stride();
for (int y=0; y<size.height; y++) {
for (int x=0; x<size.width; x++) {
fwrite(data + y * stride + 4 * x + GFX_ARGB32_OFFSET_R, 1, 1, f);
fwrite(data + y * stride + 4 * x + GFX_ARGB32_OFFSET_G, 1, 1, f);
fwrite(data + y * stride + 4 * x + GFX_ARGB32_OFFSET_B, 1, 1, f);
}
}
fclose(f);
}
#endif
// ----------------------------------------------------------------------
nsSVGRenderState::nsSVGRenderState(nsIRenderingContext *aContext) :

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

@ -69,6 +69,7 @@ class nsAttrValue;
class gfxContext;
class gfxASurface;
class nsIRenderingContext;
class gfxImageSurface;
struct gfxRect;
struct gfxMatrix;
struct gfxSize;
@ -383,6 +384,11 @@ public:
static PRBool
CanOptimizeOpacity(nsIFrame *aFrame);
#ifdef DEBUG
static void
WritePPM(const char *fname, gfxImageSurface *aSurface);
#endif
private:
/* Computational (nil) surfaces */
static gfxASurface *mThebesComputationalSurface;