本文整理汇总了C++中nsIntRegion类的典型用法代码示例。如果您正苦于以下问题:C++ nsIntRegion类的具体用法?C++ nsIntRegion怎么用?C++ nsIntRegion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nsIntRegion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetDrawTargetForDescriptor
TemporaryRef<DrawTarget>
ContentClientIncremental::GetUpdateSurface(BufferType aType,
const nsIntRegion& aUpdateRegion)
{
nsIntRect rgnSize = aUpdateRegion.GetBounds();
if (!mBufferRect.Contains(rgnSize)) {
NS_ERROR("update outside of image");
return nullptr;
}
SurfaceDescriptor desc;
if (!mForwarder->AllocSurfaceDescriptor(rgnSize.Size().ToIntSize(),
mContentType,
&desc)) {
NS_WARNING("creating SurfaceDescriptor failed!");
Clear();
return nullptr;
}
if (aType == BUFFER_BLACK) {
MOZ_ASSERT(!IsSurfaceDescriptorValid(mUpdateDescriptor));
mUpdateDescriptor = desc;
} else {
MOZ_ASSERT(!IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite));
MOZ_ASSERT(aType == BUFFER_WHITE);
mUpdateDescriptorOnWhite = desc;
}
return GetDrawTargetForDescriptor(desc, gfx::BackendType::COREGRAPHICS);
}
开发者ID:plancalculus,项目名称:xulrunner,代码行数:29,代码来源:ContentClient.cpp
示例2:
already_AddRefed<gfxASurface>
ContentClientIncremental::GetUpdateSurface(BufferType aType,
nsIntRegion& aUpdateRegion)
{
nsIntRect rgnSize = aUpdateRegion.GetBounds();
if (!mBufferRect.Contains(rgnSize)) {
NS_ERROR("update outside of image");
return nullptr;
}
SurfaceDescriptor desc;
if (!mForwarder->AllocSurfaceDescriptor(gfxIntSize(rgnSize.width, rgnSize.height),
mContentType,
&desc)) {
NS_WARNING("creating SurfaceDescriptor failed!");
return nullptr;
}
nsRefPtr<gfxASurface> tmpASurface =
ShadowLayerForwarder::OpenDescriptor(OPEN_READ_WRITE, desc);
if (aType == BUFFER_BLACK) {
MOZ_ASSERT(!IsSurfaceDescriptorValid(mUpdateDescriptor));
mUpdateDescriptor = desc;
} else {
MOZ_ASSERT(!IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite));
MOZ_ASSERT(aType == BUFFER_WHITE);
mUpdateDescriptorOnWhite = desc;
}
return tmpASurface.forget();
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:31,代码来源:ContentClient.cpp
示例3: nsIntPoint
bool
TextureImageEGL::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom /* = nsIntPoint(0, 0) */)
{
nsIntRect bounds = aRegion.GetBounds();
nsIntRegion region;
if (mTextureState != Valid) {
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
}
mTextureFormat =
UploadSurfaceToTexture(mGLContext,
aSurf,
region,
mTexture,
mTextureState == Created,
bounds.TopLeft() + aFrom,
false);
mTextureState = Valid;
return true;
}
开发者ID:ConradIrwin,项目名称:gecko-dev,代码行数:25,代码来源:TextureImageEGL.cpp
示例4: fprintf
/* static */ void
nsBaseWidget::debug_DumpPaintEvent(FILE * aFileOut,
nsIWidget * aWidget,
const nsIntRegion & aRegion,
const nsAutoCString & aWidgetName,
int32_t aWindowID)
{
NS_ASSERTION(nullptr != aFileOut,"cmon, null output FILE");
NS_ASSERTION(nullptr != aWidget,"cmon, the widget is null");
if (!debug_GetCachedBoolPref("nglayout.debug.paint_dumping"))
return;
nsIntRect rect = aRegion.GetBounds();
fprintf(aFileOut,
"%4d PAINT widget=%p name=%-12s id=0x%-6x bounds-rect=%3d,%-3d %3d,%-3d",
_GetPrintCount(),
(void *) aWidget,
aWidgetName.get(),
aWindowID,
rect.x, rect.y, rect.width, rect.height
);
fprintf(aFileOut,"\n");
}
开发者ID:alessandrod,项目名称:mozilla-central,代码行数:25,代码来源:nsBaseWidget.cpp
示例5: Refresh
/**
aRegion is given in device coordinates!!
aContext may be null, in which case layers should be used for
rendering.
*/
void nsViewManager::Refresh(nsView *aView, const nsIntRegion& aRegion,
bool aWillSendDidPaint)
{
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
// damageRegion is the damaged area, in twips, relative to the view origin
nsRegion damageRegion = aRegion.ToAppUnits(AppUnitsPerDevPixel());
// move region from widget coordinates into view coordinates
damageRegion.MoveBy(-aView->ViewToWidgetOffset());
if (damageRegion.IsEmpty()) {
#ifdef DEBUG_roc
nsRect viewRect = aView->GetDimensions();
nsRect damageRect = damageRegion.GetBounds();
printf("XXX Damage rectangle (%d,%d,%d,%d) does not intersect the widget's view (%d,%d,%d,%d)!\n",
damageRect.x, damageRect.y, damageRect.width, damageRect.height,
viewRect.x, viewRect.y, viewRect.width, viewRect.height);
#endif
return;
}
nsIWidget *widget = aView->GetWidget();
if (!widget) {
return;
}
NS_ASSERTION(!IsPainting(), "recursive painting not permitted");
if (IsPainting()) {
RootViewManager()->mRecursiveRefreshPending = true;
return;
}
{
nsAutoScriptBlocker scriptBlocker;
SetPainting(true);
NS_ASSERTION(GetDisplayRootFor(aView) == aView,
"Widgets that we paint must all be display roots");
if (mPresShell) {
#ifdef DEBUG_INVALIDATIONS
printf("--COMPOSITE-- %p\n", mPresShell);
#endif
mPresShell->Paint(aView, damageRegion,
nsIPresShell::PAINT_COMPOSITE |
(aWillSendDidPaint ? nsIPresShell::PAINT_WILL_SEND_DID_PAINT : 0));
#ifdef DEBUG_INVALIDATIONS
printf("--ENDCOMPOSITE--\n");
#endif
mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
}
SetPainting(false);
}
if (RootViewManager()->mRecursiveRefreshPending) {
RootViewManager()->mRecursiveRefreshPending = false;
InvalidateAllViews();
}
}
开发者ID:jraff,项目名称:mozilla-central,代码行数:65,代码来源:nsViewManager.cpp
示例6: RenderViewMLGPU
RenderViewMLGPU::RenderViewMLGPU(FrameBuilder* aBuilder,
MLGRenderTarget* aTarget,
const nsIntRegion& aInvalidRegion)
: RenderViewMLGPU(aBuilder, nullptr) {
mTarget = aTarget;
mInvalidBounds = aInvalidRegion.GetBounds();
// The clear region on the layer manager is the area that must be clear after
// we finish drawing.
mPostClearRegion = aBuilder->GetManager()->GetRegionToClear();
// Clamp the post-clear region to the invalid bounds, since clears don't go
// through the scissor rect if using ClearView.
mPostClearRegion.AndWith(mInvalidBounds);
// Since the post-clear will occlude everything, we include it in the final
// opaque area.
mOccludedRegion.OrWith(ViewAs<LayerPixel>(
mPostClearRegion,
PixelCastJustification::RenderTargetIsParentLayerForRoot));
AL_LOG("RenderView %p root with invalid area %s, clear area %s\n", this,
Stringify(mInvalidBounds).c_str(),
Stringify(mPostClearRegion).c_str());
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:25,代码来源:RenderViewMLGPU.cpp
示例7: GetContextForQuadrantUpdate
void
ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
const nsIntRegion& aUpdateRegion)
{
nsRefPtr<gfxContext> destCtx =
GetContextForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK);
destCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
bool isClippingCheap = IsClippingCheap(destCtx, aUpdateRegion);
if (isClippingCheap) {
gfxUtils::ClipToRegion(destCtx, aUpdateRegion);
}
if (SupportsAzureContent()) {
MOZ_ASSERT(!destCtx->IsCairo());
if (destCtx->GetDrawTarget()->GetFormat() == FORMAT_B8G8R8A8) {
destCtx->GetDrawTarget()->ClearRect(Rect(0, 0, mFrontBufferRect.width, mFrontBufferRect.height));
}
aSource.DrawBufferWithRotation(destCtx->GetDrawTarget(), BUFFER_BLACK);
} else {
aSource.DrawBufferWithRotation(destCtx, BUFFER_BLACK);
}
if (aSource.HaveBufferOnWhite()) {
MOZ_ASSERT(HaveBufferOnWhite());
nsRefPtr<gfxContext> destCtx =
GetContextForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_WHITE);
destCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
bool isClippingCheap = IsClippingCheap(destCtx, aUpdateRegion);
if (isClippingCheap) {
gfxUtils::ClipToRegion(destCtx, aUpdateRegion);
}
if (SupportsAzureContent()) {
MOZ_ASSERT(!destCtx->IsCairo());
if (destCtx->GetDrawTarget()->GetFormat() == FORMAT_B8G8R8A8) {
destCtx->GetDrawTarget()->ClearRect(Rect(0, 0, mFrontBufferRect.width, mFrontBufferRect.height));
}
aSource.DrawBufferWithRotation(destCtx->GetDrawTarget(), BUFFER_WHITE);
} else {
aSource.DrawBufferWithRotation(destCtx, BUFFER_WHITE);
}
}
}
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:47,代码来源:ContentClient.cpp
示例8: FindBackgroundLayer
static Layer*
FindBackgroundLayer(ReadbackLayer* aLayer, nsIntPoint* aOffset)
{
gfx::Matrix transform;
if (!aLayer->GetTransform().Is2D(&transform) ||
transform.HasNonIntegerTranslation())
return nullptr;
nsIntPoint transformOffset(int32_t(transform._31), int32_t(transform._32));
for (Layer* l = aLayer->GetPrevSibling(); l; l = l->GetPrevSibling()) {
gfx::Matrix backgroundTransform;
if (!l->GetTransform().Is2D(&backgroundTransform) ||
gfx::ThebesMatrix(backgroundTransform).HasNonIntegerTranslation())
return nullptr;
nsIntPoint backgroundOffset(int32_t(backgroundTransform._31), int32_t(backgroundTransform._32));
IntRect rectInBackground(transformOffset - backgroundOffset, aLayer->GetSize());
const nsIntRegion visibleRegion = l->GetEffectiveVisibleRegion().ToUnknownRegion();
if (!visibleRegion.Intersects(rectInBackground))
continue;
// Since l is present in the background, from here on we either choose l
// or nothing.
if (!visibleRegion.Contains(rectInBackground))
return nullptr;
if (l->GetEffectiveOpacity() != 1.0 ||
l->HasMaskLayers() ||
!(l->GetContentFlags() & Layer::CONTENT_OPAQUE))
{
return nullptr;
}
// cliprects are post-transform
const Maybe<ParentLayerIntRect>& clipRect = l->GetEffectiveClipRect();
if (clipRect && !clipRect->Contains(ViewAs<ParentLayerPixel>(IntRect(transformOffset, aLayer->GetSize()))))
return nullptr;
Layer::LayerType type = l->GetType();
if (type != Layer::TYPE_COLOR && type != Layer::TYPE_PAINTED)
return nullptr;
*aOffset = backgroundOffset - transformOffset;
return l;
}
return nullptr;
}
开发者ID:bolt-dev,项目名称:gecko-dev,代码行数:47,代码来源:ReadbackProcessor.cpp
示例9: IsClippingCheap
static bool
IsClippingCheap(gfxContext* aTarget, const nsIntRegion& aRegion)
{
// Assume clipping is cheap if the context just has an integer
// translation, and the visible region is simple.
return !aTarget->CurrentMatrix().HasNonIntegerTranslation() &&
aRegion.GetNumRects() <= 1;
}
开发者ID:mozilla,项目名称:pjs,代码行数:8,代码来源:BasicBuffers.cpp
示例10: ComputeProgressiveUpdateRegion
bool
ClientTiledLayerBuffer::ProgressiveUpdate(nsIntRegion& aValidRegion,
nsIntRegion& aInvalidRegion,
const nsIntRegion& aOldValidRegion,
BasicTiledLayerPaintData* aPaintData,
LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData)
{
bool repeat = false;
bool isBufferChanged = false;
do {
// Compute the region that should be updated. Repeat as many times as
// is required.
nsIntRegion regionToPaint;
repeat = ComputeProgressiveUpdateRegion(aInvalidRegion,
aOldValidRegion,
regionToPaint,
aPaintData,
repeat);
// There's no further work to be done.
if (regionToPaint.IsEmpty()) {
break;
}
isBufferChanged = true;
// Keep track of what we're about to refresh.
aValidRegion.Or(aValidRegion, regionToPaint);
// aValidRegion may have been altered by InvalidateRegion, but we still
// want to display stale content until it gets progressively updated.
// Create a region that includes stale content.
nsIntRegion validOrStale;
validOrStale.Or(aValidRegion, aOldValidRegion);
// Paint the computed region and subtract it from the invalid region.
PaintThebes(validOrStale, regionToPaint, aCallback, aCallbackData);
aInvalidRegion.Sub(aInvalidRegion, regionToPaint);
} while (repeat);
// Return false if nothing has been drawn, or give what has been drawn
// to the shadow layer to upload.
return isBufferChanged;
}
开发者ID:hitdream2002,项目名称:gecko-dev,代码行数:45,代码来源:TiledContentClient.cpp
示例11: destRegion
bool
ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,
const nsIntRegion& aOldValidRegionBack,
nsIntRegion* aUpdatedRegionBack)
{
aUpdatedRegionBack->SetEmpty();
if (!mTextureHost) {
mInitialised = false;
return true; // FIXME should we return false? Returning true for now
} // to preserve existing behavior of NOT causing IPC errors.
// updated is in screen coordinates. Convert it to buffer coordinates.
nsIntRegion destRegion(aUpdated);
destRegion.MoveBy(-aData.rect().TopLeft());
if (!aData.rect().Contains(aUpdated.GetBounds()) ||
aData.rotation().x > aData.rect().width ||
aData.rotation().y > aData.rect().height) {
NS_ERROR("Invalid update data");
return false;
}
// destRegion is now in logical coordinates relative to the buffer, but we
// need to account for rotation. We do that by moving the region to the
// rotation offset and then wrapping any pixels that extend off the
// bottom/right edges.
// Shift to the rotation point
destRegion.MoveBy(aData.rotation());
nsIntSize bufferSize = aData.rect().Size();
// Select only the pixels that are still within the buffer.
nsIntRegion finalRegion;
finalRegion.And(nsIntRect(nsIntPoint(), bufferSize), destRegion);
// For each of the overlap areas (right, bottom-right, bottom), select those
// pixels and wrap them around to the opposite edge of the buffer rect.
AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(aData.rect().width, 0));
AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(aData.rect().width, aData.rect().height));
AddWrappedRegion(destRegion, finalRegion, bufferSize, nsIntPoint(0, aData.rect().height));
MOZ_ASSERT(nsIntRect(0, 0, aData.rect().width, aData.rect().height).Contains(finalRegion.GetBounds()));
mTextureHost->Updated(&finalRegion);
if (mTextureHostOnWhite) {
mTextureHostOnWhite->Updated(&finalRegion);
}
mInitialised = true;
mBufferRect = aData.rect();
mBufferRotation = aData.rotation();
return true;
}
开发者ID:marshall,项目名称:gecko-dev,代码行数:57,代码来源:ContentHost.cpp
示例12: AddWrappedRegion
static inline void
AddWrappedRegion(const nsIntRegion& aInput, nsIntRegion& aOutput,
const nsIntSize& aSize, const nsIntPoint& aShift)
{
nsIntRegion tempRegion;
tempRegion.And(nsIntRect(aShift, aSize), aInput);
tempRegion.MoveBy(-aShift);
aOutput.Or(aOutput, tempRegion);
}
开发者ID:marshall,项目名称:gecko-dev,代码行数:9,代码来源:ContentHost.cpp
示例13: nsIntRect
void
LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const IntRect& aBounds)
{
bool drawFps = gfxPrefs::LayersDrawFPS();
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
bool drawPaintTimes = gfxPrefs::AlwaysPaint();
if (drawFps || drawFrameCounter) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 256, 256));
}
if (drawFrameColorBars) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.height));
}
if (drawPaintTimes) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(PaintCounter::GetPaintRect()));
}
}
开发者ID:ollie314,项目名称:gecko-dev,代码行数:18,代码来源:LayerManagerComposite.cpp
示例14: nsIntRect
nsIntRegion
nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(nsIFrame* aFrame,
const nsPoint& aToReferenceFrame,
const nsIntRegion& aInvalidRegion)
{
if (aInvalidRegion.IsEmpty()) {
return nsIntRect();
}
// Don't bother calling GetEffectProperties; the filter property should
// already have been set up during reflow/ComputeFrameEffectsRect
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aFrame);
nsSVGFilterProperty *prop = nsSVGEffects::GetFilterProperty(firstFrame);
if (!prop || !prop->IsInObserverLists()) {
return aInvalidRegion;
}
int32_t appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
if (!prop || !prop->ReferencesValidResources()) {
// The frame is either not there or not currently available,
// perhaps because we're in the middle of tearing stuff down.
// Be conservative, return our visual overflow rect relative
// to the reference frame.
nsRect overflow = aFrame->GetVisualOverflowRect() + aToReferenceFrame;
return overflow.ToOutsidePixels(appUnitsPerDevPixel);
}
// Convert aInvalidRegion into bounding box frame space in app units:
nsPoint toBoundingBox =
aFrame->GetOffsetTo(firstFrame) + GetOffsetToBoundingBox(firstFrame);
// The initial rect was relative to the reference frame, so we need to
// remove that offset to get a rect relative to the current frame.
toBoundingBox -= aToReferenceFrame;
nsRegion preEffectsRegion = aInvalidRegion.ToAppUnits(appUnitsPerDevPixel).MovedBy(toBoundingBox);
// Adjust the dirty area for effects, and shift it back to being relative to
// the reference frame.
nsRegion result = nsFilterInstance::GetPostFilterDirtyArea(firstFrame,
preEffectsRegion).MovedBy(-toBoundingBox);
// Return the result, in pixels relative to the reference frame.
return result.ToOutsidePixels(appUnitsPerDevPixel);
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:44,代码来源:nsSVGIntegrationUtils.cpp
示例15: FilterSpaceToFrameSpace
nsRegion
nsFilterInstance::FilterSpaceToFrameSpace(const nsIntRegion& aRegion) const
{
nsRegion result;
for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) {
// FilterSpaceToFrameSpace rounds out, so this works.
result.Or(result, FilterSpaceToFrameSpace(iter.Get()));
}
return result;
}
开发者ID:carriercomm,项目名称:gecko-dev,代码行数:10,代码来源:nsFilterInstance.cpp
示例16: GetContextForQuadrantUpdate
void
ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
const nsIntRegion& aUpdateRegion)
{
nsRefPtr<gfxContext> destCtx =
GetContextForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK);
if (!destCtx) {
return;
}
destCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
bool isClippingCheap = IsClippingCheap(destCtx, aUpdateRegion);
if (isClippingCheap) {
gfxUtils::ClipToRegion(destCtx, aUpdateRegion);
}
if (SupportsAzureContent()) {
MOZ_ASSERT(!destCtx->IsCairo());
aSource.DrawBufferWithRotation(destCtx->GetDrawTarget(), BUFFER_BLACK, 1.0, OP_SOURCE);
} else {
aSource.DrawBufferWithRotation(destCtx, BUFFER_BLACK);
}
if (aSource.HaveBufferOnWhite()) {
MOZ_ASSERT(HaveBufferOnWhite());
nsRefPtr<gfxContext> destCtx =
GetContextForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_WHITE);
destCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
bool isClippingCheap = IsClippingCheap(destCtx, aUpdateRegion);
if (isClippingCheap) {
gfxUtils::ClipToRegion(destCtx, aUpdateRegion);
}
if (SupportsAzureContent()) {
MOZ_ASSERT(!destCtx->IsCairo());
aSource.DrawBufferWithRotation(destCtx->GetDrawTarget(), BUFFER_WHITE, 1.0, OP_SOURCE);
} else {
aSource.DrawBufferWithRotation(destCtx, BUFFER_WHITE);
}
}
}
开发者ID:YusukeYamamoto,项目名称:mozilla-central,代码行数:42,代码来源:ContentClient.cpp
示例17: SubtractTransformedRegion
static void
SubtractTransformedRegion(nsIntRegion& aRegion,
const nsIntRegion& aRegionToSubtract,
const Matrix4x4& aTransform)
{
if (aRegionToSubtract.IsEmpty()) {
return;
}
// For each rect in the region, find out its bounds in screen space and
// subtract it from the screen region.
nsIntRegionRectIterator it(aRegionToSubtract);
while (const IntRect* rect = it.Next()) {
Rect incompleteRect = aTransform.TransformBounds(ToRect(*rect));
aRegion.Sub(aRegion, IntRect(incompleteRect.x,
incompleteRect.y,
incompleteRect.width,
incompleteRect.height));
}
}
开发者ID:rtrsparq,项目名称:gecko-dev,代码行数:20,代码来源:LayerManagerComposite.cpp
示例18: UseProgressiveDraw
bool
ClientTiledPaintedLayer::RenderHighPrecision(const nsIntRegion& aInvalidRegion,
const nsIntRegion& aVisibleRegion,
LayerManager::DrawPaintedLayerCallback aCallback,
void* aCallbackData)
{
// If we have started drawing low-precision already, then we
// shouldn't do anything there.
if (mPaintData.mLowPrecisionPaintCount != 0) {
return false;
}
// Only draw progressively when there is something to paint and the
// resolution is unchanged
if (!aInvalidRegion.IsEmpty() &&
UseProgressiveDraw() &&
mContentClient->GetTiledBuffer()->GetFrameResolution() == mPaintData.mResolution) {
// Store the old valid region, then clear it before painting.
// We clip the old valid region to the visible region, as it only gets
// used to decide stale content (currently valid and previously visible)
nsIntRegion oldValidRegion = mContentClient->GetTiledBuffer()->GetValidRegion();
oldValidRegion.And(oldValidRegion, aVisibleRegion);
if (mPaintData.mCriticalDisplayPort) {
oldValidRegion.And(oldValidRegion, mPaintData.mCriticalDisplayPort->ToUnknownRect());
}
TILING_LOG("TILING %p: Progressive update with old valid region %s\n", this, Stringify(oldValidRegion).c_str());
nsIntRegion drawnRegion;
bool updatedBuffer =
mContentClient->GetTiledBuffer()->ProgressiveUpdate(GetValidRegion(), aInvalidRegion,
oldValidRegion, drawnRegion, &mPaintData, aCallback, aCallbackData);
AddToValidRegion(drawnRegion);
return updatedBuffer;
}
// Otherwise do a non-progressive paint. We must do this even when
// the region to paint is empty as the valid region may have shrunk.
nsIntRegion validRegion = aVisibleRegion;
if (mPaintData.mCriticalDisplayPort) {
validRegion.AndWith(mPaintData.mCriticalDisplayPort->ToUnknownRect());
}
SetValidRegion(validRegion);
TILING_LOG("TILING %p: Non-progressive paint invalid region %s\n", this, Stringify(aInvalidRegion).c_str());
TILING_LOG("TILING %p: Non-progressive paint new valid region %s\n", this, Stringify(GetValidRegion()).c_str());
mContentClient->GetTiledBuffer()->SetFrameResolution(mPaintData.mResolution);
mContentClient->GetTiledBuffer()->PaintThebes(GetValidRegion(), aInvalidRegion, aInvalidRegion,
aCallback, aCallbackData);
mPaintData.mPaintFinished = true;
return true;
}
开发者ID:yrliou,项目名称:gecko-dev,代码行数:54,代码来源:ClientTiledPaintedLayer.cpp
示例19: UploadSurfaceToTexture
SurfaceFormat
UploadSurfaceToTexture(GLContext* gl,
gfxASurface *aSurface,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
bool aOverwrite,
const nsIntPoint& aSrcPoint,
bool aPixelBuffer,
GLenum aTextureUnit,
GLenum aTextureTarget)
{
nsRefPtr<gfxImageSurface> imageSurface = aSurface->GetAsImageSurface();
unsigned char* data = nullptr;
if (!imageSurface ||
(imageSurface->Format() != gfxImageFormatARGB32 &&
imageSurface->Format() != gfxImageFormatRGB24 &&
imageSurface->Format() != gfxImageFormatRGB16_565 &&
imageSurface->Format() != gfxImageFormatA8)) {
// We can't get suitable pixel data for the surface, make a copy
nsIntRect bounds = aDstRegion.GetBounds();
imageSurface =
new gfxImageSurface(gfxIntSize(bounds.width, bounds.height),
gfxImageFormatARGB32);
nsRefPtr<gfxContext> context = new gfxContext(imageSurface);
context->Translate(-gfxPoint(aSrcPoint.x, aSrcPoint.y));
context->SetSource(aSurface);
context->Paint();
data = imageSurface->Data();
NS_ASSERTION(!aPixelBuffer,
"Must be using an image compatible surface with pixel buffers!");
} else {
// If a pixel buffer is bound the data pointer parameter is relative
// to the start of the data block.
if (!aPixelBuffer) {
data = imageSurface->Data();
}
data += DataOffset(aSrcPoint, imageSurface->Stride(),
imageSurface->Format());
}
MOZ_ASSERT(imageSurface);
imageSurface->Flush();
return UploadImageDataToTexture(gl,
data,
imageSurface->Stride(),
imageSurface->Format(),
aDstRegion, aTexture, aOverwrite,
aPixelBuffer, aTextureUnit, aTextureTarget);
}
开发者ID:JaminLiu,项目名称:gecko-dev,代码行数:54,代码来源:GLUploadHelpers.cpp
示例20: while
void
ContentClientDoubleBuffered::UpdateDestinationFrom(const RotatedBuffer& aSource,
const nsIntRegion& aUpdateRegion)
{
DrawIterator iter;
while (DrawTarget* destDT =
BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_BLACK, &iter)) {
bool isClippingCheap = IsClippingCheap(destDT, iter.mDrawRegion);
if (isClippingCheap) {
gfxUtils::ClipToRegion(destDT, iter.mDrawRegion);
}
aSource.DrawBufferWithRotation(destDT, BUFFER_BLACK, 1.0, CompositionOp::OP_SOURCE);
if (isClippingCheap) {
destDT->PopClip();
}
// Flush the destination before the sources become inaccessible (Unlock).
destDT->Flush();
ReturnDrawTargetToBuffer(destDT);
}
if (aSource.HaveBufferOnWhite()) {
MOZ_ASSERT(HaveBufferOnWhite());
DrawIterator whiteIter;
while (DrawTarget* destDT =
BorrowDrawTargetForQuadrantUpdate(aUpdateRegion.GetBounds(), BUFFER_WHITE, &whiteIter)) {
bool isClippingCheap = IsClippingCheap(destDT, whiteIter.mDrawRegion);
if (isClippingCheap) {
gfxUtils::ClipToRegion(destDT, whiteIter.mDrawRegion);
}
aSource.DrawBufferWithRotation(destDT, BUFFER_WHITE, 1.0, CompositionOp::OP_SOURCE);
if (isClippingCheap) {
destDT->PopClip();
}
// Flush the destination before the sources become inaccessible (Unlock).
destDT->Flush();
ReturnDrawTargetToBuffer(destDT);
}
}
}
开发者ID:miketaylr,项目名称:gecko-dev,代码行数:41,代码来源:ContentClient.cpp
注:本文中的nsIntRegion类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论