本文整理汇总了C++中Maybe::ClearContextPaint方法的典型用法代码示例。如果您正苦于以下问题:C++ Maybe::ClearContextPaint方法的具体用法?C++ Maybe::ClearContextPaint怎么用?C++ Maybe::ClearContextPaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maybe
的用法示例。
在下文中一共展示了Maybe::ClearContextPaint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: params
VectorImage::Draw(gfxContext* aContext,
const nsIntSize& aSize,
const ImageRegion& aRegion,
uint32_t aWhichFrame,
SamplingFilter aSamplingFilter,
const Maybe<SVGImageContext>& aSVGContext,
uint32_t aFlags,
float aOpacity)
{
if (aWhichFrame > FRAME_MAX_VALUE) {
return DrawResult::BAD_ARGS;
}
if (!aContext) {
return DrawResult::BAD_ARGS;
}
if (mError) {
return DrawResult::BAD_IMAGE;
}
if (!mIsFullyLoaded) {
return DrawResult::NOT_READY;
}
if (mAnimationConsumers == 0) {
SendOnUnlockedDraw(aFlags);
}
MOZ_ASSERT(!(aFlags & FLAG_FORCE_PRESERVEASPECTRATIO_NONE) ||
(aSVGContext && aSVGContext->GetViewportSize()),
"Viewport size is required when using "
"FLAG_FORCE_PRESERVEASPECTRATIO_NONE");
bool overridePAR = (aFlags & FLAG_FORCE_PRESERVEASPECTRATIO_NONE) && aSVGContext;
bool haveContextPaint = aSVGContext && aSVGContext->GetContextPaint();
bool blockContextPaint = false;
if (haveContextPaint) {
nsCOMPtr<nsIURI> imageURI = mURI->ToIURI();
blockContextPaint = !SVGContextPaint::IsAllowedForImageFromURI(imageURI);
}
Maybe<SVGImageContext> newSVGContext;
if (overridePAR || blockContextPaint) {
// The key that we create for the image surface cache must match the way
// that the image will be painted, so we need to initialize a new matching
// SVGImageContext here in order to generate the correct key.
newSVGContext = aSVGContext; // copy
if (overridePAR) {
// The SVGImageContext must take account of the preserveAspectRatio
// overide:
MOZ_ASSERT(!aSVGContext->GetPreserveAspectRatio(),
"FLAG_FORCE_PRESERVEASPECTRATIO_NONE is not expected if a "
"preserveAspectRatio override is supplied");
Maybe<SVGPreserveAspectRatio> aspectRatio =
Some(SVGPreserveAspectRatio(SVG_PRESERVEASPECTRATIO_NONE,
SVG_MEETORSLICE_UNKNOWN));
newSVGContext->SetPreserveAspectRatio(aspectRatio);
}
if (blockContextPaint) {
// The SVGImageContext must not include context paint if the image is
// not allowed to use it:
newSVGContext->ClearContextPaint();
}
}
float animTime = (aWhichFrame == FRAME_FIRST)
? 0.0f : mSVGDocumentWrapper->GetCurrentTime();
SVGDrawingParameters params(aContext, aSize, aRegion, aSamplingFilter,
newSVGContext ? newSVGContext : aSVGContext,
animTime, aFlags, aOpacity);
// If we have an prerasterized version of this image that matches the
// drawing parameters, use that.
RefPtr<gfxDrawable> svgDrawable = LookupCachedSurface(params);
if (svgDrawable) {
Show(svgDrawable, params);
return DrawResult::SUCCESS;
}
// else, we need to paint the image:
if (mIsDrawing) {
NS_WARNING("Refusing to make re-entrant call to VectorImage::Draw");
return DrawResult::TEMPORARY_ERROR;
}
AutoRestore<bool> autoRestoreIsDrawing(mIsDrawing);
mIsDrawing = true;
// Apply any 'preserveAspectRatio' override (if specified) to the root
// element:
AutoPreserveAspectRatioOverride autoPAR(newSVGContext ? newSVGContext : aSVGContext,
mSVGDocumentWrapper->GetRootSVGElem());
// Set the animation time:
//.........这里部分代码省略.........