diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-11-03 04:00:48 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-11-03 04:00:48 +0000 |
commit | 34245c7871f6339de8cc2be8fb1090ca3cba54ef (patch) | |
tree | 4ba53bc9e263ba52d9e4fed4bf97917b6cd452bd /src | |
parent | e16a9223fd2a09fb7ba72e20c957bef99cbef4fc (diff) |
add OVerView slide to samplecode
change inline functions in SkColorPriv.h to static inline
git-svn-id: http://skia.googlecode.com/svn/trunk@415 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkGraphics.cpp | 132 | ||||
-rw-r--r-- | src/views/SkView.cpp | 14 |
2 files changed, 14 insertions, 132 deletions
diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index 98599137ea..65a16e28e7 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -146,138 +146,9 @@ static void test_drawText(SkBitmap::Config config, SkColor color) #endif -#ifdef SK_CAN_USE_FLOAT -#include "SkFloatBits.h" - -static inline float fast_inc(float x) { - SkFloatIntUnion data; - data.fFloat = x; - data.fSignBitInt += 1; - return data.fFloat; -} - -extern float dummy(); -static int time_math() { - SkMSec now; - int i; - int sum = 0; - const int repeat = 1000000; - float f; - - f = dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += (int)f; f = fast_inc(f); - sum += (int)f; f = fast_inc(f); - sum += (int)f; f = fast_inc(f); - sum += (int)f; f = fast_inc(f); - } - SkDebugf("---- native cast %d\n", SkTime::GetMSecs() - now); - - f = dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += SkFloatToIntCast(f); f = fast_inc(f); - sum += SkFloatToIntCast(f); f = fast_inc(f); - sum += SkFloatToIntCast(f); f = fast_inc(f); - sum += SkFloatToIntCast(f); f = fast_inc(f); - } - SkDebugf("---- hack cast %d\n", SkTime::GetMSecs() - now); - - f = dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += (int)sk_float_floor(f + 0.5f); f = fast_inc(f); - sum += (int)sk_float_floor(f + 0.5f); f = fast_inc(f); - sum += (int)sk_float_floor(f + 0.5f); f = fast_inc(f); - sum += (int)sk_float_floor(f + 0.5f); f = fast_inc(f); - } - SkDebugf("---- native round %d\n", SkTime::GetMSecs() - now); - - f = dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += SkFloatToIntRound(f); f = fast_inc(f); - sum += SkFloatToIntRound(f); f = fast_inc(f); - sum += SkFloatToIntRound(f); f = fast_inc(f); - sum += SkFloatToIntRound(f); f = fast_inc(f); - } - SkDebugf("---- hack round %d\n", SkTime::GetMSecs() - now); - - f = dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += SkFloat2Bits(floorf(f)); f = fast_inc(f); - sum += SkFloat2Bits(floorf(f)); f = fast_inc(f); - sum += SkFloat2Bits(floorf(f)); f = fast_inc(f); - sum += SkFloat2Bits(floorf(f)); f = fast_inc(f); - } - SkDebugf("---- native floor %d\n", SkTime::GetMSecs() - now); - - f = dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += SkFloatToIntFloor(f); f = fast_inc(f); - sum += SkFloatToIntFloor(f); f = fast_inc(f); - sum += SkFloatToIntFloor(f); f = fast_inc(f); - sum += SkFloatToIntFloor(f); f = fast_inc(f); - } - SkDebugf("---- hack floor %d\n", SkTime::GetMSecs() - now); - - return sum; -} - -#if 0 -static float time_intToFloat() { - const int repeat = 1000000; - int i, n; - SkMSec now; - float sum = 0; - - n = (int)dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += (float)n; n += 1; - sum += (float)n; n += 1; - sum += (float)n; n += 1; - sum += (float)n; n += 1; - } - SkDebugf("---- native i2f %d\n", SkTime::GetMSecs() - now); - - n = (int)dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += SkIntToFloatCast(n); n += 1; - sum += SkIntToFloatCast(n); n += 1; - sum += SkIntToFloatCast(n); n += 1; - sum += SkIntToFloatCast(n); n += 1; - } - SkDebugf("---- check i2f %d\n", SkTime::GetMSecs() - now); - - n = (int)dummy(); - now = SkTime::GetMSecs(); - for (i = repeat - 1; i >= 0; --i) { - sum += SkIntToFloatCast_NoOverflowCheck(n); n += 1; - sum += SkIntToFloatCast_NoOverflowCheck(n); n += 1; - sum += SkIntToFloatCast_NoOverflowCheck(n); n += 1; - sum += SkIntToFloatCast_NoOverflowCheck(n); n += 1; - } - SkDebugf("---- nocheck i2f %d\n", SkTime::GetMSecs() - now); - - return sum; -} -#endif -#endif - -void SkGraphics::Init() -{ +void SkGraphics::Init() { SkGlobals::Init(); -#ifdef SK_CAN_USE_FLOAT -// time_math(); -// time_intToFloat(); -#endif - #ifdef BUILD_EMBOSS_TABLE SkEmbossMask_BuildTable(); #endif @@ -503,4 +374,3 @@ bool SkGraphics::SetFontCacheUsed(size_t usageInBytes) { return SkGlyphCache::SetCacheUsed(usageInBytes); } -float dummy() { return 1.25f; } diff --git a/src/views/SkView.cpp b/src/views/SkView.cpp index f8008af306..7797abe697 100644 --- a/src/views/SkView.cpp +++ b/src/views/SkView.cpp @@ -649,7 +649,7 @@ void SkView::postInflate(const SkTDict<SkView*>& dict) SkView* SkView::sendEventToParents(const SkEvent& evt) { SkView* parent = fParent; - + while (parent) { if (parent->doEvent(evt)) @@ -659,6 +659,18 @@ SkView* SkView::sendEventToParents(const SkEvent& evt) return NULL; } +SkView* SkView::sendQueryToParents(SkEvent* evt) { + SkView* parent = fParent; + + while (parent) { + if (parent->doQuery(evt)) { + return parent; + } + parent = parent->fParent; + } + return NULL; +} + ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// |