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()); }