зеркало из https://github.com/mozilla/moz-skia.git
Fix definition of isEqual() for two gradient effect custom stages.
Expand comments defining isEqual() to better distinguish equality from equivalence, which is more significant in Ganesh shader cache management. http://codereview.appspot.com/6379043/ git-svn-id: http://skia.googlecode.com/svn/trunk@4484 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
8cd5ae79c6
Коммит
1dcfa1fcbd
|
@ -52,13 +52,15 @@ public:
|
|||
*/
|
||||
virtual const GrProgramStageFactory& getFactory() const = 0;
|
||||
|
||||
/** Returns true if the other custom stage will generate
|
||||
equal output.
|
||||
/** Returns true if the other custom stage will generate identical output.
|
||||
Must only be called if the two are already known to be of the
|
||||
same type (i.e. they return the same value from getFactory()).
|
||||
For equivalence (that they will generate the same
|
||||
shader, but perhaps have different uniforms), check equality
|
||||
of the stageKey produced by the GrProgramStageFactory. */
|
||||
|
||||
Equality is not the same thing as equivalence.
|
||||
To test for equivalence (that they will generate the same
|
||||
shader code, but may have different uniforms), check equality
|
||||
of the stageKey produced by the GrProgramStageFactory:
|
||||
a.getFactory().genStageKey(a) == b.getFactory().genStageKey(b). */
|
||||
virtual bool isEqual(const GrCustomStage&) const = 0;
|
||||
|
||||
/** Human-meaningful string to identify this effect; may be embedded
|
||||
|
|
|
@ -318,7 +318,9 @@ const GrProgramStageFactory& GrRadial2Gradient::getFactory() const {
|
|||
|
||||
bool GrRadial2Gradient::isEqual(const GrCustomStage& sBase) const {
|
||||
const GrRadial2Gradient& s = static_cast<const GrRadial2Gradient&>(sBase);
|
||||
return (this->isDegenerate() == s.isDegenerate());
|
||||
return (this->fCenterX1 == s.fCenterX1 &&
|
||||
this->fRadius0 == s.fRadius0 &&
|
||||
this->fPosRoot == s.fPosRoot);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
@ -634,7 +636,9 @@ const GrProgramStageFactory& GrConical2Gradient::getFactory() const {
|
|||
|
||||
bool GrConical2Gradient::isEqual(const GrCustomStage& sBase) const {
|
||||
const GrConical2Gradient& s = static_cast<const GrConical2Gradient&>(sBase);
|
||||
return (this->isDegenerate() == s.isDegenerate());
|
||||
return (this->fCenterX1 == s.fCenterX1 &&
|
||||
this->fRadius0 == s.fRadius0 &&
|
||||
this->fDiffRadius == s.fDiffRadius);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
|
Загрузка…
Ссылка в новой задаче