aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2012-11-18 15:50:36 -0800
committerSteve Kondik <shade@chemlab.org>2012-11-18 15:50:36 -0800
commit93df05afa45a51715db60aa88cc6ea11f232b3ea (patch)
tree3f7b5f443c89bf7529636d2df3c13c49171513e2
parent497936662ca50b84592e6147016e4c058976f1c5 (diff)
downloadexternal_skia-93df05afa45a51715db60aa88cc6ea11f232b3ea.zip
external_skia-93df05afa45a51715db60aa88cc6ea11f232b3ea.tar.gz
external_skia-93df05afa45a51715db60aa88cc6ea11f232b3ea.tar.bz2
Revert "skia: Several tunings"
This reverts commit 6ab870723b749ffd632fecd648704d80b581fcf0.
-rw-r--r--Android.mk4
-rw-r--r--include/core/SkDraw.h2
-rw-r--r--include/core/SkPaint.h27
-rw-r--r--include/core/SkRect.h11
-rw-r--r--src/core/SkDraw.cpp18
-rw-r--r--src/core/SkPaint.cpp114
6 files changed, 12 insertions, 164 deletions
diff --git a/Android.mk b/Android.mk
index 9250d69..f9b38f8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -322,10 +322,6 @@ LOCAL_STATIC_LIBRARIES := \
libwebp-decode \
libwebp-encode
-ifeq ($(TARGET_USE_KRAIT_BIONIC_OPTIMIZATION),true)
- LOCAL_CFLAGS += -DKRAIT_OPTIMIZATION
-endif
-
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/include/core \
diff --git a/include/core/SkDraw.h b/include/core/SkDraw.h
index ae323f2..8c659c2 100644
--- a/include/core/SkDraw.h
+++ b/include/core/SkDraw.h
@@ -104,8 +104,6 @@ private:
void drawBitmapAsMask(const SkBitmap&, const SkPaint&) const;
public:
- //Be noted to update SkDraw::SkDraw() constructor code when struture is
- //change!
const SkBitmap* fBitmap; // required
const SkMatrix* fMatrix; // required
const SkRegion* fClip; // DEPRECATED
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 76ec7fc..30ff663 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -15,8 +15,6 @@
#include "SkXfermode.h"
#include "SkString.h"
-#include <pthread.h>
-
class SkAutoGlyphCache;
class SkColorFilter;
class SkDescriptor;
@@ -39,25 +37,6 @@ typedef const SkGlyph& (*SkDrawCacheProc)(SkGlyphCache*, const char**,
typedef const SkGlyph& (*SkMeasureCacheProc)(SkGlyphCache*, const char**);
-class SkTextLocale {
- public:
- SkTextLocale();
-
- SkString s;
- SkTextLocale *next;
-};
-
-class SkTextLocales {
-public:
- SkTextLocales();
- SkTextLocale * setTextLocale( const SkString& locale );
- SkString& getTextLocale( SkTextLocale * t );
-
-private:
- SkTextLocale * LocaleArray;
- pthread_mutex_t update_mutex;
-};
-
/** \class SkPaint
The SkPaint class holds the style and color information about how to draw
@@ -680,7 +659,7 @@ public:
/** Return the paint's text locale value.
@return the paint's text locale value used for drawing text.
*/
- const SkString& getTextLocale();
+ const SkString& getTextLocale() const { return fTextLocale; }
/** Set the paint's text locale.
@param locale set the paint's locale value for drawing text.
@@ -901,8 +880,6 @@ public:
bool nothingToDraw() const;
private:
- //Be noted to update SkPaint::SkPaint(const SkPaint& src) copy
- //constructor when struture is changed for fast path!
SkTypeface* fTypeface;
SkScalar fTextSize;
SkScalar fTextScaleX;
@@ -928,7 +905,7 @@ private:
unsigned fTextEncoding : 2; // 3 values
unsigned fHinting : 2;
#ifdef SK_BUILD_FOR_ANDROID
- SkTextLocale* fpTextLocale;
+ SkString fTextLocale;
#endif
SkDrawCacheProc getDrawCacheProc() const;
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 64568c9..65e7611 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -347,16 +347,6 @@ struct SK_API SkRect {
*/
bool isFinite() const {
#ifdef SK_SCALAR_IS_FLOAT
-#if defined(KRAIT_OPTIMIZATION)
- if (SkScalarIsFinite(fBottom) &&
- SkScalarIsFinite(fRight) &&
- SkScalarIsFinite(fLeft) &&
- SkScalarIsFinite(fTop)) {
- return true;
- } else {
- return false;
- }
-#else
// x * 0 will be NaN iff x is infinity or NaN.
// a + b will be NaN iff either a or b is NaN.
float value = fLeft * 0 + fTop * 0 + fRight * 0 + fBottom * 0;
@@ -364,7 +354,6 @@ struct SK_API SkRect {
// value is either NaN or it is finite (zero).
// value==value will be true iff value is not NaN
return value == value;
-#endif
#else
// use bit-or for speed, since we don't care about short-circuting the
// tests, and we expect the common case will be that we need to check all.
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
///////////////////////////////////////////////////////////////////////////////