Lines Matching refs:canvas
208 static void test_clipVisitor(skiatest::Reporter* reporter, SkCanvas* canvas) { in test_clipVisitor() argument
209 SkISize size = canvas->getDeviceSize(); in test_clipVisitor()
216 canvas->replayClips(&visitor); in test_clipVisitor()
218 REPORTER_ASSERT(reporter, equal_clips(c, *canvas)); in test_clipVisitor()
226 SkCanvas canvas(10, 10); in test_clipstack() local
227 cs = SkRef(canvas.getClipStack()); in test_clipstack()
301 virtual void draw(SkCanvas* canvas, const TestData& d, \
303 FUNCTION (canvas, d, reporter, this); \
313 virtual void draw(SkCanvas* canvas, const TestData& d, \
315 FUNCTION (canvas, d, reporter, this); \
322 static void NAME##TestStep(SkCanvas* canvas, const TestData& d, \
324 canvas-> CALL ; \
329 static void NAME##TestStep(SkCanvas* canvas, const TestData& d, \
331 REPORTER_ASSERT_MESSAGE(reporter, canvas-> CALL , \
358 static void SaveMatrixClipStep(SkCanvas* canvas, const TestData& d, in SaveMatrixClipStep() argument
360 int saveCount = canvas->getSaveCount(); in SaveMatrixClipStep()
361 canvas->save(); in SaveMatrixClipStep()
362 canvas->translate(SkIntToScalar(1), SkIntToScalar(2)); in SaveMatrixClipStep()
363 canvas->clipRegion(d.fRegion); in SaveMatrixClipStep()
364 canvas->restore(); in SaveMatrixClipStep()
365 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, in SaveMatrixClipStep()
367 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(), in SaveMatrixClipStep()
373 static void SaveLayerStep(SkCanvas* canvas, const TestData& d, in SaveLayerStep() argument
375 int saveCount = canvas->getSaveCount(); in SaveLayerStep()
376 canvas->saveLayer(NULL, NULL); in SaveLayerStep()
377 canvas->restore(); in SaveLayerStep()
378 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, in SaveLayerStep()
383 static void BoundedSaveLayerStep(SkCanvas* canvas, const TestData& d, in BoundedSaveLayerStep() argument
385 int saveCount = canvas->getSaveCount(); in BoundedSaveLayerStep()
386 canvas->saveLayer(&d.fRect, NULL); in BoundedSaveLayerStep()
387 canvas->restore(); in BoundedSaveLayerStep()
388 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, in BoundedSaveLayerStep()
393 static void PaintSaveLayerStep(SkCanvas* canvas, const TestData& d, in PaintSaveLayerStep() argument
395 int saveCount = canvas->getSaveCount(); in PaintSaveLayerStep()
396 canvas->saveLayer(NULL, &d.fPaint); in PaintSaveLayerStep()
397 canvas->restore(); in PaintSaveLayerStep()
398 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, in PaintSaveLayerStep()
403 static void TwoClipOpsStep(SkCanvas* canvas, const TestData& d, in TwoClipOpsStep() argument
409 canvas->clipRect(d.fRect); in TwoClipOpsStep()
410 canvas->clipRegion(d.fRegion); in TwoClipOpsStep()
416 static void DrawNearlyZeroLengthPathTestStep(SkCanvas* canvas, const TestData& d, in DrawNearlyZeroLengthPathTestStep() argument
422 canvas->drawPath(d.fNearlyZeroLengthPath, paint); in DrawNearlyZeroLengthPathTestStep()
426 static void DrawVerticesShaderTestStep(SkCanvas* canvas, const TestData& d, in DrawVerticesShaderTestStep() argument
437 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, in DrawVerticesShaderTestStep()
443 static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, in DrawPictureTestStep() argument
453 canvas->drawPicture(testPicture); in DrawPictureTestStep()
457 static void SaveRestoreTestStep(SkCanvas* canvas, const TestData& d, in SaveRestoreTestStep() argument
459 int baseSaveCount = canvas->getSaveCount(); in SaveRestoreTestStep()
460 int n = canvas->save(); in SaveRestoreTestStep()
462 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(), in SaveRestoreTestStep()
464 canvas->save(); in SaveRestoreTestStep()
465 canvas->save(); in SaveRestoreTestStep()
466 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 3 == canvas->getSaveCount(), in SaveRestoreTestStep()
468 canvas->restoreToCount(baseSaveCount + 1); in SaveRestoreTestStep()
469 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(), in SaveRestoreTestStep()
473 canvas->restoreToCount(0); in SaveRestoreTestStep()
474 REPORTER_ASSERT_MESSAGE(reporter, 1 == canvas->getSaveCount(), in SaveRestoreTestStep()
479 static void NestedSaveRestoreWithSolidPaintTestStep(SkCanvas* canvas, const TestData& d, in NestedSaveRestoreWithSolidPaintTestStep() argument
485 canvas->resetMatrix(); in NestedSaveRestoreWithSolidPaintTestStep()
486 canvas->rotate(SkIntToScalar(30)); in NestedSaveRestoreWithSolidPaintTestStep()
487 canvas->save(); in NestedSaveRestoreWithSolidPaintTestStep()
488 canvas->translate(SkIntToScalar(2), SkIntToScalar(1)); in NestedSaveRestoreWithSolidPaintTestStep()
489 canvas->save(); in NestedSaveRestoreWithSolidPaintTestStep()
490 canvas->scale(SkIntToScalar(3), SkIntToScalar(3)); in NestedSaveRestoreWithSolidPaintTestStep()
493 canvas->drawPaint(paint); in NestedSaveRestoreWithSolidPaintTestStep()
494 canvas->restore(); in NestedSaveRestoreWithSolidPaintTestStep()
495 canvas->restore(); in NestedSaveRestoreWithSolidPaintTestStep()
500 static void NestedSaveRestoreWithFlushTestStep(SkCanvas* canvas, const TestData& d, in NestedSaveRestoreWithFlushTestStep() argument
506 canvas->resetMatrix(); in NestedSaveRestoreWithFlushTestStep()
507 canvas->rotate(SkIntToScalar(30)); in NestedSaveRestoreWithFlushTestStep()
508 canvas->save(); in NestedSaveRestoreWithFlushTestStep()
509 canvas->translate(SkIntToScalar(2), SkIntToScalar(1)); in NestedSaveRestoreWithFlushTestStep()
510 canvas->save(); in NestedSaveRestoreWithFlushTestStep()
511 canvas->scale(SkIntToScalar(3), SkIntToScalar(3)); in NestedSaveRestoreWithFlushTestStep()
512 canvas->drawRect(d.fRect,d.fPaint); in NestedSaveRestoreWithFlushTestStep()
513 canvas->flush(); in NestedSaveRestoreWithFlushTestStep()
514 canvas->restore(); in NestedSaveRestoreWithFlushTestStep()
515 canvas->restore(); in NestedSaveRestoreWithFlushTestStep()
574 SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), in TestPdfDevice() local
576 REPORTER_ASSERT(reporter, canvas); in TestPdfDevice()
578 testStep->draw(canvas, d, reporter); in TestPdfDevice()
698 SkCanvas* canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes); in test_newraster() local
699 REPORTER_ASSERT(reporter, canvas); in test_newraster()
703 const SkPMColor* addr = (const SkPMColor*)canvas->peekPixels(&info2, &rowBytes); in test_newraster()
713 SkDELETE(canvas); in test_newraster()
729 canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes); in test_newraster()
730 REPORTER_ASSERT(reporter, canvas); in test_newraster()
731 SkDELETE(canvas); in test_newraster()
748 SkCanvas canvas(10, 10); in DEF_TEST() local
749 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); in DEF_TEST()
751 int n = canvas.save(); in DEF_TEST()
753 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); in DEF_TEST()
755 n = canvas.saveLayer(NULL, NULL); in DEF_TEST()
757 REPORTER_ASSERT(reporter, 3 == canvas.getSaveCount()); in DEF_TEST()
759 canvas.restore(); in DEF_TEST()
760 REPORTER_ASSERT(reporter, 2 == canvas.getSaveCount()); in DEF_TEST()
761 canvas.restore(); in DEF_TEST()
762 REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); in DEF_TEST()
766 SkCanvas canvas(10, 10); in DEF_TEST() local
767 canvas.save(); in DEF_TEST()
769 canvas.clipPath(path); in DEF_TEST()
770 canvas.restore(); in DEF_TEST()
771 canvas.save(); in DEF_TEST()
773 canvas.clipPath(path); in DEF_TEST()
774 canvas.restore(); in DEF_TEST()
775 canvas.save(); in DEF_TEST()
777 canvas.clipPath(path); // should not assert here in DEF_TEST()
778 canvas.restore(); in DEF_TEST()