本文整理汇总了C++中AutoMoz2DMaskData类的典型用法代码示例。如果您正苦于以下问题:C++ AutoMoz2DMaskData类的具体用法?C++ AutoMoz2DMaskData怎么用?C++ AutoMoz2DMaskData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AutoMoz2DMaskData类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PROFILER_LABEL
void
BasicPaintedLayer::PaintThebes(gfxContext* aContext,
Layer* aMaskLayer,
LayerManager::DrawPaintedLayerCallback aCallback,
void* aCallbackData)
{
PROFILER_LABEL("BasicPaintedLayer", "PaintThebes",
js::ProfileEntry::Category::GRAPHICS);
NS_ASSERTION(BasicManager()->InDrawing(),
"Can only draw in drawing phase");
float opacity = GetEffectiveOpacity();
CompositionOp effectiveOperator = GetEffectiveOperator(this);
if (!BasicManager()->IsRetained()) {
mValidRegion.SetEmpty();
mContentClient->Clear();
nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext);
RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds());
if (!toDraw.IsEmpty() && !IsHidden()) {
if (!aCallback) {
BasicManager()->SetTransactionIncomplete();
return;
}
aContext->Save();
bool needsClipToVisibleRegion = GetClipToVisibleRegion();
bool needsGroup = opacity != 1.0 ||
effectiveOperator != CompositionOp::OP_OVER ||
aMaskLayer;
nsRefPtr<gfxContext> groupContext;
if (needsGroup) {
groupContext =
BasicManager()->PushGroupForLayer(aContext, this, toDraw,
&needsClipToVisibleRegion);
if (effectiveOperator != CompositionOp::OP_OVER) {
needsClipToVisibleRegion = true;
}
} else {
groupContext = aContext;
}
SetAntialiasingFlags(this, groupContext->GetDrawTarget());
aCallback(this, groupContext, toDraw, toDraw,
DrawRegionClip::NONE, nsIntRegion(), aCallbackData);
if (needsGroup) {
aContext->PopGroupToSource();
if (needsClipToVisibleRegion) {
gfxUtils::ClipToRegion(aContext, toDraw);
}
AutoSetOperator setOptimizedOperator(aContext, ThebesOp(effectiveOperator));
PaintWithMask(aContext, opacity, aMaskLayer);
}
aContext->Restore();
}
RenderTraceInvalidateEnd(this, "FFFF00");
return;
}
if (BasicManager()->IsTransactionIncomplete())
return;
gfxRect clipExtents;
clipExtents = aContext->GetClipExtents();
// Pull out the mask surface and transform here, because the mask
// is internal to basic layers
AutoMoz2DMaskData mask;
SourceSurface* maskSurface = nullptr;
Matrix maskTransform;
if (GetMaskData(aMaskLayer, aContext->GetDeviceOffset(), &mask)) {
maskSurface = mask.GetSurface();
maskTransform = mask.GetTransform();
}
if (!IsHidden() && !clipExtents.IsEmpty()) {
mContentClient->DrawTo(this, aContext->GetDrawTarget(), opacity,
effectiveOperator,
maskSurface, &maskTransform);
}
}
示例2: PROFILER_LABEL
void
BasicThebesLayer::PaintThebes(gfxContext* aContext,
Layer* aMaskLayer,
LayerManager::DrawThebesLayerCallback aCallback,
void* aCallbackData,
ReadbackProcessor* aReadback)
{
PROFILER_LABEL("BasicThebesLayer", "PaintThebes");
NS_ASSERTION(BasicManager()->InDrawing(),
"Can only draw in drawing phase");
nsTArray<ReadbackProcessor::Update> readbackUpdates;
if (aReadback && UsedForReadback()) {
aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
}
float opacity = GetEffectiveOpacity();
CompositionOp effectiveOperator = GetEffectiveOperator(this);
if (!BasicManager()->IsRetained()) {
NS_ASSERTION(readbackUpdates.IsEmpty(), "Can't do readback for non-retained layer");
mValidRegion.SetEmpty();
mContentClient->Clear();
nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext);
RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds());
if (!toDraw.IsEmpty() && !IsHidden()) {
if (!aCallback) {
BasicManager()->SetTransactionIncomplete();
return;
}
aContext->Save();
bool needsClipToVisibleRegion = GetClipToVisibleRegion();
bool needsGroup = opacity != 1.0 ||
effectiveOperator != CompositionOp::OP_OVER ||
aMaskLayer;
nsRefPtr<gfxContext> groupContext;
if (needsGroup) {
groupContext =
BasicManager()->PushGroupForLayer(aContext, this, toDraw,
&needsClipToVisibleRegion);
if (effectiveOperator != CompositionOp::OP_OVER) {
needsClipToVisibleRegion = true;
}
} else {
groupContext = aContext;
}
SetAntialiasingFlags(this, groupContext);
aCallback(this, groupContext, toDraw, DrawRegionClip::CLIP_NONE, nsIntRegion(), aCallbackData);
if (needsGroup) {
BasicManager()->PopGroupToSourceWithCachedSurface(aContext, groupContext);
if (needsClipToVisibleRegion) {
gfxUtils::ClipToRegion(aContext, toDraw);
}
AutoSetOperator setOptimizedOperator(aContext, ThebesOp(effectiveOperator));
PaintWithMask(aContext, opacity, aMaskLayer);
}
aContext->Restore();
}
RenderTraceInvalidateEnd(this, "FFFF00");
return;
}
if (BasicManager()->IsTransactionIncomplete())
return;
gfxRect clipExtents;
clipExtents = aContext->GetClipExtents();
// Pull out the mask surface and transform here, because the mask
// is internal to basic layers
AutoMoz2DMaskData mask;
SourceSurface* maskSurface = nullptr;
Matrix maskTransform;
if (GetMaskData(aMaskLayer, &mask)) {
maskSurface = mask.GetSurface();
maskTransform = mask.GetTransform();
}
if (!IsHidden() && !clipExtents.IsEmpty()) {
mContentClient->DrawTo(this, aContext->GetDrawTarget(), opacity,
GetOperator(),
maskSurface, &maskTransform);
}
for (uint32_t i = 0; i < readbackUpdates.Length(); ++i) {
ReadbackProcessor::Update& update = readbackUpdates[i];
nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset();
nsRefPtr<gfxContext> ctx =
update.mLayer->GetSink()->BeginUpdate(update.mUpdateRect + offset,
update.mSequenceCounter);
if (ctx) {
NS_ASSERTION(opacity == 1.0, "Should only read back opaque layers");
//.........这里部分代码省略.........