am df64ac68: ask skia to use flat gamma when rendering fonts from hwui

* commit 'df64ac688d400c74438db091952d236fffd5f778':
  ask skia to use flat gamma when rendering fonts from hwui
This commit is contained in:
Victoria Lease
2014-04-22 22:57:29 +00:00
committed by Android Git Automerger
2 changed files with 6 additions and 2 deletions

View File

@@ -42,6 +42,7 @@ namespace uirenderer {
Font::Font(FontRenderer* state, const Font::FontDescription& desc) : Font::Font(FontRenderer* state, const Font::FontDescription& desc) :
mState(state), mDescription(desc) { mState(state), mDescription(desc) {
mDeviceProperties = SkDeviceProperties::Make(SkDeviceProperties::Geometry::MakeDefault(), 1.0f);
} }
Font::FontDescription::FontDescription(const SkPaint* paint, const mat4& matrix) { Font::FontDescription::FontDescription(const SkPaint* paint, const mat4& matrix) {
@@ -272,7 +273,7 @@ CachedGlyphInfo* Font::getCachedGlyph(SkPaint* paint, glyph_t textUnit, bool pre
if (cachedGlyph) { if (cachedGlyph) {
// Is the glyph still in texture cache? // Is the glyph still in texture cache?
if (!cachedGlyph->mIsValid) { if (!cachedGlyph->mIsValid) {
SkAutoGlyphCache autoCache(*paint, NULL, &mDescription.mLookupTransform); SkAutoGlyphCache autoCache(*paint, &mDeviceProperties, &mDescription.mLookupTransform);
const SkGlyph& skiaGlyph = GET_METRICS(autoCache.getCache(), textUnit); const SkGlyph& skiaGlyph = GET_METRICS(autoCache.getCache(), textUnit);
updateGlyphCache(paint, skiaGlyph, autoCache.getCache(), cachedGlyph, precaching); updateGlyphCache(paint, skiaGlyph, autoCache.getCache(), cachedGlyph, precaching);
} }
@@ -464,7 +465,7 @@ CachedGlyphInfo* Font::cacheGlyph(SkPaint* paint, glyph_t glyph, bool precaching
CachedGlyphInfo* newGlyph = new CachedGlyphInfo(); CachedGlyphInfo* newGlyph = new CachedGlyphInfo();
mCachedGlyphs.add(glyph, newGlyph); mCachedGlyphs.add(glyph, newGlyph);
SkAutoGlyphCache autoCache(*paint, NULL, &mDescription.mLookupTransform); SkAutoGlyphCache autoCache(*paint, &mDeviceProperties, &mDescription.mLookupTransform);
const SkGlyph& skiaGlyph = GET_METRICS(autoCache.getCache(), glyph); const SkGlyph& skiaGlyph = GET_METRICS(autoCache.getCache(), glyph);
newGlyph->mIsValid = false; newGlyph->mIsValid = false;
newGlyph->mGlyphIndex = skiaGlyph.fID; newGlyph->mGlyphIndex = skiaGlyph.fID;

View File

@@ -19,6 +19,8 @@
#include <utils/KeyedVector.h> #include <utils/KeyedVector.h>
#include <SkScalar.h>
#include <SkDeviceProperties.h>
#include <SkGlyphCache.h> #include <SkGlyphCache.h>
#include <SkScalerContext.h> #include <SkScalerContext.h>
#include <SkPaint.h> #include <SkPaint.h>
@@ -145,6 +147,7 @@ private:
DefaultKeyedVector<glyph_t, CachedGlyphInfo*> mCachedGlyphs; DefaultKeyedVector<glyph_t, CachedGlyphInfo*> mCachedGlyphs;
bool mIdentityTransform; bool mIdentityTransform;
SkDeviceProperties mDeviceProperties;
}; };
inline int strictly_order_type(const Font::FontDescription& lhs, inline int strictly_order_type(const Font::FontDescription& lhs,