Fix yuv_to_rgb_effect GM
This bug was introduced in https://skia-review.googlesource.com/c/skia/+/160162 (Make GrYUVtoRGBEffect more flexible) I don't know why I wasn't seeing this locally! Change-Id: Ic4d9b88b70c6d691d1e30d5ee0dc592a00b9b4e7 Reviewed-on: https://skia-review.googlesource.com/c/161044 Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
51e8b7e818
commit
6ba8c83234
@ -113,9 +113,9 @@ protected:
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
SkYUVAIndex yuvaIndices[4] = {
|
||||
{ indices[i][0], SkColorChannel::kA },
|
||||
{ indices[i][1], SkColorChannel::kA },
|
||||
{ indices[i][2], SkColorChannel::kA },
|
||||
{ indices[i][0], SkColorChannel::kR },
|
||||
{ indices[i][1], SkColorChannel::kR },
|
||||
{ indices[i][2], SkColorChannel::kR },
|
||||
{ -1, SkColorChannel::kA }
|
||||
};
|
||||
|
||||
@ -223,7 +223,7 @@ protected:
|
||||
}
|
||||
|
||||
SkYUVAIndex yuvaIndices[4] = {
|
||||
{ 0, SkColorChannel::kA },
|
||||
{ 0, SkColorChannel::kR },
|
||||
{ 1, SkColorChannel::kR },
|
||||
{ 1, SkColorChannel::kG },
|
||||
{ -1, SkColorChannel::kA }
|
||||
|
@ -29,6 +29,14 @@ enum class SkColorChannel {
|
||||
to read from.
|
||||
*/
|
||||
struct SK_API SkYUVAIndex {
|
||||
bool operator==(const SkYUVAIndex& that) const {
|
||||
return this->fIndex == that.fIndex && this->fChannel == that.fChannel;
|
||||
}
|
||||
|
||||
bool operator!=(const SkYUVAIndex& that) const {
|
||||
return !(*this == that);
|
||||
}
|
||||
|
||||
// Index in the array of SkYUVAIndex
|
||||
enum Index {
|
||||
kY_Index = 0,
|
||||
|
@ -182,6 +182,7 @@ void GrYUVtoRGBEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
|
||||
|
||||
uint8_t index = this->yuvaIndex(i).fIndex;
|
||||
uint8_t chann = (uint8_t) this->yuvaIndex(i).fChannel;
|
||||
|
||||
SkASSERT(index < 4 && chann < 4);
|
||||
|
||||
packed |= (index | (chann << 2)) << (i * 4);
|
||||
@ -190,7 +191,12 @@ void GrYUVtoRGBEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
|
||||
}
|
||||
bool GrYUVtoRGBEffect::onIsEqual(const GrFragmentProcessor& other) const {
|
||||
const GrYUVtoRGBEffect& that = other.cast<GrYUVtoRGBEffect>();
|
||||
(void)that;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (fYUVAIndices[i] != that.fYUVAIndices[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->numTextureSamplers(); ++i) {
|
||||
// 'fSamplers' is checked by the base class
|
||||
|
Loading…
Reference in New Issue
Block a user