| 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 "OverView.h" | 10 #include "OverView.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class GrContext; | 46 class GrContext; |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 const struct { | 49 const struct { |
| 50 SkColorType fColorType; | 50 SkColorType fColorType; |
| 51 bool fSRGB; | 51 bool fSRGB; |
| 52 const char* fName; | 52 const char* fName; |
| 53 } gConfig[] = { | 53 } gConfig[] = { |
| 54 { kN32_SkColorType, false, "L32" }, | 54 { kN32_SkColorType, false, "L32" }, |
| 55 { kN32_SkColorType, true, "S32" }, | 55 { kN32_SkColorType, true, "S32" }, |
| 56 { kRGBA_F16_SkColorType, true, "F16" }, | 56 // { kRGBA_F16_SkColorType, true, "F16" }, |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 static const char* find_config_name(const SkImageInfo& info) { | 59 static const char* find_config_name(const SkImageInfo& info) { |
| 60 for (const auto& config : gConfig) { | 60 for (const auto& config : gConfig) { |
| 61 if (config.fColorType == info.colorType() && | 61 if (config.fColorType == info.colorType() && |
| 62 config.fSRGB == (info.colorSpace() != nullptr)) { | 62 config.fSRGB == (info.colorSpace() != nullptr)) { |
| 63 return config.fName; | 63 return config.fName; |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 return "???"; | 66 return "???"; |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 | 850 |
| 851 fSaveToPdf = false; | 851 fSaveToPdf = false; |
| 852 fSaveToSKP = false; | 852 fSaveToSKP = false; |
| 853 | 853 |
| 854 int sinkID = this->getSinkID(); | 854 int sinkID = this->getSinkID(); |
| 855 fAppMenu = new SkOSMenu; | 855 fAppMenu = new SkOSMenu; |
| 856 fAppMenu->setTitle("Global Settings"); | 856 fAppMenu->setTitle("Global Settings"); |
| 857 int itemID; | 857 int itemID; |
| 858 | 858 |
| 859 itemID = fAppMenu->appendList("ColorType", "ColorType", sinkID, 0, | 859 itemID = fAppMenu->appendList("ColorType", "ColorType", sinkID, 0, |
| 860 gConfig[0].fName, gConfig[1].fName, gConfig[2]
.fName, nullptr); | 860 gConfig[0].fName, gConfig[1].fName, nullptr); |
| 861 fAppMenu->assignKeyEquivalentToItem(itemID, 'C'); | 861 fAppMenu->assignKeyEquivalentToItem(itemID, 'C'); |
| 862 | 862 |
| 863 itemID = fAppMenu->appendList("Device Type", "Device Type", sinkID, 0, | 863 itemID = fAppMenu->appendList("Device Type", "Device Type", sinkID, 0, |
| 864 "Raster", | 864 "Raster", |
| 865 "OpenGL", | 865 "OpenGL", |
| 866 #if SK_ANGLE | 866 #if SK_ANGLE |
| 867 "ANGLE", | 867 "ANGLE", |
| 868 #endif | 868 #endif |
| 869 nullptr); | 869 nullptr); |
| 870 fAppMenu->assignKeyEquivalentToItem(itemID, 'd'); | 870 fAppMenu->assignKeyEquivalentToItem(itemID, 'd'); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 paint.setColor(0x60FF00FF); | 1052 paint.setColor(0x60FF00FF); |
| 1053 paint.setStyle(SkPaint::kStroke_Style); | 1053 paint.setStyle(SkPaint::kStroke_Style); |
| 1054 | 1054 |
| 1055 for (SkScalar y = 0; y < height(); y += tile.height()) { | 1055 for (SkScalar y = 0; y < height(); y += tile.height()) { |
| 1056 for (SkScalar x = 0; x < width(); x += tile.width()) { | 1056 for (SkScalar x = 0; x < width(); x += tile.width()) { |
| 1057 canvas->drawRect(SkRect::MakeXYWH(x, y, tile.width(), tile.heigh
t()), paint); | 1057 canvas->drawRect(SkRect::MakeXYWH(x, y, tile.width(), tile.heigh
t()), paint); |
| 1058 } | 1058 } |
| 1059 } | 1059 } |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 { |
| 1063 int count = canvas->save(); |
| 1064 canvas->resetMatrix(); |
| 1065 SkPaint p; |
| 1066 p.setTextSize(36); |
| 1067 p.setColor(0xFFFFFFFF); |
| 1068 SkPaint p2; |
| 1069 p2.setTextSize(36); |
| 1070 p2.setColor(0xFF000000); |
| 1071 if (SkImageInfoIsGammaCorrect(info())) { |
| 1072 canvas->drawText("Gamma Correct: Yes", 18, 50, 900, p); |
| 1073 canvas->drawText("Gamma Correct: Yes", 18, 50, 850, p2); |
| 1074 } else { |
| 1075 canvas->drawText("Gamma Correct: No", 17, 50, 900, p); |
| 1076 canvas->drawText("Gamma Correct: No", 17, 50, 850, p2); |
| 1077 } |
| 1078 canvas->restoreToCount(count); |
| 1079 } |
| 1080 |
| 1062 if (fShowZoomer && !fSaveToPdf) { | 1081 if (fShowZoomer && !fSaveToPdf) { |
| 1063 showZoomer(canvas); | 1082 showZoomer(canvas); |
| 1064 } | 1083 } |
| 1065 if (fMagnify && !fSaveToPdf) { | 1084 if (fMagnify && !fSaveToPdf) { |
| 1066 magnify(canvas); | 1085 magnify(canvas); |
| 1067 } | 1086 } |
| 1068 | 1087 |
| 1069 if (fMeasureFPS && fMeasureFPS_Time) { | 1088 if (fMeasureFPS && fMeasureFPS_Time) { |
| 1070 this->updateTitle(); | 1089 this->updateTitle(); |
| 1071 this->postInvalDelay(); | 1090 this->postInvalDelay(); |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 #ifdef SK_BUILD_FOR_MAC | 2288 #ifdef SK_BUILD_FOR_MAC |
| 2270 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2289 setenv("ANDROID_ROOT", "/android/device/data", 0); |
| 2271 #endif | 2290 #endif |
| 2272 SkGraphics::Init(); | 2291 SkGraphics::Init(); |
| 2273 SkEvent::Init(); | 2292 SkEvent::Init(); |
| 2274 } | 2293 } |
| 2275 | 2294 |
| 2276 void application_term() { | 2295 void application_term() { |
| 2277 SkEvent::Term(); | 2296 SkEvent::Term(); |
| 2278 } | 2297 } |
| OLD | NEW |