Replace flatten with writeFlattenable for desc.

This replaces calls to SkFlattenable::flatten(SkWriteBuffer&) with
calls to SkWriteBuffer::writeFlattenable(const SkFlattenable*) when
creating the descriptor for an SkScalerContext. This adds the identifier
of the flattenable to the descriptor to avoid collisions when two
flattenables take the same (or no) parameters. This used to be enforced
when the SkScalerContext re-created the flattenable from the descriptor,
but since this is no longer required these possible collisions may
occur.

Change-Id: I2b7efebebf20ffcc0f2b58a081ff0c58158f7d70
Reviewed-on: https://skia-review.googlesource.com/124054
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Ben Wagner 2018-04-26 15:26:19 -04:00 committed by Skia Commit-Bot
parent 9bb47cf0ff
commit a7ae1fc040

View File

@ -1094,12 +1094,12 @@ static size_t calculate_size_and_flatten(
int entryCount = 1;
if (effects.fPathEffect) {
effects.fPathEffect->flatten(*pathEffectBuffer);
pathEffectBuffer->writeFlattenable(effects.fPathEffect);
descSize += pathEffectBuffer->bytesWritten();
entryCount += 1;
}
if (effects.fMaskFilter) {
effects.fMaskFilter->flatten(*maskFilterBuffer);
maskFilterBuffer->writeFlattenable(effects.fMaskFilter);
descSize += maskFilterBuffer->bytesWritten();
entryCount += 1;
}