Merge "Modifications needed for updating Skia to r9286."

This commit is contained in:
Derek Sollenberger
2013-05-30 12:06:46 +00:00
committed by Android (Google) Code Review
4 changed files with 21 additions and 21 deletions

View File

@@ -17,6 +17,10 @@ endif
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
# When built as part of the system image we can enable certian non-NDK compliant
# Skia optimizations.
LOCAL_CFLAGS += -DSK_BUILD_FOR_ANDROID_FRAMEWORK
LOCAL_SRC_FILES:= \
AndroidRuntime.cpp \
Time.cpp \
@@ -159,10 +163,6 @@ LOCAL_C_INCLUDES += \
$(call include-path-for, libhardware)/hardware \
$(call include-path-for, libhardware_legacy)/hardware_legacy \
$(TOP)/frameworks/av/include \
external/skia/include/core \
external/skia/include/effects \
external/skia/include/images \
external/skia/include/ports \
external/skia/src/core \
external/skia/src/images \
external/skia/include/utils \

View File

@@ -58,6 +58,10 @@ static JMetricsID gFontMetricsInt_fieldID;
static void defaultSettingsForAndroid(SkPaint* paint) {
// GlyphID encoding is required because we are using Harfbuzz shaping
paint->setTextEncoding(SkPaint::kGlyphID_TextEncoding);
SkPaintOptionsAndroid paintOpts = paint->getPaintOptionsAndroid();
paintOpts.setUseFontFallbacks(true);
paint->setPaintOptionsAndroid(paintOpts);
}
class SkPaintGlue {
@@ -300,7 +304,10 @@ public:
ScopedUtfChars localeChars(env, locale);
char langTag[ULOC_FULLNAME_CAPACITY];
toLanguageTag(langTag, ULOC_FULLNAME_CAPACITY, localeChars.c_str());
obj->setLanguage(SkLanguage(langTag));
SkPaintOptionsAndroid paintOpts = obj->getPaintOptionsAndroid();
paintOpts.setLanguage(langTag);
obj->setPaintOptionsAndroid(paintOpts);
}
static jfloat getTextSize(JNIEnv* env, jobject paint) {

View File

@@ -218,7 +218,8 @@ void TextLayoutCache::dumpCacheStats() {
*/
TextLayoutCacheKey::TextLayoutCacheKey(): start(0), count(0), contextCount(0),
dirFlags(0), typeface(NULL), textSize(0), textSkewX(0), textScaleX(0), flags(0),
hinting(SkPaint::kNo_Hinting), variant(SkPaint::kDefault_Variant), language() {
hinting(SkPaint::kNo_Hinting) {
paintOpts.setUseFontFallbacks(true);
}
TextLayoutCacheKey::TextLayoutCacheKey(const SkPaint* paint, const UChar* text,
@@ -232,8 +233,7 @@ TextLayoutCacheKey::TextLayoutCacheKey(const SkPaint* paint, const UChar* text,
textScaleX = paint->getTextScaleX();
flags = paint->getFlags();
hinting = paint->getHinting();
variant = paint->getFontVariant();
language = paint->getLanguage();
paintOpts = paint->getPaintOptionsAndroid();
}
TextLayoutCacheKey::TextLayoutCacheKey(const TextLayoutCacheKey& other) :
@@ -248,8 +248,7 @@ TextLayoutCacheKey::TextLayoutCacheKey(const TextLayoutCacheKey& other) :
textScaleX(other.textScaleX),
flags(other.flags),
hinting(other.hinting),
variant(other.variant),
language(other.language) {
paintOpts(other.paintOpts) {
}
int TextLayoutCacheKey::compare(const TextLayoutCacheKey& lhs, const TextLayoutCacheKey& rhs) {
@@ -283,11 +282,8 @@ int TextLayoutCacheKey::compare(const TextLayoutCacheKey& lhs, const TextLayoutC
deltaInt = lhs.dirFlags - rhs.dirFlags;
if (deltaInt) return (deltaInt);
deltaInt = lhs.variant - rhs.variant;
if (deltaInt) return (deltaInt);
if (lhs.language < rhs.language) return -1;
if (lhs.language > rhs.language) return +1;
if (lhs.paintOpts != rhs.paintOpts)
return memcmp(&lhs.paintOpts, &rhs.paintOpts, sizeof(SkPaintOptionsAndroid));
return memcmp(lhs.getText(), rhs.getText(), lhs.contextCount * sizeof(UChar));
}
@@ -306,7 +302,7 @@ hash_t TextLayoutCacheKey::hash() const {
hash = JenkinsHashMix(hash, hash_type(textScaleX));
hash = JenkinsHashMix(hash, flags);
hash = JenkinsHashMix(hash, hinting);
hash = JenkinsHashMix(hash, variant);
hash = JenkinsHashMix(hash, paintOpts.getFontVariant());
// Note: leaving out language is not problematic, as equality comparisons
// are still valid - the only bad thing that could happen is collisions.
hash = JenkinsHashMixShorts(hash, getText(), contextCount);
@@ -698,8 +694,7 @@ void TextLayoutShaper::computeRunValues(const SkPaint* paint, const UChar* conte
mShapingPaint.setTextScaleX(paint->getTextScaleX());
mShapingPaint.setFlags(paint->getFlags());
mShapingPaint.setHinting(paint->getHinting());
mShapingPaint.setFontVariant(paint->getFontVariant());
mShapingPaint.setLanguage(paint->getLanguage());
mShapingPaint.setPaintOptionsAndroid(paint->getPaintOptionsAndroid());
// Split the BiDi run into Script runs. Harfbuzz will populate the pos, length and script
// into the shaperItem

View File

@@ -28,7 +28,6 @@
#include <utils/Singleton.h>
#include <SkAutoKern.h>
#include <SkLanguage.h>
#include <SkPaint.h>
#include <SkTemplates.h>
#include <SkTypeface.h>
@@ -104,8 +103,7 @@ private:
SkScalar textScaleX;
uint32_t flags;
SkPaint::Hinting hinting;
SkPaint::FontVariant variant;
SkLanguage language;
SkPaintOptionsAndroid paintOpts;
}; // TextLayoutCacheKey