Flutter Engine
The Flutter Engine
GrPaint.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2013 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
13
14GrPaint::GrPaint(const GrPaint& that)
15 : fXPFactory(that.fXPFactory)
16 , fTrivial(that.fTrivial)
17 , fColor(that.fColor) {
18 if (that.fColorFragmentProcessor) {
19 fColorFragmentProcessor = that.fColorFragmentProcessor->clone();
20 SkASSERT(fColorFragmentProcessor);
21 }
22 if (that.fCoverageFragmentProcessor) {
23 fCoverageFragmentProcessor = that.fCoverageFragmentProcessor->clone();
24 SkASSERT(fCoverageFragmentProcessor);
25 }
26}
27
30}
31
32void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage) {
33 this->setXPFactory(GrCoverageSetOpXPFactory::Get(regionOp, invertCoverage));
34}
35
36bool GrPaint::isConstantBlendedColor(SkPMColor4f* constantColor) const {
37 // This used to do a more sophisticated analysis but now it just explicitly looks for common
38 // cases.
41 if (kClear == fXPFactory) {
42 *constantColor = SK_PMColor4fTRANSPARENT;
43 return true;
44 }
45 if (this->hasColorFragmentProcessor()) {
46 return false;
47 }
48 if (kSrc == fXPFactory || (!fXPFactory && fColor.isOpaque())) {
49 *constantColor = fColor;
50 return true;
51 }
52 return false;
53}
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkBlendMode
Definition: SkBlendMode.h:38
@ kClear
r = 0
constexpr SkPMColor4f SK_PMColor4fTRANSPARENT
Definition: SkColorData.h:378
static const GrXPFactory * Get(SkRegion::Op regionOp, bool invertCoverage=false)
void setCoverageSetOpXPFactory(SkRegion::Op, bool invertCoverage=false)
Definition: GrPaint.cpp:32
void setXPFactory(const GrXPFactory *xpFactory)
Definition: GrPaint.h:53
GrPaint()=default
bool isConstantBlendedColor(SkPMColor4f *constantColor) const
Definition: GrPaint.cpp:36
bool hasColorFragmentProcessor() const
Definition: GrPaint.h:82
void setPorterDuffXPFactory(SkBlendMode mode)
Definition: GrPaint.cpp:28
static const GrXPFactory * Get(SkBlendMode blendMode)
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
bool isOpaque() const
Definition: SkColor.h:344