Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Side by Side Diff: samplecode/SampleApp.cpp

Issue 1893313006: Add control of the sRGB global hack flag in SampleApp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "Resources.h" 11 #include "Resources.h"
12 #include "SampleCode.h" 12 #include "SampleCode.h"
13 #include "SkAnimTimer.h" 13 #include "SkAnimTimer.h"
14 #include "SkCanvas.h" 14 #include "SkCanvas.h"
15 #include "SkCommandLineFlags.h" 15 #include "SkCommandLineFlags.h"
16 #include "SkData.h" 16 #include "SkData.h"
17 #include "SkDevice.h" 17 #include "SkDevice.h"
18 #include "SkDocument.h" 18 #include "SkDocument.h"
19 #include "SkGraphics.h" 19 #include "SkGraphics.h"
20 #include "SkImageEncoder.h" 20 #include "SkImageEncoder.h"
21 #include "SkOSFile.h" 21 #include "SkOSFile.h"
22 #include "SkPaint.h" 22 #include "SkPaint.h"
23 #include "SkPaintFilterCanvas.h" 23 #include "SkPaintFilterCanvas.h"
24 #include "SkPicture.h" 24 #include "SkPicture.h"
25 #include "SkPictureRecorder.h" 25 #include "SkPictureRecorder.h"
26 #include "SkPM4fPriv.h"
26 #include "SkStream.h" 27 #include "SkStream.h"
27 #include "SkSurface.h" 28 #include "SkSurface.h"
28 #include "SkTemplates.h" 29 #include "SkTemplates.h"
29 #include "SkTSort.h" 30 #include "SkTSort.h"
30 #include "SkTime.h" 31 #include "SkTime.h"
31 #include "SkTypeface.h" 32 #include "SkTypeface.h"
32 #include "SkWindow.h" 33 #include "SkWindow.h"
33 #include "sk_tool_utils.h" 34 #include "sk_tool_utils.h"
34 35
35 #if SK_SUPPORT_GPU 36 #if SK_SUPPORT_GPU
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 fSaveToSKP = false; 929 fSaveToSKP = false;
929 930
930 int sinkID = this->getSinkID(); 931 int sinkID = this->getSinkID();
931 fAppMenu = new SkOSMenu; 932 fAppMenu = new SkOSMenu;
932 fAppMenu->setTitle("Global Settings"); 933 fAppMenu->setTitle("Global Settings");
933 int itemID; 934 int itemID;
934 935
935 itemID = fAppMenu->appendList("ColorType", "ColorType", sinkID, 0, 936 itemID = fAppMenu->appendList("ColorType", "ColorType", sinkID, 0,
936 gConfig[0].fName, gConfig[1].fName, gConfig[2] .fName, nullptr); 937 gConfig[0].fName, gConfig[1].fName, gConfig[2] .fName, nullptr);
937 fAppMenu->assignKeyEquivalentToItem(itemID, 'C'); 938 fAppMenu->assignKeyEquivalentToItem(itemID, 'C');
939 itemID = fAppMenu->appendSwitch("sRGB SkColor", "sRGB SkColor", sinkID, gTre atSkColorAsSRGB);
940 fAppMenu->assignKeyEquivalentToItem(itemID, 'S');
938 941
939 itemID = fAppMenu->appendList("Device Type", "Device Type", sinkID, 0, 942 itemID = fAppMenu->appendList("Device Type", "Device Type", sinkID, 0,
940 "Raster", 943 "Raster",
941 "OpenGL", 944 "OpenGL",
942 #if SK_ANGLE 945 #if SK_ANGLE
943 "ANGLE", 946 "ANGLE",
944 #endif 947 #endif
945 #if SK_COMMAND_BUFFER 948 #if SK_COMMAND_BUFFER
946 "Command Buffer", 949 "Command Buffer",
947 #endif 950 #endif
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 this->toggleSlideshow(); 1646 this->toggleSlideshow();
1644 return true; 1647 return true;
1645 } 1648 }
1646 if (SkOSMenu::FindTriState(evt, "AA", &fAAState) || 1649 if (SkOSMenu::FindTriState(evt, "AA", &fAAState) ||
1647 SkOSMenu::FindTriState(evt, "LCD", &fLCDState) || 1650 SkOSMenu::FindTriState(evt, "LCD", &fLCDState) ||
1648 SkOSMenu::FindListIndex(evt, "FilterQuality", &fFilterQualityIndex) || 1651 SkOSMenu::FindListIndex(evt, "FilterQuality", &fFilterQualityIndex) ||
1649 SkOSMenu::FindTriState(evt, "Subpixel", &fSubpixelState) || 1652 SkOSMenu::FindTriState(evt, "Subpixel", &fSubpixelState) ||
1650 SkOSMenu::FindListIndex(evt, "Hinting", &fHintingState) || 1653 SkOSMenu::FindListIndex(evt, "Hinting", &fHintingState) ||
1651 SkOSMenu::FindSwitchState(evt, "Clip", &fUseClip) || 1654 SkOSMenu::FindSwitchState(evt, "Clip", &fUseClip) ||
1652 SkOSMenu::FindSwitchState(evt, "Zoomer", &fShowZoomer) || 1655 SkOSMenu::FindSwitchState(evt, "Zoomer", &fShowZoomer) ||
1653 SkOSMenu::FindSwitchState(evt, "Magnify", &fMagnify)) 1656 SkOSMenu::FindSwitchState(evt, "Magnify", &fMagnify) ||
1657 SkOSMenu::FindSwitchState(evt, "sRGB SkColor", &gTreatSkColorAsSRGB))
1654 { 1658 {
1655 this->inval(nullptr); 1659 this->inval(nullptr);
1656 this->updateTitle(); 1660 this->updateTitle();
1657 return true; 1661 return true;
1658 } 1662 }
1659 if (SkOSMenu::FindListIndex(evt, "Pixel Geometry", &fPixelGeometryIndex)) { 1663 if (SkOSMenu::FindListIndex(evt, "Pixel Geometry", &fPixelGeometryIndex)) {
1660 this->setPixelGeometry(fPixelGeometryIndex); 1664 this->setPixelGeometry(fPixelGeometryIndex);
1661 return true; 1665 return true;
1662 } 1666 }
1663 if (SkOSMenu::FindListIndex(evt, "Tiling", &fTilingMode)) { 1667 if (SkOSMenu::FindListIndex(evt, "Tiling", &fTilingMode)) {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 fDevManager && 2156 fDevManager &&
2153 fDevManager->getGrRenderTarget() && 2157 fDevManager->getGrRenderTarget() &&
2154 fDevManager->getGrRenderTarget()->numColorSamples() > 0) { 2158 fDevManager->getGrRenderTarget()->numColorSamples() > 0) {
2155 title.appendf(" [MSAA: %d]", 2159 title.appendf(" [MSAA: %d]",
2156 fDevManager->getGrRenderTarget()->numColorSamples()); 2160 fDevManager->getGrRenderTarget()->numColorSamples());
2157 } 2161 }
2158 #endif 2162 #endif
2159 2163
2160 title.appendf(" %s", find_config_name(this->info())); 2164 title.appendf(" %s", find_config_name(this->info()));
2161 2165
2166 if (gTreatSkColorAsSRGB) {
2167 title.append(" sRGB");
2168 }
2169
2162 this->setTitle(title.c_str()); 2170 this->setTitle(title.c_str());
2163 } 2171 }
2164 2172
2165 void SampleWindow::onSizeChange() { 2173 void SampleWindow::onSizeChange() {
2166 this->INHERITED::onSizeChange(); 2174 this->INHERITED::onSizeChange();
2167 2175
2168 SkView::F2BIter iter(this); 2176 SkView::F2BIter iter(this);
2169 SkView* view = iter.next(); 2177 SkView* view = iter.next();
2170 view->setSize(this->width(), this->height()); 2178 view->setSize(this->width(), this->height());
2171 2179
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 #ifdef SK_BUILD_FOR_MAC 2402 #ifdef SK_BUILD_FOR_MAC
2395 setenv("ANDROID_ROOT", "/android/device/data", 0); 2403 setenv("ANDROID_ROOT", "/android/device/data", 0);
2396 #endif 2404 #endif
2397 SkGraphics::Init(); 2405 SkGraphics::Init();
2398 SkEvent::Init(); 2406 SkEvent::Init();
2399 } 2407 }
2400 2408
2401 void application_term() { 2409 void application_term() {
2402 SkEvent::Term(); 2410 SkEvent::Term();
2403 } 2411 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698