Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
FillPathTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2010 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
11#include "include/core/SkRect.h"
14#include "src/core/SkBlitter.h"
15#include "src/core/SkScan.h"
16#include "tests/Test.h"
17
18#include <cstdint>
19
20struct FakeBlitter : public SkBlitter {
22 : m_blitCount(0) { }
23
24 void blitH(int x, int y, int width) override {
26 }
27
28 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override {
29 SkDEBUGFAIL("blitAntiH not implemented");
30 }
31
33};
34
35// http://code.google.com/p/skia/issues/detail?id=87
36// Lines which is not clipped by boundary based clipping,
37// but skipped after tessellation, should be cleared by the blitter.
38DEF_TEST(FillPathInverse, reporter) {
39 FakeBlitter blitter;
41 SkPath path;
42 int height = 100;
43 int width = 200;
44 int expected_lines = 5;
45 clip.setLTRB(0, height - expected_lines, width, height);
46 path.moveTo(0.0f, 0.0f)
48 SkIntToScalar(width), 0.0f)
49 .close()
51 SkScan::FillPath(path, clip, &blitter);
52
53 REPORTER_ASSERT(reporter, blitter.m_blitCount == expected_lines);
54}
reporter
#define SkDEBUGFAIL(message)
Definition SkAssert.h:118
uint8_t SkAlpha
Definition SkColor.h:26
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
#define SkIntToScalar(x)
Definition SkScalar.h:57
#define DEF_TEST(name, reporter)
Definition Test.h:312
#define REPORTER_ASSERT(r, cond,...)
Definition Test.h:286
static void FillPath(const SkPath &, const SkIRect &, SkBlitter *)
double y
double x
int32_t height
int32_t width
void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override
void blitH(int x, int y, int width) override
Blit a horizontal run of one or more pixels.