Flutter Engine
The Flutter Engine
GrFixedClip.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
9
11
13 return fScissorState.rect();
14}
15
17 SkIRect pixelBounds = GetPixelIBounds(drawBounds, aa);
18 if (!SkIRect::Intersects(fScissorState.rect(), pixelBounds)) {
20 }
21
22 if (fWindowRectsState.enabled()) {
23 return Effect::kClipped;
24 }
25
26 if (!fScissorState.enabled() || fScissorState.rect().contains(pixelBounds)) {
27 // Either no scissor or the scissor doesn't clip the draw
28 return Effect::kUnclipped;
29 }
30 // Report the scissor as a degenerate round rect
31 return {SkRect::Make(fScissorState.rect()), GrAA::kNo};
32}
33
35 if (!SkIRect::Intersects(fScissorState.rect(), *bounds)) {
37 }
38
40 if (fScissorState.enabled() && !fScissorState.rect().contains(*bounds)) {
41 SkAssertResult(bounds->intersect(fScissorState.rect()));
42 out->setScissor(*bounds);
43 effect = Effect::kClipped;
44 }
45
46 if (fWindowRectsState.enabled()) {
47 out->addWindowRectangles(fWindowRectsState);
48 // We could iterate each window rectangle to check for intersection, but be conservative
49 // and report that it's clipped
50 effect = Effect::kClipped;
51 }
52
53 return effect;
54}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
GrAA
Definition: GrTypesPriv.h:173
static SkIRect GetPixelIBounds(const SkRect &bounds, GrAA aa, BoundsType mode=BoundsType::kExterior)
Definition: GrClip.h:173
Effect
Definition: GrClip.h:31
Effect apply(GrAppliedHardClip *, SkIRect *) const final
Definition: GrFixedClip.cpp:34
SkIRect getConservativeBounds() const final
Definition: GrFixedClip.cpp:12
PreClipResult preApply(const SkRect &drawBounds, GrAA aa) const final
Definition: GrFixedClip.cpp:16
bool enabled() const
const SkIRect & rect() const
Optional< SkRect > bounds
Definition: SkRecords.h:189
Definition: SkRect.h:32
static bool Intersects(const SkIRect &a, const SkIRect &b)
Definition: SkRect.h:535
bool contains(int32_t x, int32_t y) const
Definition: SkRect.h:463
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669