Go to the source code of this file.
|
| DEF_TEST (canvas_unsorted_clip, r) |
|
| DEF_TEST (canvas_clipbounds, reporter) |
|
| DEF_TEST (CanvasNewRasterTest, reporter) |
|
static SkPath | make_path_from_rect (SkRect r) |
|
static SkRegion | make_region_from_irect (SkIRect r) |
|
static SkBitmap | make_n32_bitmap (int w, int h, SkColor c=SK_ColorWHITE) |
|
| DEF_TEST (Canvas_bitmap, reporter) |
|
| DEF_TEST (Canvas_SaveState, reporter) |
|
| DEF_TEST (Canvas_ClipEmptyPath, reporter) |
|
| DEF_TEST (PaintFilterCanvas_ConsistentState, reporter) |
|
| DEF_TEST (NWayCanvas, r) |
|
| DEF_TEST (CanvasStack, r) |
|
static void | test_cliptype (SkCanvas *canvas, skiatest::Reporter *r) |
|
| DEF_TEST (CanvasClipType, r) |
|
| DEF_TEST (Canvas_SaveLayerWithNullBoundsAndZeroBoundsImageFilter, r) |
|
| DEF_TEST (Canvas_degenerate_dimension, reporter) |
|
| DEF_TEST (Canvas_ClippedOutImageFilter, reporter) |
|
| DEF_TEST (canvas_savelayer_destructor, reporter) |
|
| DEF_TEST (Canvas_saveLayer_colorSpace, reporter) |
|
void | test_many_draws (skiatest::Reporter *reporter, SkSurface *surface) |
|
◆ CanvasTest
◆ DEF_TEST() [1/15]
Definition at line 409 of file CanvasTest.cpp.
409 {
412 SkCanvas referenceCanvas(referenceStore);
414 }
415}
static CanvasTest kCanvasTests[]
static SkBitmap make_n32_bitmap(int w, int h, SkColor c=SK_ColorWHITE)
void(*)(SkCanvas *, skiatest::Reporter *) CanvasTest
static constexpr int kWidth
static constexpr int kHeight
◆ DEF_TEST() [2/15]
DEF_TEST |
( |
canvas_clipbounds |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 109 of file CanvasTest.cpp.
109 {
113
114 irect = canvas.getDeviceClipBounds();
118
119
120 rect = canvas.getLocalClipBounds();
124
126
127 irect = canvas.getDeviceClipBounds();
131
132 rect = canvas.getLocalClipBounds();
136
137
138 {
141
143 }
144}
#define REPORTER_ASSERT(r, cond,...)
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkBlender > blender SkRect rect
static constexpr SkIRect MakeEmpty()
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static constexpr SkISize MakeEmpty()
static constexpr SkRect MakeEmpty()
static constexpr SkRect MakeWH(float w, float h)
◆ DEF_TEST() [3/15]
DEF_TEST |
( |
Canvas_ClipEmptyPath |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 449 of file CanvasTest.cpp.
449 {
451 canvas.save();
453 canvas.clipPath(
path);
454 canvas.restore();
455 canvas.save();
457 canvas.clipPath(
path);
458 canvas.restore();
459 canvas.save();
461 canvas.clipPath(
path);
462 canvas.restore();
463}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
◆ DEF_TEST() [4/15]
DEF_TEST |
( |
Canvas_ClippedOutImageFilter |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 654 of file CanvasTest.cpp.
654 {
656
660
662
666
668
670
671 canvas.rotate(45);
672 const SkMatrix preCTM = canvas.getTotalMatrix();
673 canvas.drawRect(blurredRect,
p);
674 const SkMatrix postCTM = canvas.getTotalMatrix();
676}
constexpr SkColor SK_ColorGREEN
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
◆ DEF_TEST() [5/15]
DEF_TEST |
( |
Canvas_degenerate_dimension |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 637 of file CanvasTest.cpp.
637 {
638
639
643
644 const int big = 100 * 1024;
650 canvas.drawRect({0, 0, 100, 90*1024},
paint);
651 }
652}
constexpr SkColor SK_ColorBLACK
bool setInfo(const SkImageInfo &imageInfo, size_t rowBytes=0)
static sk_sp< SkImageFilter > Shader(sk_sp< SkShader > shader, const CropRect &cropRect={})
SK_API sk_sp< SkShader > Color(SkColor)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static SkImageInfo MakeN32Premul(int width, int height)
◆ DEF_TEST() [6/15]
DEF_TEST |
( |
Canvas_saveLayer_colorSpace |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 736 of file CanvasTest.cpp.
736 {
740
742 auto canvas = surf->getCanvas();
743
748 canvas->drawPaint(
paint);
749 canvas->restore();
750
752}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kOpaque_SkAlphaType
pixel is opaque
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
static sk_sp< SkColorSpace > MakeSRGB()
sk_sp< SkColorSpace > makeColorSpin() const
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
◆ DEF_TEST() [7/15]
DEF_TEST |
( |
canvas_savelayer_destructor |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 678 of file CanvasTest.cpp.
678 {
679
680
684
685
688 for (
int y = 0;
y < pm.info().
height(); ++
y) {
689 for (
int x = 0;
x < pm.info().
width(); ++
x) {
690 if (*pm.addr32(
x,
y) != pmc) {
692 return;
693 }
694 }
695 }
696 };
697
698 auto do_test = [&](int saveCount, int restoreCount) {
699 SkASSERT(restoreCount <= saveCount);
700
702 auto canvas = surf->getCanvas();
703
706
707 for (
int i = 0;
i < saveCount; ++
i) {
708 canvas->saveLayer(nullptr, nullptr);
709 }
710
712
714
715 for (
int i = 0;
i < restoreCount; ++
i) {
716 canvas->restore();
717 }
718
719 };
720
721 do_test(1, 1);
722
724
725
726 do_test(1, 0);
727
729
730
731
732 do_test(2, 0);
734}
bool check_pixels(skiatest::Reporter *reporter, GrDirectContext *dContext, const GrBackendTexture &tex, const SkImageInfo &info, SkColor expectedColor)
SK_API SkPMColor SkPreMultiplyColor(SkColor c)
◆ DEF_TEST() [8/15]
DEF_TEST |
( |
Canvas_SaveLayerWithNullBoundsAndZeroBoundsImageFilter |
, |
|
|
r |
|
|
) |
| |
Definition at line 625 of file CanvasTest.cpp.
625 {
629
630 canvas.saveLayer(
nullptr, &
p);
632 canvas.restore();
633}
static sk_sp< SkImageFilter > Empty()
◆ DEF_TEST() [9/15]
DEF_TEST |
( |
Canvas_SaveState |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 431 of file CanvasTest.cpp.
431 {
434
435 int n = canvas.save();
438
439 n = canvas.saveLayer(nullptr, nullptr);
442
443 canvas.restore();
445 canvas.restore();
447}
◆ DEF_TEST() [10/15]
DEF_TEST |
( |
canvas_unsorted_clip |
, |
|
|
r |
|
|
) |
| |
Definition at line 87 of file CanvasTest.cpp.
87 {
88
89
90
91
92
93
99
102
105 .isSorted());
106 }
107}
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
sk_sp< SkPicture > finishRecordingAsPicture()
auto visit(int i, F &&f) const -> decltype(f(SkRecords::NoOp()))
◆ DEF_TEST() [11/15]
DEF_TEST |
( |
CanvasClipType |
, |
|
|
r |
|
|
) |
| |
Definition at line 592 of file CanvasTest.cpp.
592 {
593
595
596#ifdef SK_SUPPORT_PDF
597
601 }
602#endif
603}
static void test_cliptype(SkCanvas *canvas, skiatest::Reporter *r)
SK_API sk_sp< SkDocument > MakeDocument(SkWStream *stream, const Metadata &metadata)
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
◆ DEF_TEST() [12/15]
DEF_TEST |
( |
CanvasNewRasterTest |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 199 of file CanvasTest.cpp.
199 {
201 const size_t minRowBytes =
info.minRowBytes();
202 const size_t size =
info.computeByteSize(minRowBytes);
206
209
215 for (
int y = 0;
y <
info.height(); ++
y) {
216 for (
int x = 0;
x <
info.width(); ++
x) {
218 }
220 }
221
222
224 minRowBytes + 1));
225
226
229
230
231 info =
info.makeWH(1 << 30, 1 << 30);
233
234
237
238
242}
sk_bzero(glyphs, sizeof(glyphs))
@ kUnknown_SkColorType
uninitialized
static std::unique_ptr< SkCanvas > MakeRasterDirect(const SkImageInfo &info, void *pixels, size_t rowBytes, const SkSurfaceProps *props=nullptr)
const uint32_t * addr32() const
const SkImageInfo & info() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
◆ DEF_TEST() [13/15]
DEF_TEST |
( |
CanvasStack |
, |
|
|
r |
|
|
) |
| |
Definition at line 545 of file CanvasTest.cpp.
545 {
548 bool life[2];
549 std::unique_ptr<SkCanvas> c0 = std::unique_ptr<SkCanvas>(
new LifeLineCanvas(
w,
h, &life[0]));
550 std::unique_ptr<SkCanvas> c1 = std::unique_ptr<SkCanvas>(
new LifeLineCanvas(
w,
h, &life[1]));
553
554 {
556 stack.pushCanvas(std::move(c0), {0,0});
557 stack.pushCanvas(std::move(c1), {0,0});
560 }
561
564}
◆ DEF_TEST() [14/15]
DEF_TEST |
( |
NWayCanvas |
, |
|
|
r |
|
|
) |
| |
Definition at line 516 of file CanvasTest.cpp.
516 {
519 bool life[2];
520 {
521 LifeLineCanvas c0(
w,
h, &life[0]);
523 }
525
526
527 std::unique_ptr<SkCanvas> c0 = std::unique_ptr<SkCanvas>(
new LifeLineCanvas(
w,
h, &life[0]));
528 std::unique_ptr<SkCanvas> c1 = std::unique_ptr<SkCanvas>(
new LifeLineCanvas(
w,
h, &life[1]));
531
532 {
534 nway.addCanvas(c0.get());
535 nway.addCanvas(c1.get());
538 }
539
542}
◆ DEF_TEST() [15/15]
DEF_TEST |
( |
PaintFilterCanvas_ConsistentState |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 481 of file CanvasTest.cpp.
481 {
484 canvas.scale(0.5f, 0.75f);
485
486 MockFilterCanvas filterCanvas(&canvas);
489
491 filterCanvas.scale(0.75f, 0.5f);
494}
◆ make_n32_bitmap()
Definition at line 256 of file CanvasTest.cpp.
256 {
260 return bm;
261}
void allocN32Pixels(int width, int height, bool isOpaque=false)
void eraseColor(SkColor4f) const
◆ make_path_from_rect()
◆ make_region_from_irect()
Definition at line 250 of file CanvasTest.cpp.
250 {
254}
bool setRect(const SkIRect &rect)
ClipOpAndAA opAA SkRegion region
◆ test_cliptype()
Definition at line 566 of file CanvasTest.cpp.
566 {
569
575
581
587
590}
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
virtual bool isClipEmpty() const
virtual bool isClipRect() const
◆ test_many_draws()
Definition at line 756 of file CanvasTest.cpp.
756 {
759 for (
int i = 0;
i < 10000; ++
i) {
760 paint.setColor((0xFF << 24) |
i);
762 }
763}
void drawRect(const SkRect &rect, const SkPaint &paint)
◆ kCanvasTests
◆ kColor
constexpr SkColor kColor = 0x01020304 |
|
staticconstexpr |
◆ kHeight
constexpr int kHeight = 2 |
|
staticconstexpr |
◆ kRect
constexpr SkRect kRect = {0, 0, 2, 1} |
|
staticconstexpr |
◆ kWidth