本文整理汇总了C++中nsIntRegion::ToAppUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ nsIntRegion::ToAppUnits方法的具体用法?C++ nsIntRegion::ToAppUnits怎么用?C++ nsIntRegion::ToAppUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsIntRegion
的用法示例。
在下文中一共展示了nsIntRegion::ToAppUnits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: 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);
}
示例3: 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)
{
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
if (mPresShell && mPresShell->IsNeverPainting()) {
return;
}
// 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 MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
printf("--COMPOSITE-- %p\n", mPresShell);
}
#endif
uint32_t paintFlags = nsIPresShell::PAINT_COMPOSITE;
LayerManager *manager = widget->GetLayerManager();
if (!manager->NeedsWidgetInvalidation()) {
manager->FlushRendering();
} else {
mPresShell->Paint(aView, damageRegion,
paintFlags);
}
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
printf("--ENDCOMPOSITE--\n");
}
#endif
mozilla::StartupTimeline::RecordOnce(mozilla::StartupTimeline::FIRST_PAINT);
}
SetPainting(false);
}
if (RootViewManager()->mRecursiveRefreshPending) {
RootViewManager()->mRecursiveRefreshPending = false;
InvalidateAllViews();
}
}