| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SampleApp.h" | 8 #include "SampleApp.h" |
| 9 | 9 |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 #include "SkOSFile.h" | 38 #include "SkOSFile.h" |
| 39 #include "SkPDFDevice.h" | 39 #include "SkPDFDevice.h" |
| 40 #include "SkPDFDocument.h" | 40 #include "SkPDFDocument.h" |
| 41 #include "SkStream.h" | 41 #include "SkStream.h" |
| 42 | 42 |
| 43 #include "SkGPipe.h" | 43 #include "SkGPipe.h" |
| 44 #include "SamplePipeControllers.h" | 44 #include "SamplePipeControllers.h" |
| 45 #include "OverView.h" | 45 #include "OverView.h" |
| 46 #include "TransitionView.h" | 46 #include "TransitionView.h" |
| 47 #include "sk_tool_utils.h" |
| 47 | 48 |
| 48 extern SampleView* CreateSamplePictFileView(const char filename[]); | 49 extern SampleView* CreateSamplePictFileView(const char filename[]); |
| 49 | 50 |
| 50 class PictFileFactory : public SkViewFactory { | 51 class PictFileFactory : public SkViewFactory { |
| 51 SkString fFilename; | 52 SkString fFilename; |
| 52 public: | 53 public: |
| 53 PictFileFactory(const SkString& filename) : fFilename(filename) {} | 54 PictFileFactory(const SkString& filename) : fFilename(filename) {} |
| 54 virtual SkView* operator() () const SK_OVERRIDE { | 55 virtual SkView* operator() () const SK_OVERRIDE { |
| 55 return CreateSamplePictFileView(fFilename.c_str()); | 56 return CreateSamplePictFileView(fFilename.c_str()); |
| 56 } | 57 } |
| (...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 (void)SampleView::SetUsePipe(view, fPipeState); | 2076 (void)SampleView::SetUsePipe(view, fPipeState); |
| 2076 if (SampleView::IsSampleView(view)) { | 2077 if (SampleView::IsSampleView(view)) { |
| 2077 SampleView* sampleView = (SampleView*)view; | 2078 SampleView* sampleView = (SampleView*)view; |
| 2078 sampleView->requestMenu(fSlideMenu); | 2079 sampleView->requestMenu(fSlideMenu); |
| 2079 sampleView->onTileSizeChanged(this->tileSize()); | 2080 sampleView->onTileSizeChanged(this->tileSize()); |
| 2080 } | 2081 } |
| 2081 this->onUpdateMenu(fSlideMenu); | 2082 this->onUpdateMenu(fSlideMenu); |
| 2082 this->updateTitle(); | 2083 this->updateTitle(); |
| 2083 } | 2084 } |
| 2084 | 2085 |
| 2085 static const char* gConfigNames[] = { | |
| 2086 "unknown config", | |
| 2087 "A8", | |
| 2088 "Index8", | |
| 2089 "565", | |
| 2090 "4444", | |
| 2091 "8888" | |
| 2092 }; | |
| 2093 | |
| 2094 static const char* configToString(SkBitmap::Config c) { | |
| 2095 return gConfigNames[c]; | |
| 2096 } | |
| 2097 | |
| 2098 static const char* gDeviceTypePrefix[] = { | 2086 static const char* gDeviceTypePrefix[] = { |
| 2099 "raster: ", | 2087 "raster: ", |
| 2100 "picture: ", | 2088 "picture: ", |
| 2101 #if SK_SUPPORT_GPU | 2089 #if SK_SUPPORT_GPU |
| 2102 "opengl: ", | 2090 "opengl: ", |
| 2103 #if SK_ANGLE | 2091 #if SK_ANGLE |
| 2104 "angle: ", | 2092 "angle: ", |
| 2105 #endif // SK_ANGLE | 2093 #endif // SK_ANGLE |
| 2106 "null-gl: " | 2094 "null-gl: " |
| 2107 #endif // SK_SUPPORT_GPU | 2095 #endif // SK_SUPPORT_GPU |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2123 SkView* view = curr_view(this); | 2111 SkView* view = curr_view(this); |
| 2124 | 2112 |
| 2125 SkString title; | 2113 SkString title; |
| 2126 if (!curr_title(this, &title)) { | 2114 if (!curr_title(this, &title)) { |
| 2127 title.set("<unknown>"); | 2115 title.set("<unknown>"); |
| 2128 } | 2116 } |
| 2129 | 2117 |
| 2130 title.prepend(gDeviceTypePrefix[fDeviceType]); | 2118 title.prepend(gDeviceTypePrefix[fDeviceType]); |
| 2131 | 2119 |
| 2132 title.prepend(" "); | 2120 title.prepend(" "); |
| 2133 title.prepend(configToString(this->getBitmap().config())); | 2121 title.prepend(sk_tool_utils::colortype_name(this->getBitmap().colorType())); |
| 2134 | 2122 |
| 2135 if (fTilingMode != kNo_Tiling) { | 2123 if (fTilingMode != kNo_Tiling) { |
| 2136 title.prependf("<T: %s> ", gTilingInfo[fTilingMode].label); | 2124 title.prependf("<T: %s> ", gTilingInfo[fTilingMode].label); |
| 2137 } | 2125 } |
| 2138 if (fAnimating) { | 2126 if (fAnimating) { |
| 2139 title.prepend("<A> "); | 2127 title.prepend("<A> "); |
| 2140 } | 2128 } |
| 2141 if (fRotate) { | 2129 if (fRotate) { |
| 2142 title.prepend("<R> "); | 2130 title.prepend("<R> "); |
| 2143 } | 2131 } |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2526 SkGraphics::Init(); | 2514 SkGraphics::Init(); |
| 2527 SkEvent::Init(); | 2515 SkEvent::Init(); |
| 2528 } | 2516 } |
| 2529 | 2517 |
| 2530 // FIXME: this should be in a header | 2518 // FIXME: this should be in a header |
| 2531 void application_term(); | 2519 void application_term(); |
| 2532 void application_term() { | 2520 void application_term() { |
| 2533 SkEvent::Term(); | 2521 SkEvent::Term(); |
| 2534 SkGraphics::Term(); | 2522 SkGraphics::Term(); |
| 2535 } | 2523 } |
| OLD | NEW |