| 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 fFallbackTextContext(NULL), |
| 17 fContext(context), fDeviceProperties(properties), fD
rawTarget(NULL) { | 17 fContext(context), fDeviceProperties(properties), fD
rawTarget(NULL) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 GrTextContext::~GrTextContext() { | 20 GrTextContext::~GrTextContext() { |
| 21 SkDELETE(fFallbackTextContext); | 21 SkDELETE(fFallbackTextContext); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void GrTextContext::init(GrRenderTarget* rt, const GrPaint& grPaint, const SkPai
nt& skPaint) { | 24 void GrTextContext::init(GrRenderTarget* rt, const GrPaint& grPaint, const SkPai
nt& skPaint) { |
| 25 const GrClipData* clipData = fContext->getClip(); | 25 fClip = fContext->getClip(); |
| 26 | 26 |
| 27 fRenderTarget.reset(SkRef(rt)); | 27 fRenderTarget.reset(SkRef(rt)); |
| 28 | 28 |
| 29 clipData->getConservativeBounds(fRenderTarget->width(), fRenderTarget->heigh
t(), &fClipRect); | 29 fClip->getConservativeBounds(fRenderTarget->width(), fRenderTarget->height()
, &fClipRect); |
| 30 | 30 |
| 31 fDrawTarget = fContext->getTextTarget(); | 31 fDrawTarget = fContext->getTextTarget(); |
| 32 | 32 |
| 33 fPaint = grPaint; | 33 fPaint = grPaint; |
| 34 fSkPaint = skPaint; | 34 fSkPaint = skPaint; |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool GrTextContext::drawText(GrRenderTarget* rt, const GrPaint& paint, const SkP
aint& skPaint, | 37 bool GrTextContext::drawText(GrRenderTarget* rt, const GrPaint& paint, const SkP
aint& skPaint, |
| 38 const SkMatrix& viewMatrix, | 38 const SkMatrix& viewMatrix, |
| 39 const char text[], size_t byteLength, | 39 const char text[], size_t byteLength, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { | 108 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
| 109 scaler = (GrFontScaler*)auxData; | 109 scaler = (GrFontScaler*)auxData; |
| 110 } | 110 } |
| 111 if (NULL == scaler) { | 111 if (NULL == scaler) { |
| 112 scaler = SkNEW_ARGS(GrFontScaler, (cache)); | 112 scaler = SkNEW_ARGS(GrFontScaler, (cache)); |
| 113 cache->setAuxProc(GlyphCacheAuxProc, scaler); | 113 cache->setAuxProc(GlyphCacheAuxProc, scaler); |
| 114 } | 114 } |
| 115 | 115 |
| 116 return scaler; | 116 return scaler; |
| 117 } | 117 } |
| OLD | NEW |