Make glyph runs const in the glyph run list.
Change-Id: I5627eef258abc506675b389a9d72692f92fd823e Reviewed-on: https://skia-review.googlesource.com/c/167922 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
18b950a527
commit
13245412d4
@ -339,12 +339,11 @@ void SkBaseDevice::drawGlyphRunRSXform(
|
||||
SkMatrix ctm;
|
||||
ctm.setRSXform(*xform++);
|
||||
|
||||
SkPaint transformingPaint = glyphRun.paint();
|
||||
|
||||
auto shader = transformingPaint.getShader();
|
||||
// We want to rotate each glyph by the rsxform, but we don't want to rotate "space"
|
||||
// (i.e. the shader that cares about the ctm) so we have to undo our little ctm trick
|
||||
// with a localmatrixshader so that the shader draws as if there was no change to the ctm.
|
||||
SkPaint transformingPaint = glyphRun.paint();
|
||||
auto shader = transformingPaint.getShader();
|
||||
if (shader) {
|
||||
SkMatrix inverse;
|
||||
if (ctm.invert(&inverse)) {
|
||||
@ -354,11 +353,11 @@ void SkBaseDevice::drawGlyphRunRSXform(
|
||||
}
|
||||
}
|
||||
|
||||
SkGlyphRun transformedGlyphRun{glyphRun, transformingPaint};
|
||||
ctm.setConcat(originalCTM, ctm);
|
||||
this->setCTM(ctm);
|
||||
SkGlyphRunList glyphRunList{&transformedGlyphRun};
|
||||
this->drawGlyphRunList(glyphRunList);
|
||||
|
||||
SkGlyphRun transformedGlyphRun{glyphRun, transformingPaint};
|
||||
this->drawGlyphRunList(SkGlyphRunList{transformedGlyphRun});
|
||||
};
|
||||
run->eachGlyphToGlyphRun(perGlyph);
|
||||
this->setCTM(originalCTM);
|
||||
|
@ -78,17 +78,17 @@ SkGlyphRunList::SkGlyphRunList(
|
||||
const SkPaint& paint,
|
||||
const SkTextBlob* blob,
|
||||
SkPoint origin,
|
||||
SkSpan<SkGlyphRun> glyphRunList)
|
||||
SkSpan<const SkGlyphRun> glyphRunList)
|
||||
: fOriginalPaint{&paint}
|
||||
, fOriginalTextBlob{blob}
|
||||
, fOrigin{origin}
|
||||
, fGlyphRuns{glyphRunList} { }
|
||||
|
||||
SkGlyphRunList::SkGlyphRunList(SkGlyphRun* glyphRun)
|
||||
: fOriginalPaint{&glyphRun->paint()}
|
||||
SkGlyphRunList::SkGlyphRunList(const SkGlyphRun& glyphRun)
|
||||
: fOriginalPaint{&glyphRun.paint()}
|
||||
, fOriginalTextBlob{nullptr}
|
||||
, fOrigin{SkPoint::Make(0, 0)}
|
||||
, fGlyphRuns{SkSpan<SkGlyphRun>{glyphRun, 1}} {}
|
||||
, fGlyphRuns{SkSpan<const SkGlyphRun>{&glyphRun, 1}} {}
|
||||
|
||||
uint64_t SkGlyphRunList::uniqueID() const {
|
||||
return fOriginalTextBlob != nullptr ? fOriginalTextBlob->uniqueID()
|
||||
@ -352,7 +352,7 @@ void SkGlyphRunBuilder::makeGlyphRunList(
|
||||
|
||||
fGlyphRunList.~SkGlyphRunList();
|
||||
new (&fGlyphRunList) SkGlyphRunList{
|
||||
paint, blob, origin, SkSpan<SkGlyphRun>{fGlyphRunListStorage}};
|
||||
paint, blob, origin, SkSpan<const SkGlyphRun>{fGlyphRunListStorage}};
|
||||
}
|
||||
|
||||
void SkGlyphRunBuilder::simplifyDrawText(
|
||||
|
@ -125,7 +125,7 @@ class SkGlyphRunList {
|
||||
// should be used for nothing else
|
||||
const SkTextBlob* fOriginalTextBlob{nullptr};
|
||||
SkPoint fOrigin = {0, 0};
|
||||
SkSpan<SkGlyphRun> fGlyphRuns;
|
||||
SkSpan<const SkGlyphRun> fGlyphRuns;
|
||||
|
||||
public:
|
||||
SkGlyphRunList();
|
||||
@ -134,9 +134,9 @@ public:
|
||||
const SkPaint& paint,
|
||||
const SkTextBlob* blob,
|
||||
SkPoint origin,
|
||||
SkSpan<SkGlyphRun> glyphRunList);
|
||||
SkSpan<const SkGlyphRun> glyphRunList);
|
||||
|
||||
SkGlyphRunList(SkGlyphRun* glyphRun);
|
||||
SkGlyphRunList(const SkGlyphRun& glyphRun);
|
||||
|
||||
uint64_t uniqueID() const;
|
||||
bool anyRunsLCD() const;
|
||||
|
Loading…
Reference in New Issue
Block a user