OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrTextContext.h" | 8 #include "GrTextContext.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 | 10 |
11 #include "SkAutoKern.h" | 11 #include "SkAutoKern.h" |
12 #include "SkGlyphCache.h" | 12 #include "SkGlyphCache.h" |
13 #include "GrFontScaler.h" | 13 #include "GrFontScaler.h" |
14 | 14 |
15 GrTextContext::GrTextContext(GrContext* context, const SkDeviceProperties& prope rties) : | 15 GrTextContext::GrTextContext(GrContext* context, const SkDeviceProperties& prope rties) : |
16 fFallbackTextContext(NULL), | |
16 fContext(context), fDeviceProperties(properties), fD rawTarget(NULL) { | 17 fContext(context), fDeviceProperties(properties), fD rawTarget(NULL) { |
17 } | 18 } |
18 | 19 |
20 GrTextContext::~GrTextContext() { | |
21 SkDELETE(fFallbackTextContext); | |
bsalomon
2014/10/13 18:46:36
Feels like GrTC should be ref counted.
jvanverth1
2014/10/13 18:54:48
I suppose, but while it's created by GrContext, it
bsalomon
2014/10/13 19:01:44
I'd say either ref count or do as you suggested. H
jvanverth1
2014/10/13 19:06:18
I'll add a factory function for each text context
| |
22 } | |
23 | |
19 void GrTextContext::init(const GrPaint& grPaint, const SkPaint& skPaint) { | 24 void GrTextContext::init(const GrPaint& grPaint, const SkPaint& skPaint) { |
20 const GrClipData* clipData = fContext->getClip(); | 25 const GrClipData* clipData = fContext->getClip(); |
21 | 26 |
22 SkRect devConservativeBound; | 27 SkRect devConservativeBound; |
23 clipData->fClipStack->getConservativeBounds( | 28 clipData->fClipStack->getConservativeBounds( |
24 -clipData->fOrigin.fX, | 29 -clipData->fOrigin.fX, |
25 -clipData->fOrigin.fY, | 30 -clipData->fOrigin.fY, |
26 fContext->getRenderTarget()->width(), | 31 fContext->getRenderTarget()->width(), |
27 fContext->getRenderTarget()->height(), | 32 fContext->getRenderTarget()->height(), |
28 &devConservativeBound); | 33 &devConservativeBound); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { | 73 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
69 scaler = (GrFontScaler*)auxData; | 74 scaler = (GrFontScaler*)auxData; |
70 } | 75 } |
71 if (NULL == scaler) { | 76 if (NULL == scaler) { |
72 scaler = SkNEW_ARGS(GrFontScaler, (cache)); | 77 scaler = SkNEW_ARGS(GrFontScaler, (cache)); |
73 cache->setAuxProc(GlyphCacheAuxProc, scaler); | 78 cache->setAuxProc(GlyphCacheAuxProc, scaler); |
74 } | 79 } |
75 | 80 |
76 return scaler; | 81 return scaler; |
77 } | 82 } |
OLD | NEW |