本文整理汇总了C++中nsIntRegion::GetBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ nsIntRegion::GetBounds方法的具体用法?C++ nsIntRegion::GetBounds怎么用?C++ nsIntRegion::GetBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsIntRegion
的用法示例。
在下文中一共展示了nsIntRegion::GetBounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
nsIntRegion
ContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
const nsIntRegion& aVisibleRegion,
bool aDidSelfCopy)
{
nsIntRegion updatedRegion;
if (mIsNewBuffer || aDidSelfCopy) {
// A buffer reallocation clears both buffers. The front buffer has all the
// content by now, but the back buffer is still clear. Here, in effect, we
// are saying to copy all of the pixels of the front buffer to the back.
// Also when we self-copied in the buffer, the buffer space
// changes and some changed buffer content isn't reflected in the
// draw or invalidate region (on purpose!). When this happens, we
// need to read back the entire buffer too.
updatedRegion = aVisibleRegion.GetBounds();
mIsNewBuffer = false;
} else {
updatedRegion = aRegionToDraw;
}
NS_ASSERTION(BufferRect().Contains(aRegionToDraw.GetBounds()),
"Update outside of buffer rect!");
MOZ_ASSERT(mTextureClient, "should have a back buffer by now");
return updatedRegion;
}
示例2: Update
void
SimpleTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
const nsIntRegion& aPaintRegion,
LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData)
{
mCallback = aCallback;
mCallbackData = aCallbackData;
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
long start = PR_IntervalNow();
#endif
// If this region is empty XMost() - 1 will give us a negative value.
NS_ASSERTION(!aPaintRegion.GetBounds().IsEmpty(), "Empty paint region\n");
PROFILER_LABEL("SimpleTiledLayerBuffer", "PaintThebesUpdate");
Update(aNewValidRegion, aPaintRegion);
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
if (PR_IntervalNow() - start > 10) {
const nsIntRect bounds = aPaintRegion.GetBounds();
printf_stderr("Time to tile [%i, %i, %i, %i] -> %i\n", bounds.x, bounds.y, bounds.width, bounds.height, PR_IntervalNow() - start);
}
#endif
mLastPaintOpaque = mThebesLayer->CanUseOpaqueSurface();
mCallback = nullptr;
mCallbackData = nullptr;
}
示例3:
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();
}
示例4: 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);
}
示例5: 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;
}
示例6: screenIter
void
Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
const nsIntRegion& aVisibleRegion,
const gfx::Rect& aClipRect,
const gfx::Matrix4x4& aTransform,
uint32_t aFlashCounter)
{
if (!ShouldDrawDiagnostics(aFlags)) {
return;
}
if (aVisibleRegion.GetNumRects() > 1) {
nsIntRegionRectIterator screenIter(aVisibleRegion);
while (const gfx::IntRect* rect = screenIter.Next())
{
DrawDiagnostics(aFlags | DiagnosticFlags::REGION_RECT,
IntRectToRect(*rect), aClipRect, aTransform,
aFlashCounter);
}
}
DrawDiagnostics(aFlags, IntRectToRect(aVisibleRegion.GetBounds()),
aClipRect, aTransform, aFlashCounter);
}
示例7: 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");
}
示例8: 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());
}
示例9: 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);
}
}
}
示例10: 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;
}
示例11: 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);
}
}
}
示例12: gfxImageSurface
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);
}
示例13: 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);
}
}
}
示例14: Update
void
TiledLayerBufferComposite::Upload(const BasicTiledLayerBuffer* aMainMemoryTiledBuffer,
const nsIntRegion& aNewValidRegion,
const nsIntRegion& aInvalidateRegion,
const gfxSize& aResolution)
{
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
printf_stderr("Upload %i, %i, %i, %i\n", aInvalidateRegion.GetBounds().x, aInvalidateRegion.GetBounds().y, aInvalidateRegion.GetBounds().width, aInvalidateRegion.GetBounds().height);
long start = PR_IntervalNow();
#endif
mFrameResolution = aResolution;
mMainMemoryTiledBuffer = aMainMemoryTiledBuffer;
Update(aNewValidRegion, aInvalidateRegion);
mMainMemoryTiledBuffer = nullptr;
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
if (PR_IntervalNow() - start > 10) {
printf_stderr("Time to upload %i\n", PR_IntervalNow() - start);
}
#endif
}
示例15: nsIntRect
void
TextureImageEGL::GetUpdateRegion(nsIntRegion& aForRegion)
{
if (mTextureState != Valid) {
// if the texture hasn't been initialized yet, force the
// client to paint everything
aForRegion = nsIntRect(nsIntPoint(0, 0), gfx::ThebesIntSize(mSize));
}
// We can only draw a rectangle, not subregions due to
// the way that our texture upload functions work. If
// needed, we /could/ do multiple texture uploads if we have
// non-overlapping rects, but that's a tradeoff.
aForRegion = nsIntRegion(aForRegion.GetBounds());
}