| Index: src/core/SkPaint.cpp
|
| diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
|
| index f3bf01bfafc5ca30e0507190a8ffee37f8a5efaa..c77ab8a876ca15a610306528cf9691d139e61102 100644
|
| --- a/src/core/SkPaint.cpp
|
| +++ b/src/core/SkPaint.cpp
|
| @@ -1773,7 +1773,7 @@ static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma
|
| /**
|
| * We ensure that the rec is self-consistent and efficient (where possible)
|
| */
|
| -void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) {
|
| +void SkScalerContext::PostMakeRec(const SkPaint& paint, SkScalerContext::Rec* rec) {
|
| /**
|
| * If we're asking for A8, we force the colorlum to be gray, since that
|
| * limits the number of unique entries, and the scaler will only look at
|
| @@ -1809,6 +1809,23 @@ void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) {
|
| rec->ignorePreBlend();
|
| break;
|
| }
|
| +
|
| + /**
|
| + * If we're using distance fields we need to reset the rec to default values
|
| + */
|
| + if (paint.isDistanceFieldTextTEMP()) {
|
| + rec->ignorePreBlend();
|
| +
|
| + rec->fFlags |= SkScalerContext::kSubpixelPositioning_Flag;
|
| + rec->fFlags &= ~SkScalerContext::kForceAutohinting_Flag;
|
| +
|
| + if (SkMask::kLCD16_Format == rec->fMaskFormat ||
|
| + SkMask::kLCD32_Format == rec->fMaskFormat) {
|
| + rec->fMaskFormat = SkMask::kA8_Format;
|
| + }
|
| + rec->setHinting(SkPaint::kNo_Hinting);
|
| + }
|
| +
|
| }
|
|
|
| #define MIN_SIZE_FOR_EFFECT_BUFFER 1024
|
| @@ -1974,6 +1991,33 @@ SkMaskGamma::PreBlend SkScalerContext::GetMaskPreBlend(const SkScalerContext::Re
|
| return maskGamma.preBlend(rec.getLuminanceColor());
|
| }
|
|
|
| +size_t SkScalerContext::getGammaLUTSize(SkScalar contrast, SkScalar paintGamma,
|
| + SkScalar deviceGamma, int* width, int* height) {
|
| + SkAutoMutexAcquire ama(gMaskGammaCacheMutex);
|
| + const SkMaskGamma& maskGamma = cachedMaskGamma(contrast,
|
| + paintGamma,
|
| + deviceGamma);
|
| +
|
| + maskGamma.getGammaTableDimensions(width, height);
|
| + size_t size = (*width)*(*height)*sizeof(uint8_t);
|
| +
|
| + return size;
|
| +}
|
| +
|
| +void SkScalerContext::getGammaLUTData(SkScalar contrast, SkScalar paintGamma, SkScalar deviceGamma,
|
| + void* data) {
|
| + SkAutoMutexAcquire ama(gMaskGammaCacheMutex);
|
| + const SkMaskGamma& maskGamma = cachedMaskGamma(contrast,
|
| + paintGamma,
|
| + deviceGamma);
|
| + int width, height;
|
| + maskGamma.getGammaTableDimensions(&width, &height);
|
| + size_t size = width*height*sizeof(uint8_t);
|
| + const uint8_t* gammaTables = maskGamma.getGammaTables();
|
| + memcpy(data, gammaTables, size);
|
| +}
|
| +
|
| +
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| #include "SkStream.h"
|
|
|