本文整理汇总了C++中AutoMoz2DMaskData::GetSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoMoz2DMaskData::GetSurface方法的具体用法?C++ AutoMoz2DMaskData::GetSurface怎么用?C++ AutoMoz2DMaskData::GetSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoMoz2DMaskData
的用法示例。
在下文中一共展示了AutoMoz2DMaskData::GetSurface方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
PaintWithMask(gfxContext* aContext, float aOpacity, Layer* aMaskLayer)
{
AutoMoz2DMaskData mask;
if (GetMaskData(aMaskLayer, Point(), &mask)) {
aContext->SetMatrix(ThebesMatrix(mask.GetTransform()));
aContext->Mask(mask.GetSurface(), aOpacity);
return;
}
// if there is no mask, just paint normally
aContext->Paint(aOpacity);
}
示例2: FillRectWithMask
void
FillRectWithMask(DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
const Rect& aRect,
const Color& aColor,
const DrawOptions& aOptions,
Layer* aMaskLayer)
{
AutoMoz2DMaskData mask;
if (GetMaskData(aMaskLayer, aDeviceOffset, &mask)) {
const Matrix& maskTransform = mask.GetTransform();
FillRectWithMask(aDT, aRect, aColor, aOptions, mask.GetSurface(), &maskTransform);
return;
}
FillRectWithMask(aDT, aRect, aColor, aOptions);
}
示例3: FillRectWithMask
void
FillRectWithMask(DrawTarget* aDT,
const gfx::Point& aDeviceOffset,
const Rect& aRect,
SourceSurface* aSurface,
Filter aFilter,
const DrawOptions& aOptions,
Layer* aMaskLayer)
{
AutoMoz2DMaskData mask;
if (GetMaskData(aMaskLayer, aDeviceOffset, &mask)) {
const Matrix& maskTransform = mask.GetTransform();
FillRectWithMask(aDT, aRect, aSurface, aFilter, aOptions, ExtendMode::CLAMP,
mask.GetSurface(), &maskTransform);
return;
}
FillRectWithMask(aDT, aRect, aSurface, aFilter, aOptions, ExtendMode::CLAMP);
}
示例4: setOptimizedOperator
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, 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);
}
}
示例5: GetEffectiveOpacity
void
BasicPaintedLayer::PaintThebes(gfxContext* aContext,
Layer* aMaskLayer,
LayerManager::DrawPaintedLayerCallback aCallback,
void* aCallbackData)
{
AUTO_PROFILER_LABEL("BasicPaintedLayer::PaintThebes", GRAPHICS);
NS_ASSERTION(BasicManager()->InDrawing(),
"Can only draw in drawing phase");
float opacity = GetEffectiveOpacity();
CompositionOp effectiveOperator = GetEffectiveOperator(this);
if (!BasicManager()->IsRetained()) {
ClearValidRegion();
mContentClient->Clear();
nsIntRegion toDraw = IntersectWithClip(GetLocalVisibleRegion().ToUnknownRegion(), aContext);
RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds());
if (!toDraw.IsEmpty() && !IsHidden()) {
if (!aCallback) {
BasicManager()->SetTransactionIncomplete();
return;
}
aContext->Save();
bool needsGroup = opacity != 1.0 ||
effectiveOperator != CompositionOp::OP_OVER ||
aMaskLayer;
RefPtr<gfxContext> context = nullptr;
BasicLayerManager::PushedGroup group;
bool availableGroup = false;
if (needsGroup) {
availableGroup =
BasicManager()->PushGroupForLayer(aContext, this, toDraw, group);
if (availableGroup) {
context = group.mGroupTarget;
}
} else {
context = aContext;
}
if (context) {
SetAntialiasingFlags(this, context->GetDrawTarget());
aCallback(this, context, toDraw, toDraw, DrawRegionClip::NONE,
nsIntRegion(), aCallbackData);
}
if (needsGroup && availableGroup) {
BasicManager()->PopGroupForLayer(group);
}
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);
}
}
示例6: setOptimizedOperator
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");
//.........这里部分代码省略.........