make slug drawing const

Change-Id: I677ad3073725219897bec9f82d88ad3ba3fedb53
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521002
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Herb Derby 2022-03-15 12:13:02 -04:00 committed by SkCQ
parent 66efe821b7
commit 3d381dcbd2
9 changed files with 15 additions and 15 deletions

View File

@ -2276,7 +2276,7 @@ protected:
/** Experimental
*/
virtual void doDrawSlug(GrSlug* slug);
virtual void doDrawSlug(const GrSlug* slug);
#endif
private:
@ -2424,7 +2424,7 @@ private:
/** Experimental
* Draw an GrSlug given the current canvas state.
*/
void drawSlug(GrSlug* slug);
void drawSlug(const GrSlug* slug);
#endif
/** Experimental

View File

@ -55,7 +55,7 @@ public:
const void* data, size_t size, const SkStrikeClient* client = nullptr);
// Draw the GrSlug obeying the canvas's mapping and clipping.
void draw(SkCanvas* canvas);
void draw(SkCanvas* canvas) const;
virtual SkRect sourceBounds() const = 0;
virtual const SkPaint& paint() const = 0;

View File

@ -2350,14 +2350,14 @@ SkCanvas::doConvertBlobToSlug(const SkTextBlob& blob, SkPoint origin, const SkPa
return nullptr;
}
void SkCanvas::drawSlug(GrSlug* slug) {
void SkCanvas::drawSlug(const GrSlug* slug) {
TRACE_EVENT0("skia", TRACE_FUNC);
if (slug) {
this->doDrawSlug(slug);
}
}
void SkCanvas::doDrawSlug(GrSlug* slug) {
void SkCanvas::doDrawSlug(const GrSlug* slug) {
SkRect bounds = slug->sourceBounds();
if (this->internalQuickReject(bounds, slug->paint())) {
return;

View File

@ -486,7 +486,7 @@ sk_sp<GrSlug> SkBaseDevice::convertGlyphRunListToSlug(
return nullptr;
}
void SkBaseDevice::drawSlug(SkCanvas*, GrSlug*) {
void SkBaseDevice::drawSlug(SkCanvas*, const GrSlug*) {
SK_ABORT("GrSlug drawing not supported.");
}
#endif

View File

@ -307,7 +307,7 @@ protected:
virtual sk_sp<GrSlug> convertGlyphRunListToSlug(
const SkGlyphRunList& glyphRunList,
const SkPaint& paint);
virtual void drawSlug(SkCanvas*, GrSlug* slug);
virtual void drawSlug(SkCanvas*, const GrSlug* slug);
#endif
/**

View File

@ -42,7 +42,7 @@ sk_sp<GrSlug> GrSlug::Deserialize(const void* data, size_t size, const SkStrikeC
return SkMakeSlugFromBuffer(buffer, client);
}
void GrSlug::draw(SkCanvas* canvas) {
void GrSlug::draw(SkCanvas* canvas) const {
canvas->drawSlug(this);
}

View File

@ -2918,7 +2918,7 @@ public:
void surfaceDraw(SkCanvas*,
const GrClip* clip,
const SkMatrixProvider& viewMatrix,
skgpu::v1::SurfaceDrawContext* sdc);
skgpu::v1::SurfaceDrawContext* sdc) const;
void doFlatten(SkWriteBuffer& buffer) const override;
SkRect sourceBounds() const override { return fSourceBounds; }
@ -2984,7 +2984,7 @@ Slug::Slug(SkRect sourceBounds,
, fOrigin{origin} { }
void Slug::surfaceDraw(SkCanvas* canvas, const GrClip* clip, const SkMatrixProvider& viewMatrix,
skgpu::v1::SurfaceDrawContext* sdc) {
skgpu::v1::SurfaceDrawContext* sdc) const {
for (const GrSubRun& subRun : fSubRuns) {
subRun.draw(canvas, clip, viewMatrix, fOrigin, fPaint, sdc);
}
@ -3577,7 +3577,7 @@ Device::convertGlyphRunListToSlug(const SkGlyphRunList& glyphRunList, const SkPa
this->asMatrixProvider(), glyphRunList, paint);
}
void Device::drawSlug(SkCanvas* canvas, GrSlug* slug) {
void Device::drawSlug(SkCanvas* canvas, const GrSlug* slug) {
fSurfaceDrawContext->drawSlug(canvas, this->clip(), this->asMatrixProvider(), slug);
}
@ -3597,8 +3597,8 @@ SurfaceDrawContext::convertGlyphRunListToSlug(const SkMatrixProvider& viewMatrix
void SurfaceDrawContext::drawSlug(SkCanvas* canvas,
const GrClip* clip,
const SkMatrixProvider& viewMatrix,
GrSlug* slugPtr) {
Slug* slug = static_cast<Slug*>(slugPtr);
const GrSlug* slugPtr) {
const Slug* slug = static_cast<const Slug*>(slugPtr);
slug->surfaceDraw(canvas, clip, viewMatrix, this);
}

View File

@ -161,7 +161,7 @@ protected:
const SkGlyphRunList& glyphRunList,
const SkPaint& paint) override;
void drawSlug(SkCanvas*, GrSlug* slug) override;
void drawSlug(SkCanvas*, const GrSlug* slug) override;
void onClipRect(const SkRect& rect, SkClipOp op, bool aa) override {
SkASSERT(op == SkClipOp::kIntersect || op == SkClipOp::kDifference);

View File

@ -518,7 +518,7 @@ public:
void drawSlug(SkCanvas*,
const GrClip* clip,
const SkMatrixProvider& viewMatrix,
GrSlug* slugPtr);
const GrSlug* slugPtr);
/**
* Adds the necessary signal and wait semaphores and adds the passed in SkDrawable to the