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

Unified Diff: include/gpu/GrTextContext.h

Issue 145023006: Revert of Add factory class for generating various flavors of GrTextContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 11 months 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 | « include/gpu/GrDistanceFieldTextContext.h ('k') | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTextContext.h
diff --git a/include/gpu/GrTextContext.h b/include/gpu/GrTextContext.h
index 3c61cbc80e25821405ba9dddb29135ae314c3f76..b367cf228d57fd5c0103cbb77332bc7b7a0dd4ae 100644
--- a/include/gpu/GrTextContext.h
+++ b/include/gpu/GrTextContext.h
@@ -12,8 +12,6 @@
#include "GrGlyph.h"
#include "GrPaint.h"
-#include "SkPostConfig.h"
-
class GrContext;
class GrDrawTarget;
class GrFontScaler;
@@ -23,88 +21,20 @@
*/
class GrTextContext {
public:
- virtual ~GrTextContext() {}
virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
GrFontScaler*) = 0;
protected:
- GrTextContext(GrContext*, const GrPaint&, const SkPaint&);
+ GrTextContext(GrContext*, const GrPaint&);
+ virtual ~GrTextContext() {}
GrPaint fPaint;
- SkPaint fSkPaint;
GrContext* fContext;
GrDrawTarget* fDrawTarget;
SkIRect fClipRect;
-};
-
-/*
- * These classes wrap the creation of a single text context for a given GPU device. The
- * assumption is that we'll only be using one text context at a time for that device.
- */
-class GrTextContextManager {
-public:
- virtual ~GrTextContextManager() {}
- virtual GrTextContext* create(GrContext* context, const GrPaint& grPaint,
- const SkPaint& skPaint) = 0;
-};
-
-template <class TextContextClass>
-class GrTTextContextManager : public GrTextContextManager {
-private:
- class ManagedTextContext : public TextContextClass {
- public:
- ~ManagedTextContext() {}
-
- ManagedTextContext(GrContext* context,
- const GrPaint& grPaint,
- const SkPaint& skPaint,
- GrTTextContextManager<TextContextClass>* manager) :
- TextContextClass(context, grPaint, skPaint) {
- fManager = manager;
- }
-
- static void operator delete(void* ptr) {
- if (ptr == NULL) {
- return;
- }
- ManagedTextContext* context = reinterpret_cast<ManagedTextContext*>(ptr);
- context->fManager->recycle(context);
- }
-
- GrTTextContextManager<TextContextClass>* fManager;
- };
-
-public:
- GrTTextContextManager() {
- fAllocation = sk_malloc_throw(sizeof(ManagedTextContext));
- fUsed = false;
- }
-
- ~GrTTextContextManager() {
- SkASSERT(!fUsed);
- sk_free(fAllocation);
- }
-
- GrTextContext* create(GrContext* context, const GrPaint& grPaint,
- const SkPaint& skPaint) {
- // add check for usePath here?
- SkASSERT(!fUsed);
- ManagedTextContext* obj = SkNEW_PLACEMENT_ARGS(fAllocation, ManagedTextContext,
- (context, grPaint, skPaint, this));
- fUsed = true;
- return obj;
- }
private:
- void recycle(GrTextContext* textContext) {
- SkASSERT((void*)textContext == fAllocation);
- SkASSERT(fUsed);
- fUsed = false;
- }
-
- void* fAllocation;
- bool fUsed;
};
#endif
« no previous file with comments | « include/gpu/GrDistanceFieldTextContext.h ('k') | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698