本文整理汇总了C++中GrRenderTarget::numColorSamples方法的典型用法代码示例。如果您正苦于以下问题:C++ GrRenderTarget::numColorSamples方法的具体用法?C++ GrRenderTarget::numColorSamples怎么用?C++ GrRenderTarget::numColorSamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrRenderTarget
的用法示例。
在下文中一共展示了GrRenderTarget::numColorSamples方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onNewSurface
SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
GrRenderTarget* rt = fDevice->accessRenderTarget();
int sampleCount = rt->numColorSamples();
// TODO: Make caller specify this (change virtual signature of onNewSurface).
static const Budgeted kBudgeted = kNo_Budgeted;
return SkSurface::NewRenderTarget(fDevice->context(), kBudgeted, info, sampleCount,
&this->props());
}
示例2: check_rendertarget
static void check_rendertarget(skiatest::Reporter* reporter,
const GrCaps& caps,
GrResourceProvider* provider,
GrRenderTargetProxy* rtProxy,
int numSamples,
SkBackingFit fit,
int expectedMaxWindowRects) {
REPORTER_ASSERT(reporter, rtProxy->maxWindowRectangles(caps) == expectedMaxWindowRects);
REPORTER_ASSERT(reporter, rtProxy->numStencilSamples() == numSamples);
GrSurfaceProxy::UniqueID idBefore = rtProxy->uniqueID();
bool preinstantiated = rtProxy->isInstantiated();
REPORTER_ASSERT(reporter, rtProxy->instantiate(provider));
GrRenderTarget* rt = rtProxy->peekRenderTarget();
REPORTER_ASSERT(reporter, rtProxy->uniqueID() == idBefore);
// Deferred resources should always have a different ID from their instantiated rendertarget
if (preinstantiated) {
REPORTER_ASSERT(reporter, rtProxy->uniqueID().asUInt() == rt->uniqueID().asUInt());
} else {
REPORTER_ASSERT(reporter, rtProxy->uniqueID().asUInt() != rt->uniqueID().asUInt());
}
if (SkBackingFit::kExact == fit) {
REPORTER_ASSERT(reporter, rt->width() == rtProxy->width());
REPORTER_ASSERT(reporter, rt->height() == rtProxy->height());
} else {
REPORTER_ASSERT(reporter, rt->width() >= rtProxy->width());
REPORTER_ASSERT(reporter, rt->height() >= rtProxy->height());
}
REPORTER_ASSERT(reporter, rt->config() == rtProxy->config());
REPORTER_ASSERT(reporter, rt->fsaaType() == rtProxy->fsaaType());
REPORTER_ASSERT(reporter, rt->numColorSamples() == rtProxy->numColorSamples());
REPORTER_ASSERT(reporter, rt->numStencilSamples() == rtProxy->numStencilSamples());
REPORTER_ASSERT(reporter, rt->surfacePriv().flags() == rtProxy->testingOnly_getFlags());
}
示例3: draw
void SkMultiPictureDraw::draw(bool flush) {
AutoMPDReset mpdreset(this);
#ifdef FORCE_SINGLE_THREAD_DRAWING_FOR_TESTING
for (int i = 0; i < fThreadSafeDrawData.count(); ++i) {
fThreadSafeDrawData[i].draw();
}
#else
sk_parallel_for(fThreadSafeDrawData.count(), [&](int i) {
fThreadSafeDrawData[i].draw();
});
#endif
// N.B. we could get going on any GPU work from this main thread while the CPU work runs.
// But in practice, we've either got GPU work or CPU work, not both.
const int count = fGPUDrawData.count();
if (0 == count) {
return;
}
#if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU
GrContext* context = fGPUDrawData[0].fCanvas->getGrContext();
SkASSERT(context);
// Start by collecting all the layers that are going to be atlased and render
// them (if necessary). Hoisting the free floating layers is deferred until
// drawing the canvas that requires them.
SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled;
for (int i = 0; i < count; ++i) {
const DrawData& data = fGPUDrawData[i];
// we only expect 1 context for all the canvases
SkASSERT(data.fCanvas->getGrContext() == context);
if (!data.fPaint) {
SkRect clipBounds;
if (!data.fCanvas->getClipBounds(&clipBounds)) {
continue;
}
SkMatrix initialMatrix = data.fCanvas->getTotalMatrix();
initialMatrix.preConcat(data.fMatrix);
GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRenderTarget();
SkASSERT(rt);
// TODO: sorting the cacheable layers from smallest to largest
// would improve the packing and reduce the number of swaps
// TODO: another optimization would be to make a first pass to
// lock any required layer that is already in the atlas
GrLayerHoister::FindLayersToAtlas(context, data.fPicture, initialMatrix,
clipBounds,
&atlasedNeedRendering, &atlasedRecycled,
rt->numColorSamples());
}
}
GrLayerHoister::DrawLayersToAtlas(context, atlasedNeedRendering);
SkTDArray<GrHoistedLayer> needRendering, recycled;
#endif
for (int i = 0; i < count; ++i) {
const DrawData& data = fGPUDrawData[i];
SkCanvas* canvas = data.fCanvas;
const SkPicture* picture = data.fPicture;
#if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU
if (!data.fPaint) {
SkRect clipBounds;
if (!canvas->getClipBounds(&clipBounds)) {
continue;
}
SkAutoCanvasMatrixPaint acmp(canvas, &data.fMatrix, data.fPaint, picture->cullRect());
const SkMatrix initialMatrix = canvas->getTotalMatrix();
GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRenderTarget();
SkASSERT(rt);
// Find the layers required by this canvas. It will return atlased
// layers in the 'recycled' list since they have already been drawn.
GrLayerHoister::FindLayersToHoist(context, picture, initialMatrix,
clipBounds, &needRendering, &recycled,
rt->numColorSamples());
GrLayerHoister::DrawLayers(context, needRendering);
// Render the entire picture using new layers
GrRecordReplaceDraw(picture, canvas, context->getLayerCache(),
initialMatrix, NULL);
GrLayerHoister::UnlockLayers(context, needRendering);
GrLayerHoister::UnlockLayers(context, recycled);
needRendering.rewind();
recycled.rewind();
//.........这里部分代码省略.........