/* * This sub-test verifies that the test step passes when executed * with SkCanvas and with classes derrived from SkCanvas. It also verifies * that the all canvas derivatives report the same state as an SkCanvas * after having executed the test step. */ static void TestOverrideStateConsistency(skiatest::Reporter* reporter, const TestData& d, CanvasTestStep* testStep) { SkBitmap referenceStore; createBitmap(&referenceStore, 0xFFFFFFFF); SkCanvas referenceCanvas(referenceStore); testStep->setAssertMessageFormat(kCanvasDrawAssertMessageFormat); testStep->draw(&referenceCanvas, d, reporter); SkDeferredCanvasTester::TestDeferredCanvasStateConsistency(reporter, d, testStep, referenceCanvas, false); SkDeferredCanvasTester::TestDeferredCanvasStateConsistency(reporter, d, testStep, referenceCanvas, true); // The following test code is disabled because SkNWayCanvas does not // report correct clipping and device bounds information // Issue: http://code.google.com/p/skia/issues/detail?id=501 if (false) { // avoid bit rot, suppress warning TestNWayCanvasStateConsistency(reporter, d, testStep, referenceCanvas); } if (false) { // avoid bit rot, suppress warning test_clipVisitor(reporter, &referenceCanvas); } test_clipstack(reporter); }
/* * This sub-test verifies that the test step passes when executed * with SkCanvas and with classes derrived from SkCanvas. It also verifies * that the all canvas derivatives report the same state as an SkCanvas * after having executed the test step. */ static void TestOverrideStateConsistency(skiatest::Reporter* reporter, const TestData& d, CanvasTestStep* testStep) { SkBitmap referenceStore; createBitmap(&referenceStore, 0xFFFFFFFF); SkCanvas referenceCanvas(referenceStore); testStep->setAssertMessageFormat(kCanvasDrawAssertMessageFormat); testStep->draw(&referenceCanvas, d, reporter); }
void TransparencyWin::setupLayerForOpaqueCompositeLayer() { initializeNewContext(); if (!m_validLayer) return; AffineTransform mapping; mapping.translate(-m_transformedSourceRect.x(), -m_transformedSourceRect.y()); if (m_transformMode == Untransform){ // Compute the inverse mapping from the canvas space to the // coordinate space of our bitmap. mapping *= m_orgTransform.inverse(); } compositeToCopy(*m_destContext, *m_drawContext, mapping); // Save the reference layer so we can tell what changed. SkCanvas referenceCanvas(*m_referenceBitmap); referenceCanvas.drawBitmap(bitmapForContext(*m_drawContext), 0, 0); // Layer rect represents the part of the original layer. }