aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-26 16:54:18 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-27 03:13:56 +0000
commitb935cf8e12d7371246d318f20f4ebf88e321573a (patch)
tree4af6fce01d981c24e16c5adfd92680d49199988e /src/gpu
parent5f1dc76d0ceceb97796ec1626e59fe8d4ede581c (diff)
const all the things
Having the glyph run list be const as it passes through the stack means that future change can't be introduced in the device code that changes behavior. Try to force all text changes into the SkGylphRun system. Change-Id: I9412bc094c7adb8554887c725a6264af306e1d42 Reviewed-on: https://skia-review.googlesource.com/143702 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp2
-rw-r--r--src/gpu/GrRenderTargetContext.h2
-rw-r--r--src/gpu/SkGpuDevice.cpp2
-rw-r--r--src/gpu/SkGpuDevice.h2
-rw-r--r--src/gpu/text/GrTextBlobCache.h8
-rw-r--r--src/gpu/text/GrTextContext.cpp24
-rw-r--r--src/gpu/text/GrTextContext.h4
7 files changed, 22 insertions, 22 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index f2e1c08474..7d88bc4936 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -241,7 +241,7 @@ void GrRenderTargetContext::drawPosText(const GrClip& clip, const SkPaint& paint
void GrRenderTargetContext::drawGlyphRunList(
const GrClip& clip, const SkMatrix& viewMatrix,
- SkGlyphRunList* blob, const SkIRect& clipBounds) {
+ const SkGlyphRunList& blob, const SkIRect& clipBounds) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 2d4bc49dcf..565a2b8c08 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -69,7 +69,7 @@ public:
int scalarsPerPosition, const SkPoint& offset,
const SkIRect& clipBounds);
virtual void drawGlyphRunList(const GrClip&,
- const SkMatrix& viewMatrix, SkGlyphRunList*,
+ const SkMatrix& viewMatrix, const SkGlyphRunList&,
const SkIRect& clipBounds);
/**
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 27eeda7902..39704e5174 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1637,7 +1637,7 @@ void SkGpuDevice::drawPosText(const void* text, size_t byteLength,
this->devClipBounds());
}
-void SkGpuDevice::drawGlyphRunList(SkGlyphRunList* glyphRunList) {
+void SkGpuDevice::drawGlyphRunList(const SkGlyphRunList& glyphRunList) {
ASSERT_SINGLE_OWNER
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawGlyphRunList", fContext.get());
SkDEBUGCODE(this->validate();)
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 5d0fb708dc..6cd1ae60e4 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -89,7 +89,7 @@ public:
const SkPaint& paint) override;
void drawPosText(const void* text, size_t len, const SkScalar pos[],
int scalarsPerPos, const SkPoint& offset, const SkPaint&) override;
- void drawGlyphRunList(SkGlyphRunList* glyphRunList) override;
+ void drawGlyphRunList(const SkGlyphRunList& glyphRunList) override;
void drawVertices(const SkVertices*, const SkMatrix bones[], int boneCount, SkBlendMode,
const SkPaint&) override;
void drawShadow(const SkPath&, const SkDrawShadowRec&) override;
diff --git a/src/gpu/text/GrTextBlobCache.h b/src/gpu/text/GrTextBlobCache.h
index 72743f84ba..110e0ad7fc 100644
--- a/src/gpu/text/GrTextBlobCache.h
+++ b/src/gpu/text/GrTextBlobCache.h
@@ -56,18 +56,18 @@ public:
return cacheBlob;
}
- sk_sp<GrTextBlob> makeBlob(SkGlyphRunList* glyphRunList) {
- return GrTextBlob::Make(glyphRunList->totalGlyphCount(), glyphRunList->size());
+ sk_sp<GrTextBlob> makeBlob(const SkGlyphRunList& glyphRunList) {
+ return GrTextBlob::Make(glyphRunList.totalGlyphCount(), glyphRunList.size());
}
- sk_sp<GrTextBlob> makeCachedBlob(SkGlyphRunList* glyphRunList,
+ sk_sp<GrTextBlob> makeCachedBlob(const SkGlyphRunList& glyphRunList,
const GrTextBlob::Key& key,
const SkMaskFilterBase::BlurRec& blurRec,
const SkPaint& paint) {
sk_sp<GrTextBlob> cacheBlob(makeBlob(glyphRunList));
cacheBlob->setupKey(key, blurRec, paint);
this->add(cacheBlob);
- glyphRunList->temporaryShuntBlobNotifyAddedToCache(fUniqueID);
+ glyphRunList.temporaryShuntBlobNotifyAddedToCache(fUniqueID);
return cacheBlob;
}
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 6a3489554b..aeb99f1548 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -86,12 +86,12 @@ SkScalerContextFlags GrTextContext::ComputeScalerContextFlags(
void GrTextContext::drawGlyphRunList(
GrContext* context, GrTextUtils::Target* target, const GrClip& clip,
- const SkMatrix& viewMatrix, const SkSurfaceProps& props, SkGlyphRunList* glyphRunList,
+ const SkMatrix& viewMatrix, const SkSurfaceProps& props, const SkGlyphRunList& glyphRunList,
const SkIRect& clipBounds) {
- SkPoint origin = glyphRunList->origin();
+ SkPoint origin = glyphRunList.origin();
// Get the first paint to use as the key paint.
- const SkPaint& skPaint = glyphRunList->paint();
+ const SkPaint& skPaint = glyphRunList.paint();
// If we have been abandoned, then don't draw
if (context->abandoned()) {
@@ -102,7 +102,7 @@ void GrTextContext::drawGlyphRunList(
// It might be worth caching these things, but its not clear at this time
// TODO for animated mask filters, this will fill up our cache. We need a safeguard here
const SkMaskFilter* mf = skPaint.getMaskFilter();
- bool canCache = glyphRunList->canCache() && !(skPaint.getPathEffect() ||
+ bool canCache = glyphRunList.canCache() && !(skPaint.getPathEffect() ||
(mf && !as_MFB(mf)->asABlur(&blurRec)));
SkScalerContextFlags scalerContextFlags = ComputeScalerContextFlags(target->colorSpaceInfo());
@@ -112,7 +112,7 @@ void GrTextContext::drawGlyphRunList(
sk_sp<GrTextBlob> cacheBlob;
GrTextBlob::Key key;
if (canCache) {
- bool hasLCD = glyphRunList->anyRunsLCD();
+ bool hasLCD = glyphRunList.anyRunsLCD();
// We canonicalize all non-lcd draws to use kUnknown_SkPixelGeometry
SkPixelGeometry pixelGeometry = hasLCD ? props.pixelGeometry() :
@@ -125,7 +125,7 @@ void GrTextContext::drawGlyphRunList(
ComputeCanonicalColor(skPaint, hasLCD);
key.fPixelGeometry = pixelGeometry;
- key.fUniqueID = glyphRunList->uniqueID();
+ key.fUniqueID = glyphRunList.uniqueID();
key.fStyle = skPaint.getStyle();
key.fHasBlur = SkToBool(mf);
key.fCanonicalColor = canonicalColor;
@@ -148,8 +148,8 @@ void GrTextContext::drawGlyphRunList(
textBlobCache->makeMRU(cacheBlob.get());
if (CACHE_SANITY_CHECK) {
- int glyphCount = glyphRunList->totalGlyphCount();
- int runCount = glyphRunList->runCount();
+ int glyphCount = glyphRunList.totalGlyphCount();
+ int runCount = glyphRunList.runCount();
sk_sp<GrTextBlob> sanityBlob(textBlobCache->makeBlob(glyphCount, runCount));
sanityBlob->setupKey(key, blurRec, skPaint);
this->regenerateGlyphRunList(
@@ -180,8 +180,8 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
SkScalerContextFlags scalerContextFlags,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props,
- SkGlyphRunList* glyphRunList) const {
- SkPoint origin = glyphRunList->origin();
+ const SkGlyphRunList& glyphRunList) const {
+ SkPoint origin = glyphRunList.origin();
cacheBlob->initReusableBlob(paint.luminanceColor(), viewMatrix, origin.x(), origin.y());
// Regenerate textblob
@@ -718,8 +718,8 @@ std::unique_ptr<GrDrawOp> GrTextContext::createOp_TestingOnly(GrContext* context
sk_sp<GrTextBlob> blob;
auto glyphRunList = builder.useGlyphRunList();
- if (!glyphRunList->empty()) {
- auto glyphRun = (*glyphRunList)[0];
+ if (!glyphRunList.empty()) {
+ auto glyphRun = glyphRunList[0];
// Use the text and textLen below, because we don't want to mess with the paint.
glyphRun.temporaryShuntToCallback(
[&](size_t runSize, const char* glyphIDs, const SkScalar* pos) {
diff --git a/src/gpu/text/GrTextContext.h b/src/gpu/text/GrTextContext.h
index 25aeea0c7a..aa4626e411 100644
--- a/src/gpu/text/GrTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -49,7 +49,7 @@ public:
size_t byteLength, const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset, const SkIRect& regionClipBounds);
void drawGlyphRunList(GrContext*, GrTextUtils::Target*, const GrClip&,
- const SkMatrix& viewMatrix, const SkSurfaceProps&, SkGlyphRunList*,
+ const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkGlyphRunList&,
const SkIRect& clipBounds);
std::unique_ptr<GrDrawOp> createOp_TestingOnly(GrContext*,
@@ -123,7 +123,7 @@ private:
SkScalerContextFlags scalerContextFlags,
const SkMatrix& viewMatrix,
const SkSurfaceProps&,
- SkGlyphRunList* glyphRunList) const;
+ const SkGlyphRunList& glyphRunList) const;
sk_sp<GrTextBlob> makeDrawPosTextBlob(GrTextBlobCache*, GrGlyphCache*,
const GrShaderCaps&,