Flutter Engine
The Flutter Engine
GrFixedClip.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 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
8#ifndef GrFixedClip_DEFINED
9#define GrFixedClip_DEFINED
10
14
15/**
16 * Implements GrHardClip with scissor and window rectangles.
17 */
18class GrFixedClip final : public GrHardClip {
19public:
20 explicit GrFixedClip(const SkISize& rtDims) : fScissorState(rtDims) {}
21 GrFixedClip(const SkISize& rtDims, const SkIRect& scissorRect)
22 : GrFixedClip(rtDims) {
23 SkAssertResult(fScissorState.set(scissorRect));
24 }
25
26 const GrScissorState& scissorState() const { return fScissorState; }
27 bool scissorEnabled() const { return fScissorState.enabled(); }
28 // Returns the scissor rect or rt bounds if the scissor test is not enabled.
29 const SkIRect& scissorRect() const { return fScissorState.rect(); }
30
31 void disableScissor() { fScissorState.setDisabled(); }
32
33 [[nodiscard]] bool setScissor(const SkIRect& irect) {
34 return fScissorState.set(irect);
35 }
36 [[nodiscard]] bool intersect(const SkIRect& irect) {
37 return fScissorState.intersect(irect);
38 }
39
40 const GrWindowRectsState& windowRectsState() const { return fWindowRectsState; }
41 bool hasWindowRectangles() const { return fWindowRectsState.enabled(); }
42
43 void disableWindowRectangles() { fWindowRectsState.setDisabled(); }
44
46 fWindowRectsState.set(windows, mode);
47 }
48
49 SkIRect getConservativeBounds() const final;
50 Effect apply(GrAppliedHardClip*, SkIRect*) const final;
51 PreClipResult preApply(const SkRect& drawBounds, GrAA aa) const final;
52
53private:
54 GrScissorState fScissorState;
55 GrWindowRectsState fWindowRectsState;
56};
57
58#endif
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
GrAA
Definition: GrTypesPriv.h:173
Effect apply(GrAppliedHardClip *, SkIRect *) const final
Definition: GrFixedClip.cpp:34
SkIRect getConservativeBounds() const final
Definition: GrFixedClip.cpp:12
const SkIRect & scissorRect() const
Definition: GrFixedClip.h:29
GrFixedClip(const SkISize &rtDims)
Definition: GrFixedClip.h:20
PreClipResult preApply(const SkRect &drawBounds, GrAA aa) const final
Definition: GrFixedClip.cpp:16
void disableScissor()
Definition: GrFixedClip.h:31
bool hasWindowRectangles() const
Definition: GrFixedClip.h:41
bool scissorEnabled() const
Definition: GrFixedClip.h:27
void setWindowRectangles(const GrWindowRectangles &windows, GrWindowRectsState::Mode mode)
Definition: GrFixedClip.h:45
const GrWindowRectsState & windowRectsState() const
Definition: GrFixedClip.h:40
GrFixedClip(const SkISize &rtDims, const SkIRect &scissorRect)
Definition: GrFixedClip.h:21
const GrScissorState & scissorState() const
Definition: GrFixedClip.h:26
bool setScissor(const SkIRect &irect)
Definition: GrFixedClip.h:33
bool intersect(const SkIRect &irect)
Definition: GrFixedClip.h:36
void disableWindowRectangles()
Definition: GrFixedClip.h:43
bool enabled() const
bool set(const SkIRect &rect)
const SkIRect & rect() const
bool intersect(const SkIRect &rect)
void set(const GrWindowRectangles &windows, Mode mode)
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 mode
Definition: switches.h:228
Definition: SkRect.h:32
Definition: SkSize.h:16