diff options
author | Derek Sollenberger <djsollen@google.com> | 2011-01-07 13:32:14 -0500 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2011-02-23 14:59:05 -0500 |
commit | 40528743dbb9ce7f39f093e0cdc47849ac8887cf (patch) | |
tree | 9f27d91d1210746846b76e2ab85a82258243fe1f /bench | |
parent | dd3f189dfde60f95f6be0517f1c28ad2879973a1 (diff) | |
download | external_skia-40528743dbb9ce7f39f093e0cdc47849ac8887cf.zip external_skia-40528743dbb9ce7f39f093e0cdc47849ac8887cf.tar.gz external_skia-40528743dbb9ce7f39f093e0cdc47849ac8887cf.tar.bz2 |
Skia Merge (revision 808)
This merge has companion changes in the following projects in order
to be compatible with changes to skia interfaces and practices:
1. /frameworks/base
2. /external/webkit
Change-Id: I54092971305579e81a8fdb27bbe04ec340792e3b
Diffstat (limited to 'bench')
-rw-r--r-- | bench/Android.mk | 8 | ||||
-rw-r--r-- | bench/BenchTool/BenchTool.xcodeproj/project.pbxproj | 324 | ||||
-rw-r--r-- | bench/RectBench.cpp | 9 | ||||
-rw-r--r-- | bench/TextBench.cpp | 50 | ||||
-rw-r--r-- | bench/benchmain.cpp | 5 |
5 files changed, 370 insertions, 26 deletions
diff --git a/bench/Android.mk b/bench/Android.mk index 03c3e79..b20aef9 100644 --- a/bench/Android.mk +++ b/bench/Android.mk @@ -4,8 +4,8 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ BitmapBench.cpp \ - DecodeBench.cpp \ - FPSBench.cpp \ + DecodeBench.cpp \ + FPSBench.cpp \ RectBench.cpp \ RepeatTileBench.cpp \ TextBench.cpp \ @@ -23,7 +23,9 @@ LOCAL_C_INCLUDES := \ external/skia/include/core \ external/skia/include/images \ external/skia/include/utils \ - external/skia/include/effects + external/skia/include/effects \ + external/skia/gpu/include \ + external/skia/include/gpu #LOCAL_CFLAGS := diff --git a/bench/BenchTool/BenchTool.xcodeproj/project.pbxproj b/bench/BenchTool/BenchTool.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b637494 --- /dev/null +++ b/bench/BenchTool/BenchTool.xcodeproj/project.pbxproj @@ -0,0 +1,324 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 272FB43A0F11A19C00CA935D /* RectBench.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 272FB4390F11A19C00CA935D /* RectBench.cpp */; }; + 272FB4F30F11B40300CA935D /* SkBenchmark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 272FB4F20F11B40300CA935D /* SkBenchmark.cpp */; }; + 2752A08A0F14CE1300BBDC03 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2752A0890F14CE1300BBDC03 /* main.cpp */; }; + 27739F4D0F11439200F233EA /* libmaccore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27739F240F11404A00F233EA /* libmaccore.a */; }; + 27739F4E0F11439300F233EA /* libcore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27739F1A0F11403B00F233EA /* libcore.a */; }; + 27739F520F1143C000F233EA /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27739F510F1143C000F233EA /* Carbon.framework */; }; + 8DD76F6A0486A84900D96B5E /* BenchTool.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* BenchTool.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 27739F190F11403B00F233EA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 27739F120F11403B00F233EA /* core.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D2AAC046055464E500DB518D; + remoteInfo = core; + }; + 27739F230F11404A00F233EA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 27739F1C0F11404A00F233EA /* maccore.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D2AAC046055464E500DB518D; + remoteInfo = maccore; + }; + 27739F3C0F11424800F233EA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 27739F1C0F11404A00F233EA /* maccore.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = D2AAC045055464E500DB518D; + remoteInfo = maccore; + }; + 27739F3E0F11424C00F233EA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 27739F120F11403B00F233EA /* core.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = D2AAC045055464E500DB518D; + remoteInfo = core; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F690486A84900D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F6A0486A84900D96B5E /* BenchTool.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 272FB4390F11A19C00CA935D /* RectBench.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RectBench.cpp; path = ../RectBench.cpp; sourceTree = SOURCE_ROOT; }; + 272FB4F20F11B40300CA935D /* SkBenchmark.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SkBenchmark.cpp; path = ../SkBenchmark.cpp; sourceTree = SOURCE_ROOT; }; + 2752A0890F14CE1300BBDC03 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../main.cpp; sourceTree = SOURCE_ROOT; }; + 27739F120F11403B00F233EA /* core.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = core.xcodeproj; path = ../../xcode/core/core.xcodeproj; sourceTree = SOURCE_ROOT; }; + 27739F1C0F11404A00F233EA /* maccore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = maccore.xcodeproj; path = ../../xcode/maccore/maccore.xcodeproj; sourceTree = SOURCE_ROOT; }; + 27739F510F1143C000F233EA /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; + 8DD76F6C0486A84900D96B5E /* BenchTool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BenchTool; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859E8B029090EE04C91782 /* BenchTool.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = BenchTool.1; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F660486A84900D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 27739F4D0F11439200F233EA /* libmaccore.a in Frameworks */, + 27739F4E0F11439300F233EA /* libcore.a in Frameworks */, + 27739F520F1143C000F233EA /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* BenchTool */ = { + isa = PBXGroup; + children = ( + 27739F510F1143C000F233EA /* Carbon.framework */, + 27739F1C0F11404A00F233EA /* maccore.xcodeproj */, + 27739F120F11403B00F233EA /* core.xcodeproj */, + 08FB7795FE84155DC02AAC07 /* Source */, + C6859E8C029090F304C91782 /* Documentation */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = BenchTool; + sourceTree = "<group>"; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 2752A0890F14CE1300BBDC03 /* main.cpp */, + 272FB4F20F11B40300CA935D /* SkBenchmark.cpp */, + 272FB4390F11A19C00CA935D /* RectBench.cpp */, + ); + name = Source; + sourceTree = "<group>"; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E /* BenchTool */, + ); + name = Products; + sourceTree = "<group>"; + }; + 27739F130F11403B00F233EA /* Products */ = { + isa = PBXGroup; + children = ( + 27739F1A0F11403B00F233EA /* libcore.a */, + ); + name = Products; + sourceTree = "<group>"; + }; + 27739F1D0F11404A00F233EA /* Products */ = { + isa = PBXGroup; + children = ( + 27739F240F11404A00F233EA /* libmaccore.a */, + ); + name = Products; + sourceTree = "<group>"; + }; + C6859E8C029090F304C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859E8B029090EE04C91782 /* BenchTool.1 */, + ); + name = Documentation; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F620486A84900D96B5E /* BenchTool */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "BenchTool" */; + buildPhases = ( + 8DD76F640486A84900D96B5E /* Sources */, + 8DD76F660486A84900D96B5E /* Frameworks */, + 8DD76F690486A84900D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 27739F3D0F11424800F233EA /* PBXTargetDependency */, + 27739F3F0F11424C00F233EA /* PBXTargetDependency */, + ); + name = BenchTool; + productInstallPath = "$(HOME)/bin"; + productName = BenchTool; + productReference = 8DD76F6C0486A84900D96B5E /* BenchTool */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "BenchTool" */; + compatibilityVersion = "Xcode 3.1"; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07 /* BenchTool */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 27739F130F11403B00F233EA /* Products */; + ProjectRef = 27739F120F11403B00F233EA /* core.xcodeproj */; + }, + { + ProductGroup = 27739F1D0F11404A00F233EA /* Products */; + ProjectRef = 27739F1C0F11404A00F233EA /* maccore.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 8DD76F620486A84900D96B5E /* BenchTool */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 27739F1A0F11403B00F233EA /* libcore.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcore.a; + remoteRef = 27739F190F11403B00F233EA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 27739F240F11404A00F233EA /* libmaccore.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libmaccore.a; + remoteRef = 27739F230F11404A00F233EA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F640486A84900D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 272FB43A0F11A19C00CA935D /* RectBench.cpp in Sources */, + 272FB4F30F11B40300CA935D /* SkBenchmark.cpp in Sources */, + 2752A08A0F14CE1300BBDC03 /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 27739F3D0F11424800F233EA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = maccore; + targetProxy = 27739F3C0F11424800F233EA /* PBXContainerItemProxy */; + }; + 27739F3F0F11424C00F233EA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = core; + targetProxy = 27739F3E0F11424C00F233EA /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1DEB923208733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "_GLIBCXX_DEBUG=1", + "_GLIBCXX_DEBUG_PEDANTIC=1", + ); + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = BenchTool; + }; + name = Debug; + }; + 1DEB923308733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = BenchTool; + }; + name = Release; + }; + 1DEB923608733DC60010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_THREADSAFE_STATICS = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + SDKROOT = macosx10.5; + USER_HEADER_SEARCH_PATHS = ".. ../../include/**"; + }; + name = Debug; + }; + 1DEB923708733DC60010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_THREADSAFE_STATICS = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = macosx10.5; + USER_HEADER_SEARCH_PATHS = ".. ../../include/**"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "BenchTool" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923208733DC60010E9CD /* Debug */, + 1DEB923308733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "BenchTool" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB923608733DC60010E9CD /* Debug */, + 1DEB923708733DC60010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/bench/RectBench.cpp b/bench/RectBench.cpp index 3874bb3..0c3eb56 100644 --- a/bench/RectBench.cpp +++ b/bench/RectBench.cpp @@ -31,14 +31,14 @@ public: fColors[i] = rand.nextU() | 0xFF808080; } } - + SkString fName; const char* computeName(const char root[]) { fName.set(root); fName.appendS32(fShift); return fName.c_str(); } - + protected: virtual void drawThisRect(SkCanvas* c, const SkRect& r, const SkPaint& p) { c->drawRect(r, p); @@ -82,7 +82,7 @@ public: SkCanvas::PointMode fMode; const char* fName; - PointsBench(void* param, SkCanvas::PointMode mode, const char* name) : + PointsBench(void* param, SkCanvas::PointMode mode, const char* name) : RectBench(param, 2), fMode(mode) { fName = name; } @@ -105,8 +105,7 @@ protected: for (size_t i = 0; i < sizes; i++) { paint.setStrokeWidth(gSizes[i]); this->setupPaint(&paint); - canvas->drawPoints(fMode, N * 2, - reinterpret_cast<const SkPoint*>(fRects), paint); + canvas->drawPoints(fMode, N * 2, SkTCast<SkPoint*>(fRects), paint); paint.setColor(fColors[i]); } } diff --git a/bench/TextBench.cpp b/bench/TextBench.cpp index 5caaddb..f2b9604 100644 --- a/bench/TextBench.cpp +++ b/bench/TextBench.cpp @@ -22,15 +22,16 @@ class TextBench : public SkBenchmark { SkPoint* fPos; SkString fText; SkString fName; - enum { N = 300 }; + enum { N = 600 }; public: TextBench(void* param, const char text[], int ps, bool linearText, - bool posText) : INHERITED(param) { + bool posText, SkColor color = SK_ColorBLACK) : INHERITED(param) { fText.set(text); fPaint.setAntiAlias(true); fPaint.setTextSize(SkIntToScalar(ps)); fPaint.setLinearText(linearText); + fPaint.setColor(color); if (posText) { SkAutoTArray<SkScalar> storage(fText.size()); @@ -47,7 +48,7 @@ public: fPos = NULL; } } - + virtual ~TextBench() { delete[] fPos; } @@ -61,6 +62,10 @@ protected: if (fPos) { fName.append("_pos"); } + + if (SK_ColorBLACK != fPaint.getColor()) { + fName.appendf("_%02X", fPaint.getAlpha()); + } return fName.c_str(); } @@ -70,24 +75,21 @@ protected: SkPaint paint(fPaint); this->setupPaint(&paint); + paint.setColor(fPaint.getColor()); // need our specified color const SkScalar x0 = SkIntToScalar(-10); const SkScalar y0 = SkIntToScalar(-10); - const SkColor colors[] = { SK_ColorBLACK, SK_ColorGRAY }; - - for (size_t j = 0; j < SK_ARRAY_COUNT(colors); j++) { - paint.setColor(colors[j]); - for (int i = 0; i < N; i++) { - SkScalar x = x0 + rand.nextUScalar1() * dim.fX; - SkScalar y = y0 + rand.nextUScalar1() * dim.fY; - if (fPos) { - canvas->save(SkCanvas::kMatrix_SaveFlag); - canvas->translate(x, y); - canvas->drawPosText(fText.c_str(), fText.size(), fPos, paint); - canvas->restore(); - } else { - canvas->drawText(fText.c_str(), fText.size(), x, y, paint); - } + + for (int i = 0; i < N; i++) { + SkScalar x = x0 + rand.nextUScalar1() * dim.fX; + SkScalar y = y0 + rand.nextUScalar1() * dim.fY; + if (fPos) { + canvas->save(SkCanvas::kMatrix_SaveFlag); + canvas->translate(x, y); + canvas->drawPosText(fText.c_str(), fText.size(), fPos, paint); + canvas->restore(); + } else { + canvas->drawText(fText.c_str(), fText.size(), x, y, paint); } } } @@ -103,19 +105,31 @@ private: #define BIG 48 static SkBenchmark* Fact0(void* p) { return new TextBench(p, STR, SMALL, false, false); } +static SkBenchmark* Fact01(void* p) { return new TextBench(p, STR, SMALL, false, false, 0xFFFF0000); } +static SkBenchmark* Fact02(void* p) { return new TextBench(p, STR, SMALL, false, false, 0x88FF0000); } + static SkBenchmark* Fact1(void* p) { return new TextBench(p, STR, SMALL, false, true); } static SkBenchmark* Fact2(void* p) { return new TextBench(p, STR, SMALL, true, false); } static SkBenchmark* Fact3(void* p) { return new TextBench(p, STR, SMALL, true, true); } + static SkBenchmark* Fact4(void* p) { return new TextBench(p, STR, BIG, false, false); } +static SkBenchmark* Fact41(void* p) { return new TextBench(p, STR, BIG, false, false, 0xFFFF0000); } +static SkBenchmark* Fact42(void* p) { return new TextBench(p, STR, BIG, false, false, 0x88FF0000); } + static SkBenchmark* Fact5(void* p) { return new TextBench(p, STR, BIG, false, true); } static SkBenchmark* Fact6(void* p) { return new TextBench(p, STR, BIG, true, false); } static SkBenchmark* Fact7(void* p) { return new TextBench(p, STR, BIG, true, true); } static BenchRegistry gReg0(Fact0); +static BenchRegistry gReg01(Fact01); +static BenchRegistry gReg02(Fact02); static BenchRegistry gReg1(Fact1); static BenchRegistry gReg2(Fact2); static BenchRegistry gReg3(Fact3); static BenchRegistry gReg4(Fact4); +static BenchRegistry gReg41(Fact41); +static BenchRegistry gReg42(Fact42); static BenchRegistry gReg5(Fact5); static BenchRegistry gReg6(Fact6); static BenchRegistry gReg7(Fact7); + diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp index 2f8b006..3b6dfdf 100644 --- a/bench/benchmain.cpp +++ b/bench/benchmain.cpp @@ -368,6 +368,11 @@ int main (int argc, char * const argv[]) { performRotate(&canvas, dim.fX, dim.fY); } + if (repeatDraw > 1) { + SkAutoCanvasRestore acr(&canvas, true); + bench->draw(&canvas); + } + SkMSec now = SkTime::GetMSecs(); for (int i = 0; i < repeatDraw; i++) { SkCanvas* c = &canvas; |