2010-07-21 11:06:33 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* 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/. */
|
2010-03-03 13:37:04 -08:00
|
|
|
|
2012-09-12 03:41:34 -07:00
|
|
|
#include "base/basictypes.h"
|
|
|
|
|
2010-03-03 13:37:04 -08:00
|
|
|
#include "ThebesLayerBuffer.h"
|
|
|
|
#include "Layers.h"
|
|
|
|
#include "gfxContext.h"
|
|
|
|
#include "gfxPlatform.h"
|
2010-09-02 19:31:42 -07:00
|
|
|
#include "gfxUtils.h"
|
2012-09-12 03:41:34 -07:00
|
|
|
#include "ipc/AutoOpenSurface.h"
|
2011-04-16 18:22:42 -07:00
|
|
|
#include "nsDeviceContext.h"
|
2012-04-16 11:36:33 -07:00
|
|
|
#include "sampler.h"
|
2010-03-03 13:37:04 -08:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
nsIntRect
|
|
|
|
ThebesLayerBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide)
|
|
|
|
{
|
|
|
|
// quadrantTranslation is the amount we translate the top-left
|
|
|
|
// of the quadrant by to get coordinates relative to the layer
|
|
|
|
nsIntPoint quadrantTranslation = -mBufferRotation;
|
|
|
|
quadrantTranslation.x += aXSide == LEFT ? mBufferRect.width : 0;
|
|
|
|
quadrantTranslation.y += aYSide == TOP ? mBufferRect.height : 0;
|
|
|
|
return mBufferRect + quadrantTranslation;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aXSide LEFT means we draw from the left side of the buffer (which
|
|
|
|
* is drawn on the right side of mBufferRect). RIGHT means we draw from
|
|
|
|
* the right side of the buffer (which is drawn on the left side of
|
|
|
|
* mBufferRect).
|
|
|
|
* @param aYSide TOP means we draw from the top side of the buffer (which
|
|
|
|
* is drawn on the bottom side of mBufferRect). BOTTOM means we draw from
|
|
|
|
* the bottom side of the buffer (which is drawn on the top side of
|
|
|
|
* mBufferRect).
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ThebesLayerBuffer::DrawBufferQuadrant(gfxContext* aTarget,
|
2010-09-03 13:10:46 -07:00
|
|
|
XSide aXSide, YSide aYSide,
|
2012-02-07 14:27:21 -08:00
|
|
|
float aOpacity,
|
|
|
|
gfxASurface* aMask,
|
|
|
|
const gfxMatrix* aMaskTransform)
|
2010-03-03 13:37:04 -08:00
|
|
|
{
|
|
|
|
// The rectangle that we're going to fill. Basically we're going to
|
|
|
|
// render the buffer at mBufferRect + quadrantTranslation to get the
|
|
|
|
// pixels in the right place, but we're only going to paint within
|
|
|
|
// mBufferRect
|
|
|
|
nsIntRect quadrantRect = GetQuadrantRectangle(aXSide, aYSide);
|
|
|
|
nsIntRect fillRect;
|
|
|
|
if (!fillRect.IntersectRect(mBufferRect, quadrantRect))
|
|
|
|
return;
|
|
|
|
|
|
|
|
aTarget->NewPath();
|
2010-09-03 13:10:46 -07:00
|
|
|
aTarget->Rectangle(gfxRect(fillRect.x, fillRect.y,
|
|
|
|
fillRect.width, fillRect.height),
|
2011-10-17 07:59:28 -07:00
|
|
|
true);
|
2010-09-03 13:10:46 -07:00
|
|
|
|
|
|
|
gfxPoint quadrantTranslation(quadrantRect.x, quadrantRect.y);
|
2012-10-03 19:13:14 -07:00
|
|
|
nsRefPtr<gfxPattern> pattern = new gfxPattern(EnsureBuffer());
|
2010-09-03 13:10:46 -07:00
|
|
|
|
2010-09-09 12:33:04 -07:00
|
|
|
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
|
|
|
gfxPattern::GraphicsFilter filter = gfxPattern::FILTER_NEAREST;
|
|
|
|
pattern->SetFilter(filter);
|
|
|
|
#endif
|
|
|
|
|
2010-09-23 16:06:27 -07:00
|
|
|
gfxContextMatrixAutoSaveRestore saveMatrix(aTarget);
|
|
|
|
|
2010-09-03 13:10:46 -07:00
|
|
|
// Transform from user -> buffer space.
|
|
|
|
gfxMatrix transform;
|
|
|
|
transform.Translate(-quadrantTranslation);
|
|
|
|
|
|
|
|
pattern->SetMatrix(transform);
|
|
|
|
aTarget->SetPattern(pattern);
|
|
|
|
|
2012-02-07 14:27:21 -08:00
|
|
|
if (aMask) {
|
|
|
|
if (aOpacity == 1.0) {
|
|
|
|
aTarget->SetMatrix(*aMaskTransform);
|
|
|
|
aTarget->Mask(aMask);
|
|
|
|
} else {
|
|
|
|
aTarget->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
|
|
|
|
aTarget->Paint(aOpacity);
|
|
|
|
aTarget->PopGroupToSource();
|
|
|
|
aTarget->SetMatrix(*aMaskTransform);
|
|
|
|
aTarget->Mask(aMask);
|
|
|
|
}
|
2010-07-15 14:08:04 -07:00
|
|
|
} else {
|
2012-02-07 14:27:21 -08:00
|
|
|
if (aOpacity == 1.0) {
|
|
|
|
aTarget->Fill();
|
|
|
|
} else {
|
|
|
|
aTarget->Save();
|
|
|
|
aTarget->Clip();
|
|
|
|
aTarget->Paint(aOpacity);
|
|
|
|
aTarget->Restore();
|
|
|
|
}
|
2010-07-15 14:08:04 -07:00
|
|
|
}
|
2010-03-03 13:37:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-02-07 14:27:21 -08:00
|
|
|
ThebesLayerBuffer::DrawBufferWithRotation(gfxContext* aTarget, float aOpacity,
|
|
|
|
gfxASurface* aMask,
|
|
|
|
const gfxMatrix* aMaskTransform)
|
2010-03-03 13:37:04 -08:00
|
|
|
{
|
2012-04-16 11:36:33 -07:00
|
|
|
SAMPLE_LABEL("ThebesLayerBuffer", "DrawBufferWithRotation");
|
2010-03-03 13:37:04 -08:00
|
|
|
// Draw four quadrants. We could use REPEAT_, but it's probably better
|
|
|
|
// not to, to be performance-safe.
|
2012-02-07 14:27:21 -08:00
|
|
|
DrawBufferQuadrant(aTarget, LEFT, TOP, aOpacity, aMask, aMaskTransform);
|
|
|
|
DrawBufferQuadrant(aTarget, RIGHT, TOP, aOpacity, aMask, aMaskTransform);
|
|
|
|
DrawBufferQuadrant(aTarget, LEFT, BOTTOM, aOpacity, aMask, aMaskTransform);
|
|
|
|
DrawBufferQuadrant(aTarget, RIGHT, BOTTOM, aOpacity, aMask, aMaskTransform);
|
2010-03-03 13:37:04 -08:00
|
|
|
}
|
|
|
|
|
2010-11-05 00:17:07 -07:00
|
|
|
already_AddRefed<gfxContext>
|
2011-06-22 05:11:28 -07:00
|
|
|
ThebesLayerBuffer::GetContextForQuadrantUpdate(const nsIntRect& aBounds)
|
2010-11-05 00:17:07 -07:00
|
|
|
{
|
2012-10-03 19:13:14 -07:00
|
|
|
nsRefPtr<gfxContext> ctx = new gfxContext(EnsureBuffer());
|
2010-11-05 00:17:07 -07:00
|
|
|
|
|
|
|
// Figure out which quadrant to draw in
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t xBoundary = mBufferRect.XMost() - mBufferRotation.x;
|
|
|
|
int32_t yBoundary = mBufferRect.YMost() - mBufferRotation.y;
|
2010-11-05 00:17:07 -07:00
|
|
|
XSide sideX = aBounds.XMost() <= xBoundary ? RIGHT : LEFT;
|
|
|
|
YSide sideY = aBounds.YMost() <= yBoundary ? BOTTOM : TOP;
|
|
|
|
nsIntRect quadrantRect = GetQuadrantRectangle(sideX, sideY);
|
|
|
|
NS_ASSERTION(quadrantRect.Contains(aBounds), "Messed up quadrants");
|
|
|
|
ctx->Translate(-gfxPoint(quadrantRect.x, quadrantRect.y));
|
|
|
|
|
|
|
|
return ctx.forget();
|
|
|
|
}
|
|
|
|
|
2012-09-12 03:41:34 -07:00
|
|
|
gfxASurface::gfxContentType
|
|
|
|
ThebesLayerBuffer::BufferContentType()
|
|
|
|
{
|
2012-10-03 19:13:14 -07:00
|
|
|
return mBuffer ? mBuffer->GetContentType() : mBufferProvider->ContentType();
|
2012-09-12 03:41:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ThebesLayerBuffer::BufferSizeOkFor(const nsIntSize& aSize)
|
|
|
|
{
|
|
|
|
return (aSize == mBufferRect.Size() ||
|
|
|
|
(SizedToVisibleBounds != mBufferSizePolicy &&
|
|
|
|
aSize < mBufferRect.Size()));
|
|
|
|
}
|
|
|
|
|
2012-10-03 19:13:14 -07:00
|
|
|
gfxASurface*
|
2012-09-12 03:41:34 -07:00
|
|
|
ThebesLayerBuffer::EnsureBuffer()
|
|
|
|
{
|
2012-10-03 19:13:14 -07:00
|
|
|
if (!mBuffer && mBufferProvider) {
|
2012-09-12 03:41:34 -07:00
|
|
|
mBuffer = mBufferProvider->Get();
|
|
|
|
}
|
2012-10-03 19:13:14 -07:00
|
|
|
return mBuffer;
|
2012-09-12 03:41:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ThebesLayerBuffer::HaveBuffer()
|
|
|
|
{
|
2012-10-03 19:13:14 -07:00
|
|
|
return mBuffer || mBufferProvider;
|
2012-09-12 03:41:34 -07:00
|
|
|
}
|
|
|
|
|
2010-03-03 13:37:04 -08:00
|
|
|
static void
|
2012-08-22 08:56:38 -07:00
|
|
|
WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
|
2010-03-03 13:37:04 -08:00
|
|
|
{
|
|
|
|
if (*aRotationPoint < 0) {
|
|
|
|
*aRotationPoint += aSize;
|
|
|
|
} else if (*aRotationPoint >= aSize) {
|
|
|
|
*aRotationPoint -= aSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-20 12:49:03 -07:00
|
|
|
static nsIntRect
|
|
|
|
ComputeBufferRect(const nsIntRect& aRequestedRect)
|
|
|
|
{
|
|
|
|
nsIntRect rect(aRequestedRect);
|
|
|
|
// Set a minimum width to guarantee a minimum size of buffers we
|
|
|
|
// allocate (and work around problems on some platforms with smaller
|
|
|
|
// dimensions). 64 is the magic number needed to work around the
|
|
|
|
// rendering glitch, and guarantees image rows can be SIMD'd for
|
|
|
|
// even r5g6b5 surfaces pretty much everywhere.
|
|
|
|
rect.width = NS_MAX(aRequestedRect.width, 64);
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
2010-03-03 13:37:04 -08:00
|
|
|
ThebesLayerBuffer::PaintState
|
2010-09-03 13:10:46 -07:00
|
|
|
ThebesLayerBuffer::BeginPaint(ThebesLayer* aLayer, ContentType aContentType,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aFlags)
|
2010-03-03 13:37:04 -08:00
|
|
|
{
|
|
|
|
PaintState result;
|
2011-06-22 05:11:28 -07:00
|
|
|
// We need to disable rotation if we're going to be resampled when
|
2011-03-31 14:33:46 -07:00
|
|
|
// drawing, because we might sample across the rotation boundary.
|
2012-03-18 17:01:47 -07:00
|
|
|
bool canHaveRotation = !(aFlags & (PAINT_WILL_RESAMPLE | PAINT_NO_ROTATION));
|
2011-03-01 12:30:16 -08:00
|
|
|
|
|
|
|
nsIntRegion validRegion = aLayer->GetValidRegion();
|
|
|
|
|
|
|
|
ContentType contentType;
|
|
|
|
nsIntRegion neededRegion;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool canReuseBuffer;
|
2011-03-01 12:30:16 -08:00
|
|
|
nsIntRect destBufferRect;
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
while (true) {
|
2011-03-01 12:30:16 -08:00
|
|
|
contentType = aContentType;
|
|
|
|
neededRegion = aLayer->GetVisibleRegion();
|
2012-09-12 03:41:34 -07:00
|
|
|
canReuseBuffer = HaveBuffer() && BufferSizeOkFor(neededRegion.GetBounds().Size());
|
2011-03-01 12:30:16 -08:00
|
|
|
|
|
|
|
if (canReuseBuffer) {
|
|
|
|
if (mBufferRect.Contains(neededRegion.GetBounds())) {
|
|
|
|
// We don't need to adjust mBufferRect.
|
|
|
|
destBufferRect = mBufferRect;
|
2011-03-09 09:27:37 -08:00
|
|
|
} else if (neededRegion.GetBounds().Size() <= mBufferRect.Size()) {
|
2011-03-01 12:30:16 -08:00
|
|
|
// The buffer's big enough but doesn't contain everything that's
|
|
|
|
// going to be visible. We'll move it.
|
|
|
|
destBufferRect = nsIntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size());
|
2011-03-09 09:27:37 -08:00
|
|
|
} else {
|
|
|
|
destBufferRect = neededRegion.GetBounds();
|
2011-03-01 12:30:16 -08:00
|
|
|
}
|
|
|
|
} else {
|
2012-09-20 12:49:03 -07:00
|
|
|
// We won't be reusing the buffer. Compute a new rect.
|
|
|
|
destBufferRect = ComputeBufferRect(neededRegion.GetBounds());
|
2011-03-01 12:30:16 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((aFlags & PAINT_WILL_RESAMPLE) &&
|
2011-04-18 20:07:23 -07:00
|
|
|
(!neededRegion.GetBounds().IsEqualInterior(destBufferRect) ||
|
2011-03-01 12:30:16 -08:00
|
|
|
neededRegion.GetNumRects() > 1)) {
|
|
|
|
// The area we add to neededRegion might not be painted opaquely
|
|
|
|
contentType = gfxASurface::CONTENT_COLOR_ALPHA;
|
|
|
|
|
|
|
|
// We need to validate the entire buffer, to make sure that only valid
|
|
|
|
// pixels are sampled
|
|
|
|
neededRegion = destBufferRect;
|
|
|
|
}
|
|
|
|
|
2012-09-12 03:41:34 -07:00
|
|
|
if (HaveBuffer() && contentType != BufferContentType()) {
|
2011-03-01 12:30:16 -08:00
|
|
|
// We're effectively clearing the valid region, so we need to draw
|
|
|
|
// the entire needed region now.
|
|
|
|
result.mRegionToInvalidate = aLayer->GetValidRegion();
|
|
|
|
validRegion.SetEmpty();
|
|
|
|
Clear();
|
|
|
|
// Restart decision process with the cleared buffer. We can only go
|
|
|
|
// around the loop one more iteration, since mBuffer is null now.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2010-03-03 13:37:04 -08:00
|
|
|
}
|
|
|
|
|
2011-03-09 09:27:37 -08:00
|
|
|
NS_ASSERTION(destBufferRect.Contains(neededRegion.GetBounds()),
|
|
|
|
"Destination rect doesn't contain what we need to paint");
|
|
|
|
|
2011-03-01 12:30:16 -08:00
|
|
|
result.mRegionToDraw.Sub(neededRegion, validRegion);
|
2010-03-03 13:37:04 -08:00
|
|
|
if (result.mRegionToDraw.IsEmpty())
|
|
|
|
return result;
|
|
|
|
|
2011-03-01 12:30:16 -08:00
|
|
|
nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
|
2010-03-03 13:37:04 -08:00
|
|
|
nsRefPtr<gfxASurface> destBuffer;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t bufferFlags = canHaveRotation ? ALLOW_REPEAT : 0;
|
2011-03-01 12:30:16 -08:00
|
|
|
if (canReuseBuffer) {
|
2010-03-03 13:37:04 -08:00
|
|
|
nsIntRect keepArea;
|
|
|
|
if (keepArea.IntersectRect(destBufferRect, mBufferRect)) {
|
|
|
|
// Set mBufferRotation so that the pixels currently in mBuffer
|
|
|
|
// will still be rendered in the right place when mBufferRect
|
|
|
|
// changes to destBufferRect.
|
|
|
|
nsIntPoint newRotation = mBufferRotation +
|
|
|
|
(destBufferRect.TopLeft() - mBufferRect.TopLeft());
|
|
|
|
WrapRotationAxis(&newRotation.x, mBufferRect.width);
|
|
|
|
WrapRotationAxis(&newRotation.y, mBufferRect.height);
|
|
|
|
NS_ASSERTION(nsIntRect(nsIntPoint(0,0), mBufferRect.Size()).Contains(newRotation),
|
|
|
|
"newRotation out of bounds");
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t xBoundary = destBufferRect.XMost() - newRotation.x;
|
|
|
|
int32_t yBoundary = destBufferRect.YMost() - newRotation.y;
|
2010-03-03 13:37:04 -08:00
|
|
|
if ((drawBounds.x < xBoundary && xBoundary < drawBounds.XMost()) ||
|
2011-03-01 12:30:16 -08:00
|
|
|
(drawBounds.y < yBoundary && yBoundary < drawBounds.YMost()) ||
|
|
|
|
(newRotation != nsIntPoint(0,0) && !canHaveRotation)) {
|
2010-03-03 13:37:04 -08:00
|
|
|
// The stuff we need to redraw will wrap around an edge of the
|
2011-03-09 09:27:37 -08:00
|
|
|
// buffer, so move the pixels we can keep into a position that
|
|
|
|
// lets us redraw in just one quadrant.
|
|
|
|
if (mBufferRotation == nsIntPoint(0,0)) {
|
2012-10-03 19:13:14 -07:00
|
|
|
nsIntRect srcRect(nsIntPoint(0, 0), mBufferRect.Size());
|
2011-03-09 09:27:37 -08:00
|
|
|
nsIntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft();
|
2012-10-03 19:13:14 -07:00
|
|
|
EnsureBuffer()->MovePixels(srcRect, dest);
|
2011-10-17 07:59:28 -07:00
|
|
|
result.mDidSelfCopy = true;
|
2011-03-09 09:27:37 -08:00
|
|
|
// Don't set destBuffer; we special-case self-copies, and
|
|
|
|
// just did the necessary work above.
|
|
|
|
mBufferRect = destBufferRect;
|
2010-03-03 13:37:04 -08:00
|
|
|
} else {
|
|
|
|
// We can't do a real self-copy because the buffer is rotated.
|
|
|
|
// So allocate a new buffer for the destination.
|
2012-09-20 12:49:03 -07:00
|
|
|
destBufferRect = ComputeBufferRect(neededRegion.GetBounds());
|
2012-10-03 19:13:14 -07:00
|
|
|
destBuffer = CreateBuffer(contentType, destBufferRect.Size(), bufferFlags);
|
|
|
|
if (!destBuffer)
|
2010-03-03 13:37:04 -08:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mBufferRect = destBufferRect;
|
|
|
|
mBufferRotation = newRotation;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// No pixels are going to be kept. The whole visible region
|
|
|
|
// will be redrawn, so we don't need to copy anything, so we don't
|
|
|
|
// set destBuffer.
|
|
|
|
mBufferRect = destBufferRect;
|
|
|
|
mBufferRotation = nsIntPoint(0,0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// The buffer's not big enough, so allocate a new one
|
2012-10-03 19:13:14 -07:00
|
|
|
destBuffer = CreateBuffer(contentType, destBufferRect.Size(), bufferFlags);
|
|
|
|
if (!destBuffer)
|
2010-03-03 13:37:04 -08:00
|
|
|
return result;
|
|
|
|
}
|
2011-03-01 12:30:16 -08:00
|
|
|
NS_ASSERTION(!(aFlags & PAINT_WILL_RESAMPLE) || destBufferRect == neededRegion.GetBounds(),
|
|
|
|
"If we're resampling, we need to validate the entire buffer");
|
2010-03-03 13:37:04 -08:00
|
|
|
|
2010-07-15 14:08:09 -07:00
|
|
|
// If we have no buffered data already, then destBuffer will be a fresh buffer
|
|
|
|
// and we do not need to clear it below.
|
2012-10-17 22:44:26 -07:00
|
|
|
bool isClear = !HaveBuffer();
|
2010-07-15 14:08:09 -07:00
|
|
|
|
2012-10-03 19:13:14 -07:00
|
|
|
if (destBuffer) {
|
2012-09-12 03:41:34 -07:00
|
|
|
if (HaveBuffer()) {
|
2010-03-03 13:37:04 -08:00
|
|
|
// Copy the bits
|
2012-10-03 19:13:14 -07:00
|
|
|
nsRefPtr<gfxContext> tmpCtx = new gfxContext(destBuffer);
|
2010-03-03 13:37:04 -08:00
|
|
|
nsIntPoint offset = -destBufferRect.TopLeft();
|
|
|
|
tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
|
|
|
tmpCtx->Translate(gfxPoint(offset.x, offset.y));
|
2011-06-22 05:11:28 -07:00
|
|
|
DrawBufferWithRotation(tmpCtx, 1.0);
|
2010-03-03 13:37:04 -08:00
|
|
|
}
|
|
|
|
|
2012-10-03 19:13:14 -07:00
|
|
|
mBuffer = destBuffer.forget();
|
2010-03-03 13:37:04 -08:00
|
|
|
mBufferRect = destBufferRect;
|
|
|
|
mBufferRotation = nsIntPoint(0,0);
|
|
|
|
}
|
2011-03-01 12:30:16 -08:00
|
|
|
NS_ASSERTION(canHaveRotation || mBufferRotation == nsIntPoint(0,0),
|
|
|
|
"Rotation disabled, but we have nonzero rotation?");
|
2010-03-03 13:37:04 -08:00
|
|
|
|
|
|
|
nsIntRegion invalidate;
|
|
|
|
invalidate.Sub(aLayer->GetValidRegion(), destBufferRect);
|
|
|
|
result.mRegionToInvalidate.Or(result.mRegionToInvalidate, invalidate);
|
|
|
|
|
2011-06-22 05:11:28 -07:00
|
|
|
result.mContext = GetContextForQuadrantUpdate(drawBounds);
|
2010-03-03 13:37:04 -08:00
|
|
|
|
2011-01-07 08:11:18 -08:00
|
|
|
gfxUtils::ClipToRegionSnapped(result.mContext, result.mRegionToDraw);
|
2011-03-01 12:30:16 -08:00
|
|
|
if (contentType == gfxASurface::CONTENT_COLOR_ALPHA && !isClear) {
|
2010-03-03 13:37:04 -08:00
|
|
|
result.mContext->SetOperator(gfxContext::OPERATOR_CLEAR);
|
|
|
|
result.mContext->Paint();
|
|
|
|
result.mContext->SetOperator(gfxContext::OPERATOR_OVER);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|