aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/atlastext
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-02-28 16:37:34 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-28 16:37:47 +0000
commit5c56af1790f58e24d7e9a887c73637fee9b97b38 (patch)
tree2474d26d20cbe3671868b2740a4cd345c5217b6c /src/atlastext
parentdabef9dddd4f6a4d083b3a644dfd6d493b4649f0 (diff)
Revert "Fission GrAtlasGlyphCache in two"
This reverts commit acf17904d6286f2a63a5d895541804d0ea1be646. Reason for revert: Chrome Original change's description: > Fission GrAtlasGlyphCache in two > > This CL splits the old GrAtlasGlyphCache into a GrAtlasGlyphCache and an GrAtlasManager. > > The GrAtlasManager itself is split into a rather limited base class (GrRestrictedAtlasManager) > and the all powerful GrAtlasManager. The GrRestrictedAtlasManager is available at op creation > time and provides access to the proxies backing the atlases. The full GrAtlasManager is > only available at flush time and allows instantiation of the proxies and uploading to them. > > In the DDL world all of the DDL Contexts will receive a GrRestrictedAtlasManager-version of the > GrAtlasManager in the main thread. This future atlas manager will have had all of its > GrDrawOpAtlases created (but not instantiated) so there should be no race conditions. > > Change-Id: I9967d3a4116af50128f390c5039a712b8cd4db08 > Reviewed-on: https://skia-review.googlesource.com/108001 > Commit-Queue: Robert Phillips <robertphillips@google.com> > Reviewed-by: Jim Van Verth <jvanverth@google.com> TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com Change-Id: I7c760ea1a9f041a310b96d552aa1497ee5902cd8 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/111040 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/atlastext')
-rw-r--r--src/atlastext/SkAtlasTextTarget.cpp11
-rw-r--r--src/atlastext/SkInternalAtlasTextContext.cpp16
-rw-r--r--src/atlastext/SkInternalAtlasTextContext.h4
3 files changed, 17 insertions, 14 deletions
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp
index 9da5fd1e3d..f553ffad96 100644
--- a/src/atlastext/SkAtlasTextTarget.cpp
+++ b/src/atlastext/SkAtlasTextTarget.cpp
@@ -181,17 +181,20 @@ void GrAtlasTextOp::finalizeForTextTarget(uint32_t color, const GrCaps& caps) {
void GrAtlasTextOp::executeForTextTarget(SkAtlasTextTarget* target) {
FlushInfo flushInfo;
- SkAutoGlyphCache autoGlyphCache;
+ SkAutoGlyphCache glyphCache;
auto& context = target->context()->internal();
- auto glyphCache = context.grContext()->contextPriv().getGlyphCache();
- auto fullAtlasManager = context.grContext()->contextPriv().getFullAtlasManager();
+ auto atlasGlyphCache = context.grContext()->contextPriv().getAtlasGlyphCache();
auto resourceProvider = context.grContext()->contextPriv().resourceProvider();
+ auto drawingManager = context.grContext()->contextPriv().drawingManager();
+
+ GrOnFlushResourceProvider onFlushResourceProvider(drawingManager);
+ atlasGlyphCache->preFlush(&onFlushResourceProvider, nullptr, 0, nullptr);
for (int i = 0; i < fGeoCount; ++i) {
GrAtlasTextBlob::VertexRegenerator regenerator(
resourceProvider, fGeoData[i].fBlob, fGeoData[i].fRun, fGeoData[i].fSubRun,
fGeoData[i].fViewMatrix, fGeoData[i].fX, fGeoData[i].fY, fGeoData[i].fColor,
- &context, glyphCache, fullAtlasManager, &autoGlyphCache);
+ &context, atlasGlyphCache, &glyphCache);
GrAtlasTextBlob::VertexRegenerator::Result result;
do {
result = regenerator.regenerate();
diff --git a/src/atlastext/SkInternalAtlasTextContext.cpp b/src/atlastext/SkInternalAtlasTextContext.cpp
index 1e9cbf3079..fcb4130665 100644
--- a/src/atlastext/SkInternalAtlasTextContext.cpp
+++ b/src/atlastext/SkInternalAtlasTextContext.cpp
@@ -10,7 +10,7 @@
#include "GrContextPriv.h"
#include "SkAtlasTextContext.h"
#include "SkAtlasTextRenderer.h"
-#include "text/GrGlyphCache.h"
+#include "text/GrAtlasGlyphCache.h"
SkAtlasTextRenderer* SkGetAtlasTextRendererFromInternalContext(
class SkInternalAtlasTextContext& internal) {
@@ -38,17 +38,17 @@ SkInternalAtlasTextContext::SkInternalAtlasTextContext(sk_sp<SkAtlasTextRenderer
SkInternalAtlasTextContext::~SkInternalAtlasTextContext() {
if (fDistanceFieldAtlas.fProxy) {
#ifdef SK_DEBUG
- auto restrictedAtlasManager = fGrContext->contextPriv().getRestrictedAtlasManager();
+ auto atlasGlyphCache = fGrContext->contextPriv().getAtlasGlyphCache();
unsigned int numProxies;
- restrictedAtlasManager->getProxies(kA8_GrMaskFormat, &numProxies);
+ atlasGlyphCache->getProxies(kA8_GrMaskFormat, &numProxies);
SkASSERT(1 == numProxies);
#endif
fRenderer->deleteTexture(fDistanceFieldAtlas.fTextureHandle);
}
}
-GrGlyphCache* SkInternalAtlasTextContext::glyphCache() {
- return fGrContext->contextPriv().getGlyphCache();
+GrAtlasGlyphCache* SkInternalAtlasTextContext::atlasGlyphCache() {
+ return fGrContext->contextPriv().getAtlasGlyphCache();
}
GrTextBlobCache* SkInternalAtlasTextContext::textBlobCache() {
@@ -86,11 +86,11 @@ void SkInternalAtlasTextContext::recordDraw(const void* srcVertexData, int glyph
}
void SkInternalAtlasTextContext::flush() {
- auto* restrictedAtlasManager = fGrContext->contextPriv().getRestrictedAtlasManager();
+ auto* atlasGlyphCache = fGrContext->contextPriv().getAtlasGlyphCache();
if (!fDistanceFieldAtlas.fProxy) {
unsigned int numProxies;
- fDistanceFieldAtlas.fProxy = restrictedAtlasManager->getProxies(kA8_GrMaskFormat,
- &numProxies)->get();
+ fDistanceFieldAtlas.fProxy = atlasGlyphCache->getProxies(kA8_GrMaskFormat,
+ &numProxies)->get();
SkASSERT(1 == numProxies);
fDistanceFieldAtlas.fTextureHandle =
fRenderer->createTexture(SkAtlasTextRenderer::AtlasFormat::kA8,
diff --git a/src/atlastext/SkInternalAtlasTextContext.h b/src/atlastext/SkInternalAtlasTextContext.h
index 22cda5ca51..cdba3ad8b0 100644
--- a/src/atlastext/SkInternalAtlasTextContext.h
+++ b/src/atlastext/SkInternalAtlasTextContext.h
@@ -13,8 +13,8 @@
#include "SkArenaAllocList.h"
#include "SkRefCnt.h"
+class GrAtlasGlyphCache;
class GrContext;
-class GrGlyphCache;
class GrTextBlobCache;
class SkAtlasTextRenderer;
@@ -33,7 +33,7 @@ public:
SkAtlasTextRenderer* renderer() const { return fRenderer.get(); }
GrContext* grContext() const { return fGrContext.get(); }
- GrGlyphCache* glyphCache();
+ GrAtlasGlyphCache* atlasGlyphCache();
GrTextBlobCache* textBlobCache();
const GrTokenTracker* tokenTracker() final { return &fTokenTracker; }