Lines Matching refs:canvas

203 static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) {  in test_clipVisitor()  argument
204 SkISize size = canvas->getDeviceSize(); in test_clipVisitor()
211 canvas->replayClips(&visitor); in test_clipVisitor()
213 REPORTER_ASSERT(reporter, equal_clips(c, *canvas)); in test_clipVisitor()
221 SkCanvas canvas(10, 10); in test_clipstack() local
222 cs = SkRef(canvas.getClipStack()); in test_clipstack()
288 virtual void draw(SkCanvas* canvas, const TestData& d, \
290 FUNCTION (canvas, d, reporter, this); \
300 virtual void draw(SkCanvas* canvas, const TestData& d, \
302 FUNCTION (canvas, d, reporter, this); \
309 static void NAME##TestStep(SkCanvas* canvas, const TestData& d, \
311 canvas-> CALL ; \
316 static void NAME##TestStep(SkCanvas* canvas, const TestData& d, \
318 REPORTER_ASSERT_MESSAGE(reporter, canvas-> CALL , \
342 static void SaveMatrixClipStep(SkCanvas* canvas, const TestData& d, in SaveMatrixClipStep() argument
344 int saveCount = canvas->getSaveCount(); in SaveMatrixClipStep()
345 canvas->save(); in SaveMatrixClipStep()
346 canvas->translate(SkIntToScalar(1), SkIntToScalar(2)); in SaveMatrixClipStep()
347 canvas->clipRegion(d.fRegion); in SaveMatrixClipStep()
348 canvas->restore(); in SaveMatrixClipStep()
349 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, in SaveMatrixClipStep()
351 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(), in SaveMatrixClipStep()
357 static void SaveLayerStep(SkCanvas* canvas, const TestData& d, in SaveLayerStep() argument
359 int saveCount = canvas->getSaveCount(); in SaveLayerStep()
360 canvas->saveLayer(nullptr, nullptr); in SaveLayerStep()
361 canvas->restore(); in SaveLayerStep()
362 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, in SaveLayerStep()
367 static void BoundedSaveLayerStep(SkCanvas* canvas, const TestData& d, in BoundedSaveLayerStep() argument
369 int saveCount = canvas->getSaveCount(); in BoundedSaveLayerStep()
370 canvas->saveLayer(&d.fRect, nullptr); in BoundedSaveLayerStep()
371 canvas->restore(); in BoundedSaveLayerStep()
372 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, in BoundedSaveLayerStep()
377 static void PaintSaveLayerStep(SkCanvas* canvas, const TestData& d, in PaintSaveLayerStep() argument
379 int saveCount = canvas->getSaveCount(); in PaintSaveLayerStep()
380 canvas->saveLayer(nullptr, &d.fPaint); in PaintSaveLayerStep()
381 canvas->restore(); in PaintSaveLayerStep()
382 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, in PaintSaveLayerStep()
387 static void TwoClipOpsStep(SkCanvas* canvas, const TestData& d, in TwoClipOpsStep() argument
393 canvas->clipRect(d.fRect); in TwoClipOpsStep()
394 canvas->clipRegion(d.fRegion); in TwoClipOpsStep()
400 static void DrawNearlyZeroLengthPathTestStep(SkCanvas* canvas, const TestData& d, in DrawNearlyZeroLengthPathTestStep() argument
406 canvas->drawPath(d.fNearlyZeroLengthPath, paint); in DrawNearlyZeroLengthPathTestStep()
410 static void DrawVerticesShaderTestStep(SkCanvas* canvas, const TestData& d, in DrawVerticesShaderTestStep() argument
421 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, in DrawVerticesShaderTestStep()
427 static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, in DrawPictureTestStep() argument
437 canvas->drawPicture(testPicture); in DrawPictureTestStep()
441 static void SaveRestoreTestStep(SkCanvas* canvas, const TestData& d, in SaveRestoreTestStep() argument
443 int baseSaveCount = canvas->getSaveCount(); in SaveRestoreTestStep()
444 int n = canvas->save(); in SaveRestoreTestStep()
446 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(), in SaveRestoreTestStep()
448 canvas->save(); in SaveRestoreTestStep()
449 canvas->save(); in SaveRestoreTestStep()
450 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 3 == canvas->getSaveCount(), in SaveRestoreTestStep()
452 canvas->restoreToCount(baseSaveCount + 1); in SaveRestoreTestStep()
453 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(), in SaveRestoreTestStep()
457 canvas->restoreToCount(0); in SaveRestoreTestStep()
458 REPORTER_ASSERT_MESSAGE(reporter, 1 == canvas->getSaveCount(), in SaveRestoreTestStep()
463 static void NestedSaveRestoreWithSolidPaintTestStep(SkCanvas* canvas, const TestData& d, in NestedSaveRestoreWithSolidPaintTestStep() argument
469 canvas->resetMatrix(); in NestedSaveRestoreWithSolidPaintTestStep()
470 canvas->rotate(SkIntToScalar(30)); in NestedSaveRestoreWithSolidPaintTestStep()
471 canvas->save(); in NestedSaveRestoreWithSolidPaintTestStep()
472 canvas->translate(SkIntToScalar(2), SkIntToScalar(1)); in NestedSaveRestoreWithSolidPaintTestStep()
473 canvas->save(); in NestedSaveRestoreWithSolidPaintTestStep()
474 canvas->scale(SkIntToScalar(3), SkIntToScalar(3)); in NestedSaveRestoreWithSolidPaintTestStep()
477 canvas->drawPaint(paint); in NestedSaveRestoreWithSolidPaintTestStep()
478 canvas->restore(); in NestedSaveRestoreWithSolidPaintTestStep()
479 canvas->restore(); in NestedSaveRestoreWithSolidPaintTestStep()
484 static void NestedSaveRestoreWithFlushTestStep(SkCanvas* canvas, const TestData& d, in NestedSaveRestoreWithFlushTestStep() argument
490 canvas->resetMatrix(); in NestedSaveRestoreWithFlushTestStep()
491 canvas->rotate(SkIntToScalar(30)); in NestedSaveRestoreWithFlushTestStep()
492 canvas->save(); in NestedSaveRestoreWithFlushTestStep()
493 canvas->translate(SkIntToScalar(2), SkIntToScalar(1)); in NestedSaveRestoreWithFlushTestStep()
494 canvas->save(); in NestedSaveRestoreWithFlushTestStep()
495 canvas->scale(SkIntToScalar(3), SkIntToScalar(3)); in NestedSaveRestoreWithFlushTestStep()
496 canvas->drawRect(d.fRect,d.fPaint); in NestedSaveRestoreWithFlushTestStep()
497 canvas->flush(); in NestedSaveRestoreWithFlushTestStep()
498 canvas->restore(); in NestedSaveRestoreWithFlushTestStep()
499 canvas->restore(); in NestedSaveRestoreWithFlushTestStep()
569 SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), in TestPdfDevice() local
571 REPORTER_ASSERT(reporter, canvas); in TestPdfDevice()
573 testStep->draw(canvas, d, reporter); in TestPdfDevice()
646 SkCanvas* canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes); in test_newraster() local
647 REPORTER_ASSERT(reporter, canvas); in test_newraster()
651 const SkPMColor* addr = (const SkPMColor*)canvas->peekPixels(&info2, &rowBytes); in test_newraster()
661 delete canvas; in test_newraster()
677 canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes); in test_newraster()
678 REPORTER_ASSERT(reporter, canvas); in test_newraster()
679 delete canvas; in test_newraster()
696 SkCanvas canvas(10, 10); in DEF_TEST() local
697 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); in DEF_TEST()
699 int n = canvas.save(); in DEF_TEST()
701 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); in DEF_TEST()
703 n = canvas.saveLayer(nullptr, nullptr); in DEF_TEST()
705 REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount()); in DEF_TEST()
707 canvas.restore(); in DEF_TEST()
708 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); in DEF_TEST()
709 canvas.restore(); in DEF_TEST()
710 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); in DEF_TEST()
714 SkCanvas canvas(10, 10); in DEF_TEST() local
715 canvas.save(); in DEF_TEST()
717 canvas.clipPath(path); in DEF_TEST()
718 canvas.restore(); in DEF_TEST()
719 canvas.save(); in DEF_TEST()
721 canvas.clipPath(path); in DEF_TEST()
722 canvas.restore(); in DEF_TEST()
723 canvas.save(); in DEF_TEST()
725 canvas.clipPath(path); // should not assert here in DEF_TEST()
726 canvas.restore(); in DEF_TEST()
733 MockFilterCanvas(SkCanvas* canvas) : INHERITED(canvas) { } in MockFilterCanvas() argument
746 SkCanvas canvas(100, 100); in DEF_TEST() local
747 canvas.clipRect(SkRect::MakeXYWH(12.7f, 12.7f, 75, 75)); in DEF_TEST()
748 canvas.scale(0.5f, 0.75f); in DEF_TEST()
752 MockFilterCanvas filterCanvas(&canvas); in DEF_TEST()
753 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMatrix()); in DEF_TEST()
754 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getClipBounds(&clip2)); in DEF_TEST()
759 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMatrix()); in DEF_TEST()
760 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getClipBounds(&clip2)); in DEF_TEST()