Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: src/gpu/GrTextBlobCache.cpp

Issue 1521453002: Move all text stuff to its own folder (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext11textutils2
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrTextBlobCache.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextBlobCache.cpp
diff --git a/src/gpu/GrTextBlobCache.cpp b/src/gpu/GrTextBlobCache.cpp
deleted file mode 100644
index f11b7c60cbd88d62857863e27847d9132c8219a8..0000000000000000000000000000000000000000
--- a/src/gpu/GrTextBlobCache.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrTextBlobCache.h"
-
-static const int kVerticesPerGlyph = 4;
-
-GrTextBlobCache::~GrTextBlobCache() {
- this->freeAll();
-}
-
-GrAtlasTextBlob* GrTextBlobCache::createBlob(int glyphCount, int runCount, size_t maxVASize) {
- // We allocate size for the GrAtlasTextBlob itself, plus size for the vertices array,
- // and size for the glyphIds array.
- size_t verticesCount = glyphCount * kVerticesPerGlyph * maxVASize;
- size_t size = sizeof(GrAtlasTextBlob) +
- verticesCount +
- glyphCount * sizeof(GrGlyph**) +
- sizeof(GrAtlasTextBlob::Run) * runCount;
-
- void* allocation = fPool.allocate(size);
-#ifdef CACHE_SANITY_CHECK
- sk_bzero(allocation, size);
-#endif
-
- GrAtlasTextBlob* cacheBlob = new (allocation) GrAtlasTextBlob;
-#ifdef CACHE_SANITY_CHECK
- cacheBlob->fSize = size;
-#endif
-
- // setup offsets for vertices / glyphs
- cacheBlob->fVertices = sizeof(GrAtlasTextBlob) + reinterpret_cast<unsigned char*>(cacheBlob);
- cacheBlob->fGlyphs = reinterpret_cast<GrGlyph**>(cacheBlob->fVertices + verticesCount);
- cacheBlob->fRuns = reinterpret_cast<GrAtlasTextBlob::Run*>(cacheBlob->fGlyphs + glyphCount);
-
- // Initialize runs
- for (int i = 0; i < runCount; i++) {
- new (&cacheBlob->fRuns[i]) GrAtlasTextBlob::Run;
- }
- cacheBlob->fRunCount = runCount;
- cacheBlob->fPool = &fPool;
- return cacheBlob;
-}
-
-void GrTextBlobCache::freeAll() {
- SkTDynamicHash<GrAtlasTextBlob, GrAtlasTextBlob::Key>::Iter iter(&fCache);
- while (!iter.done()) {
- GrAtlasTextBlob* blob = &(*iter);
- fBlobList.remove(blob);
- blob->unref();
- ++iter;
- }
- fCache.rewind();
-}
« no previous file with comments | « src/gpu/GrTextBlobCache.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698