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

Unified Diff: src/gpu/GrTextStrike.h

Issue 780923002: Ganesh text rendering cleanup. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextStrike.h
diff --git a/src/gpu/GrTextStrike.h b/src/gpu/GrTextStrike.h
deleted file mode 100644
index 09d7323179543950840c1f937e342fcc4dc9c2f0..0000000000000000000000000000000000000000
--- a/src/gpu/GrTextStrike.h
+++ /dev/null
@@ -1,139 +0,0 @@
-
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-
-#ifndef GrTextStrike_DEFINED
-#define GrTextStrike_DEFINED
-
-#include "GrAtlas.h"
-#include "GrDrawTarget.h"
-#include "GrFontScaler.h"
-#include "GrGlyph.h"
-#include "SkTDynamicHash.h"
-#include "SkVarAlloc.h"
-
-class GrFontCache;
-class GrGpu;
-class GrFontPurgeListener;
-
-/**
- * The textstrike maps a hostfontscaler instance to a dictionary of
- * glyphid->strike
- */
-class GrTextStrike {
-public:
- GrTextStrike(GrFontCache*, const GrFontDescKey* fontScalerKey);
- ~GrTextStrike();
-
- const GrFontDescKey* getFontScalerKey() const { return fFontScalerKey; }
- GrFontCache* getFontCache() const { return fFontCache; }
-
- inline GrGlyph* getGlyph(GrGlyph::PackedID, GrFontScaler*);
- // returns true if glyph (or glyph+padding for distance field)
- // is too large to ever fit in texture atlas subregions (GrPlots)
- bool glyphTooLargeForAtlas(GrGlyph*);
- // returns true if glyph successfully added to texture atlas, false otherwise
- bool addGlyphToAtlas(GrGlyph*, GrFontScaler*);
-
- // testing
- int countGlyphs() const { return fCache.count(); }
-
- // remove any references to this plot
- void removePlot(const GrPlot* plot);
-
- static const GrFontDescKey& GetKey(const GrTextStrike& ts) {
- return *(ts.fFontScalerKey);
- }
- static uint32_t Hash(const GrFontDescKey& key) {
- return key.getHash();
- }
-
-public:
- // for easy removal from list
- GrTextStrike* fPrev;
- GrTextStrike* fNext;
-
-private:
- SkTDynamicHash<GrGlyph, GrGlyph::PackedID> fCache;
- const GrFontDescKey* fFontScalerKey;
- SkVarAlloc fPool;
-
- GrFontCache* fFontCache;
- bool fUseDistanceField;
-
- GrAtlas::ClientPlotUsage fPlotUsage;
-
- GrGlyph* generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler);
-
- friend class GrFontCache;
-};
-
-class GrFontCache {
-public:
- GrFontCache(GrGpu*);
- ~GrFontCache();
-
- inline GrTextStrike* getStrike(GrFontScaler*, bool useDistanceField);
-
- // add to texture atlas that matches this format
- GrPlot* addToAtlas(GrMaskFormat format, GrAtlas::ClientPlotUsage* usage,
- int width, int height, const void* image,
- SkIPoint16* loc);
-
- void freeAll();
-
- // make an unused plot available for this glyph
- bool freeUnusedPlot(GrTextStrike* preserveStrike, const GrGlyph* glyph);
-
- // testing
- int countStrikes() const { return fCache.count(); }
- GrTextStrike* getHeadStrike() const { return fHead; }
-
- void updateTextures() {
- for (int i = 0; i < kAtlasCount; ++i) {
- if (fAtlases[i]) {
- fAtlases[i]->uploadPlotsToTexture();
- }
- }
- }
-
-#ifdef SK_DEBUG
- void validate() const;
-#else
- void validate() const {}
-#endif
-
- void dump() const;
-
- enum AtlasType {
- kA8_AtlasType, //!< 1-byte per pixel
- k565_AtlasType, //!< 2-bytes per pixel
- k8888_AtlasType, //!< 4-bytes per pixel
-
- kLast_AtlasType = k8888_AtlasType
- };
- static const int kAtlasCount = kLast_AtlasType + 1;
-
-private:
- friend class GrFontPurgeListener;
-
- SkTDynamicHash<GrTextStrike, GrFontDescKey> fCache;
- // for LRU
- GrTextStrike* fHead;
- GrTextStrike* fTail;
-
- GrGpu* fGpu;
- GrAtlas* fAtlases[kAtlasCount];
-
- GrTextStrike* generateStrike(GrFontScaler*);
- inline void detachStrikeFromList(GrTextStrike*);
- void purgeStrike(GrTextStrike* strike);
-};
-
-#endif
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698