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 30 matching lines...) Expand all Loading... |
41 # include "SkGr.h" | 41 # include "SkGr.h" |
42 # if SK_ANGLE | 42 # if SK_ANGLE |
43 # include "gl/angle/GLTestContext_angle.h" | 43 # include "gl/angle/GLTestContext_angle.h" |
44 # endif | 44 # endif |
45 #else | 45 #else |
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 SkColorProfileType fProfileType; |
52 const char* fName; | 52 const char* fName; |
53 } gConfig[] = { | 53 } gConfig[] = { |
54 { kN32_SkColorType, false, "L32" }, | 54 { kN32_SkColorType, kLinear_SkColorProfileType, "L32" }, |
55 { kN32_SkColorType, true, "S32" }, | 55 { kN32_SkColorType, kSRGB_SkColorProfileType, "S32" }, |
56 { kRGBA_F16_SkColorType, false, "F16" }, | 56 { kRGBA_F16_SkColorType, kLinear_SkColorProfileType, "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() && config.fProfileType == info
.profileType()) { |
62 config.fSRGB == (info.colorSpace() != nullptr)) { | |
63 return config.fName; | 62 return config.fName; |
64 } | 63 } |
65 } | 64 } |
66 return "???"; | 65 return "???"; |
67 } | 66 } |
68 | 67 |
69 // Should be 3x + 1 | 68 // Should be 3x + 1 |
70 #define kMaxFatBitsScale 28 | 69 #define kMaxFatBitsScale 28 |
71 | 70 |
72 extern SampleView* CreateSamplePictFileView(const char filename[]); | 71 extern SampleView* CreateSamplePictFileView(const char filename[]); |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 if (isInvalEvent(evt)) { | 1628 if (isInvalEvent(evt)) { |
1630 this->inval(nullptr); | 1629 this->inval(nullptr); |
1631 return true; | 1630 return true; |
1632 } | 1631 } |
1633 int selected = -1; | 1632 int selected = -1; |
1634 if (SkOSMenu::FindListIndex(evt, "Device Type", &selected)) { | 1633 if (SkOSMenu::FindListIndex(evt, "Device Type", &selected)) { |
1635 this->setDeviceType((DeviceType)selected); | 1634 this->setDeviceType((DeviceType)selected); |
1636 return true; | 1635 return true; |
1637 } | 1636 } |
1638 if (SkOSMenu::FindListIndex(evt, "ColorType", &selected)) { | 1637 if (SkOSMenu::FindListIndex(evt, "ColorType", &selected)) { |
1639 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 1638 this->setDeviceColorType(gConfig[selected].fColorType, gConfig[selected]
.fProfileType); |
1640 this->setDeviceColorType(gConfig[selected].fColorType, | |
1641 gConfig[selected].fSRGB ? srgbColorSpace : null
ptr); | |
1642 return true; | 1639 return true; |
1643 } | 1640 } |
1644 if (SkOSMenu::FindSwitchState(evt, "Slide Show", nullptr)) { | 1641 if (SkOSMenu::FindSwitchState(evt, "Slide Show", nullptr)) { |
1645 this->toggleSlideshow(); | 1642 this->toggleSlideshow(); |
1646 return true; | 1643 return true; |
1647 } | 1644 } |
1648 if (SkOSMenu::FindTriState(evt, "AA", &fAAState) || | 1645 if (SkOSMenu::FindTriState(evt, "AA", &fAAState) || |
1649 SkOSMenu::FindTriState(evt, "LCD", &fLCDState) || | 1646 SkOSMenu::FindTriState(evt, "LCD", &fLCDState) || |
1650 SkOSMenu::FindListIndex(evt, "FilterQuality", &fFilterQualityIndex) || | 1647 SkOSMenu::FindListIndex(evt, "FilterQuality", &fFilterQualityIndex) || |
1651 SkOSMenu::FindTriState(evt, "Subpixel", &fSubpixelState) || | 1648 SkOSMenu::FindTriState(evt, "Subpixel", &fSubpixelState) || |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 return; | 1843 return; |
1847 | 1844 |
1848 fDevManager->tearDownBackend(this); | 1845 fDevManager->tearDownBackend(this); |
1849 fDeviceType = type; | 1846 fDeviceType = type; |
1850 fDevManager->setUpBackend(this, fMSAASampleCount, fDeepColor); | 1847 fDevManager->setUpBackend(this, fMSAASampleCount, fDeepColor); |
1851 | 1848 |
1852 this->updateTitle(); | 1849 this->updateTitle(); |
1853 this->inval(nullptr); | 1850 this->inval(nullptr); |
1854 } | 1851 } |
1855 | 1852 |
1856 void SampleWindow::setDeviceColorType(SkColorType ct, sk_sp<SkColorSpace> cs) { | 1853 void SampleWindow::setDeviceColorType(SkColorType ct, SkColorProfileType pt) { |
1857 this->setColorType(ct, std::move(cs)); | 1854 this->setColorType(ct, pt); |
1858 | 1855 |
1859 fDevManager->tearDownBackend(this); | 1856 fDevManager->tearDownBackend(this); |
1860 fDevManager->setUpBackend(this, fMSAASampleCount, fDeepColor); | 1857 fDevManager->setUpBackend(this, fMSAASampleCount, fDeepColor); |
1861 | 1858 |
1862 this->updateTitle(); | 1859 this->updateTitle(); |
1863 this->inval(nullptr); | 1860 this->inval(nullptr); |
1864 } | 1861 } |
1865 | 1862 |
1866 void SampleWindow::toggleSlideshow() { | 1863 void SampleWindow::toggleSlideshow() { |
1867 fAnimating = !fAnimating; | 1864 fAnimating = !fAnimating; |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2402 #ifdef SK_BUILD_FOR_MAC | 2399 #ifdef SK_BUILD_FOR_MAC |
2403 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2400 setenv("ANDROID_ROOT", "/android/device/data", 0); |
2404 #endif | 2401 #endif |
2405 SkGraphics::Init(); | 2402 SkGraphics::Init(); |
2406 SkEvent::Init(); | 2403 SkEvent::Init(); |
2407 } | 2404 } |
2408 | 2405 |
2409 void application_term() { | 2406 void application_term() { |
2410 SkEvent::Term(); | 2407 SkEvent::Term(); |
2411 } | 2408 } |
OLD | NEW |