diff options
author | Steve Kondik <shade@chemlab.org> | 2012-11-18 15:50:36 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2012-11-18 15:50:36 -0800 |
commit | 93df05afa45a51715db60aa88cc6ea11f232b3ea (patch) | |
tree | 3f7b5f443c89bf7529636d2df3c13c49171513e2 /src | |
parent | 497936662ca50b84592e6147016e4c058976f1c5 (diff) | |
download | external_skia-93df05afa45a51715db60aa88cc6ea11f232b3ea.zip external_skia-93df05afa45a51715db60aa88cc6ea11f232b3ea.tar.gz external_skia-93df05afa45a51715db60aa88cc6ea11f232b3ea.tar.bz2 |
Revert "skia: Several tunings"
This reverts commit 6ab870723b749ffd632fecd648704d80b581fcf0.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkDraw.cpp | 18 | ||||
-rw-r--r-- | src/core/SkPaint.cpp | 114 |
2 files changed, 10 insertions, 122 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 19337f7..23a6d59 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -114,23 +114,7 @@ private: /////////////////////////////////////////////////////////////////////////////// SkDraw::SkDraw() { - //Be noted to update this field when struture is changed! - if( sizeof(*this) == 40 ){ - fBitmap = NULL; - fMatrix = NULL; - fClip = NULL; - fRC = NULL; - - fClipStack = NULL; - fDevice = NULL; - fBounder = NULL; - fProcs = NULL; - - fMVMatrix = NULL; - fExtMatrix = NULL; - } else { - sk_bzero(this, sizeof(*this)); - } + sk_bzero(this, sizeof(*this)); } SkDraw::SkDraw(const SkDraw& src) { diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index ce5cfe4..e1932a7 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -27,75 +27,6 @@ #include "SkGlyphCache.h" #include "SkPaintDefaults.h" -#include <pthread.h> - -SkTextLocale::SkTextLocale(){ - new(&s) SkString(); - next = NULL; -} - -static class SkTextLocales gTextLocales; - -SkTextLocales::SkTextLocales(){ - LocaleArray = NULL; - update_mutex = PTHREAD_MUTEX_INITIALIZER; -} - -SkTextLocale * SkTextLocales::setTextLocale( const SkString& locale ){ -start: - if( !LocaleArray ){ - pthread_mutex_lock( &update_mutex ); - if( !LocaleArray ){ - LocaleArray = new SkTextLocale(); - LocaleArray->s = locale; - pthread_mutex_unlock( &update_mutex ); - return LocaleArray; - } else { - pthread_mutex_unlock( &update_mutex ); - goto start; - } - - } - - SkTextLocale * l = LocaleArray; - SkTextLocale * prev = LocaleArray; - while( l ){ - if( l->s == locale ){ - return l; - } - prev = l; - l = l->next; - } - - pthread_mutex_lock( &update_mutex ); - - SkDebugf("new locale %s", locale.c_str()); - //Within mutex, restart from beginning - l = LocaleArray; - prev = LocaleArray; - while( l ){ - if( l->s == locale ){ - pthread_mutex_unlock( &update_mutex ); - return l; - } - prev = l; - l = l->next; - } - l = new SkTextLocale(); - prev->next = l; - l->s = locale; - - pthread_mutex_unlock( &update_mutex ); - - return l; -} - - -SkString& SkTextLocales::getTextLocale( SkTextLocale * t ){ - return t->s; -} - - // define this to get a printf for out-of-range parameter in setters // e.g. setTextSize(-1) //#define SK_REPORT_API_RANGE_CHECK @@ -140,40 +71,13 @@ SkPaint::SkPaint() { fTextEncoding = kUTF8_TextEncoding; fHinting = SkPaintDefaults_Hinting; #ifdef SK_BUILD_FOR_ANDROID + new(&fTextLocale) SkString(); fGenerationID = 0; #endif } -extern "C" { - //Hard coded copy with size of 72 bytes. This will avoid the extra cost - //of size checking branching in generic memcpy code - inline void memcpy_72(int* src, int* dst) { - __asm__ volatile ("cpy r4, %1 \n" - "cpy r5, %0 \n" - "ldm r4!, {r0-r3} \n" - "cpy r12, r5 \n" - "stm r12!,{r0-r3} \n" - "ldm r4!, {r0-r3} \n" - "stm r12!,{r0-r3} \n" - "ldm r4!, {r0-r3} \n" - "stm r12!,{r0-r3} \n" - "ldm r4!, {r0-r3} \n" - "stm r12!,{r0-r3} \n" - "ldm r4, {r0-r1} \n" - "stm r12, {r0-r1} \n" - : - : "r" (src), "r" (dst) - : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r12"); - } -} - SkPaint::SkPaint(const SkPaint& src) { - //Be noted to update this field when struture is changed! - if(sizeof(src) == 72){ - memcpy_72((int*)this, (int*)&src); - } else { - memcpy((int*)this, (int*)&src, sizeof(src)); - } + memcpy(this, &src, sizeof(src)); SkSafeRef(fTypeface); SkSafeRef(fPathEffect); @@ -184,6 +88,9 @@ SkPaint::SkPaint(const SkPaint& src) { SkSafeRef(fRasterizer); SkSafeRef(fLooper); SkSafeRef(fImageFilter); +#ifdef SK_BUILD_FOR_ANDROID + new(&fTextLocale) SkString(src.fTextLocale); +#endif } SkPaint::~SkPaint() { @@ -222,10 +129,12 @@ SkPaint& SkPaint::operator=(const SkPaint& src) { SkSafeUnref(fImageFilter); #ifdef SK_BUILD_FOR_ANDROID + fTextLocale.~SkString(); uint32_t oldGenerationID = fGenerationID; #endif memcpy(this, &src, sizeof(src)); #ifdef SK_BUILD_FOR_ANDROID + new(&fTextLocale) SkString(src.fTextLocale); fGenerationID = oldGenerationID + 1; #endif @@ -458,16 +367,11 @@ void SkPaint::setTextEncoding(TextEncoding encoding) { #ifdef SK_BUILD_FOR_ANDROID void SkPaint::setTextLocale(const SkString& locale) { - SkTextLocale* oldpTextLocale = fpTextLocale; - fpTextLocale = gTextLocales.setTextLocale(locale); - if (oldpTextLocale != fpTextLocale) { + if(!fTextLocale.equals(locale)) { + fTextLocale.set(locale); GEN_ID_INC; } } - -const SkString& SkPaint::getTextLocale(){ - return fpTextLocale->s; -} #endif /////////////////////////////////////////////////////////////////////////////// |