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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 1919993002: Added --deepColor option to SampleApp, triggers creation of a ten-bit/channel buffer on Windows. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More cleanup Created 4 years, 7 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
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 "SkDocument.h" 17 #include "SkDocument.h"
18 #include "SkGraphics.h" 18 #include "SkGraphics.h"
19 #include "SkImage_Base.h"
19 #include "SkImageEncoder.h" 20 #include "SkImageEncoder.h"
20 #include "SkOSFile.h" 21 #include "SkOSFile.h"
21 #include "SkPaint.h" 22 #include "SkPaint.h"
22 #include "SkPaintFilterCanvas.h" 23 #include "SkPaintFilterCanvas.h"
23 #include "SkPicture.h" 24 #include "SkPicture.h"
24 #include "SkPictureRecorder.h" 25 #include "SkPictureRecorder.h"
25 #include "SkPM4fPriv.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"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 class SampleWindow::DefaultDeviceManager : public SampleWindow::DeviceManager { 173 class SampleWindow::DefaultDeviceManager : public SampleWindow::DeviceManager {
173 public: 174 public:
174 175
175 DefaultDeviceManager() { 176 DefaultDeviceManager() {
176 #if SK_SUPPORT_GPU 177 #if SK_SUPPORT_GPU
177 fCurContext = nullptr; 178 fCurContext = nullptr;
178 fCurIntf = nullptr; 179 fCurIntf = nullptr;
179 fCurRenderTarget = nullptr; 180 fCurRenderTarget = nullptr;
180 fMSAASampleCount = 0; 181 fMSAASampleCount = 0;
182 fTenBitColor = false;
181 #endif 183 #endif
182 fBackend = kNone_BackEndType; 184 fBackend = kNone_BackEndType;
183 } 185 }
184 186
185 virtual ~DefaultDeviceManager() { 187 virtual ~DefaultDeviceManager() {
186 #if SK_SUPPORT_GPU 188 #if SK_SUPPORT_GPU
187 SkSafeUnref(fCurContext); 189 SkSafeUnref(fCurContext);
188 SkSafeUnref(fCurIntf); 190 SkSafeUnref(fCurIntf);
189 SkSafeUnref(fCurRenderTarget); 191 SkSafeUnref(fCurRenderTarget);
190 #endif 192 #endif
191 } 193 }
192 194
193 void setUpBackend(SampleWindow* win, int msaaSampleCount) override { 195 void setUpBackend(SampleWindow* win, int msaaSampleCount, bool tenBitColor) override {
194 SkASSERT(kNone_BackEndType == fBackend); 196 SkASSERT(kNone_BackEndType == fBackend);
195 197
196 fBackend = kNone_BackEndType; 198 fBackend = kNone_BackEndType;
197 199
198 #if SK_SUPPORT_GPU 200 #if SK_SUPPORT_GPU
199 switch (win->getDeviceType()) { 201 switch (win->getDeviceType()) {
200 case kRaster_DeviceType: // fallthrough 202 case kRaster_DeviceType: // fallthrough
201 case kGPU_DeviceType: 203 case kGPU_DeviceType:
202 // all these guys use the native backend 204 // all these guys use the native backend
203 fBackend = kNativeGL_BackEndType; 205 fBackend = kNativeGL_BackEndType;
204 break; 206 break;
205 #if SK_ANGLE 207 #if SK_ANGLE
206 case kANGLE_DeviceType: 208 case kANGLE_DeviceType:
207 // ANGLE is really the only odd man out 209 // ANGLE is really the only odd man out
208 fBackend = kANGLE_BackEndType; 210 fBackend = kANGLE_BackEndType;
209 break; 211 break;
210 #endif // SK_ANGLE 212 #endif // SK_ANGLE
211 #if SK_COMMAND_BUFFER 213 #if SK_COMMAND_BUFFER
212 case kCommandBuffer_DeviceType: 214 case kCommandBuffer_DeviceType:
213 // Command buffer is really the only other odd man out :D 215 // Command buffer is really the only other odd man out :D
214 fBackend = kCommandBuffer_BackEndType; 216 fBackend = kCommandBuffer_BackEndType;
215 break; 217 break;
216 #endif // SK_COMMAND_BUFFER 218 #endif // SK_COMMAND_BUFFER
217 default: 219 default:
218 SkASSERT(false); 220 SkASSERT(false);
219 break; 221 break;
220 } 222 }
221 AttachmentInfo attachmentInfo; 223 AttachmentInfo attachmentInfo;
222 bool result = win->attach(fBackend, msaaSampleCount, &attachmentInfo); 224 bool result = win->attach(fBackend, msaaSampleCount, tenBitColor, &attac hmentInfo);
223 if (!result) { 225 if (!result) {
224 SkDebugf("Failed to initialize GL"); 226 SkDebugf("Failed to initialize GL");
225 return; 227 return;
226 } 228 }
227 fMSAASampleCount = msaaSampleCount; 229 fMSAASampleCount = msaaSampleCount;
230 fTenBitColor = tenBitColor;
228 231
229 SkASSERT(nullptr == fCurIntf); 232 SkASSERT(nullptr == fCurIntf);
230 SkAutoTUnref<const GrGLInterface> glInterface; 233 SkAutoTUnref<const GrGLInterface> glInterface;
231 switch (win->getDeviceType()) { 234 switch (win->getDeviceType()) {
232 case kRaster_DeviceType: // fallthrough 235 case kRaster_DeviceType: // fallthrough
233 case kGPU_DeviceType: 236 case kGPU_DeviceType:
234 // all these guys use the native interface 237 // all these guys use the native interface
235 glInterface.reset(GrGLCreateNativeInterface()); 238 glInterface.reset(GrGLCreateNativeInterface());
236 break; 239 break;
237 #if SK_ANGLE 240 #if SK_ANGLE
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 fCurRenderTarget = nullptr; 290 fCurRenderTarget = nullptr;
288 #endif 291 #endif
289 win->release(); 292 win->release();
290 fBackend = kNone_BackEndType; 293 fBackend = kNone_BackEndType;
291 } 294 }
292 295
293 SkSurface* createSurface(SampleWindow::DeviceType dType, SampleWindow* win) override { 296 SkSurface* createSurface(SampleWindow::DeviceType dType, SampleWindow* win) override {
294 #if SK_SUPPORT_GPU 297 #if SK_SUPPORT_GPU
295 if (IsGpuDeviceType(dType) && fCurContext) { 298 if (IsGpuDeviceType(dType) && fCurContext) {
296 SkSurfaceProps props(win->getSurfaceProps()); 299 SkSurfaceProps props(win->getSurfaceProps());
297 if (kRGBA_F16_SkColorType == win->info().colorType()) { 300 if (kRGBA_F16_SkColorType == win->info().colorType() || fTenBitColor ) {
298 // Need to make an off-screen F16 surface - the current render t arget is 301 // Need to make an off-screen F16 surface - the current render t arget is
299 // (probably) the wrong format. 302 // (probably) the wrong format. If we're using a 10-bit surface, we definitely
303 // need an off-screen surface, because 10-bit behaves strangely wrt gamma.
300 return SkSurface::MakeRenderTarget(fCurContext, SkBudgeted::kNo, win->info(), 304 return SkSurface::MakeRenderTarget(fCurContext, SkBudgeted::kNo, win->info(),
301 fMSAASampleCount, &props).rel ease(); 305 fMSAASampleCount, &props).rel ease();
302 } else { 306 } else {
303 return SkSurface::MakeRenderTargetDirect(fCurRenderTarget, &prop s).release(); 307 return SkSurface::MakeRenderTargetDirect(fCurRenderTarget, &prop s).release();
304 } 308 }
305 } 309 }
306 #endif 310 #endif
307 return nullptr; 311 return nullptr;
308 } 312 }
309 313
310 void publishCanvas(SampleWindow::DeviceType dType, 314 void publishCanvas(SampleWindow::DeviceType dType,
311 SkCanvas* canvas, SampleWindow* win) override { 315 SkCanvas* canvas, SampleWindow* win) override {
312 #if SK_SUPPORT_GPU 316 #if SK_SUPPORT_GPU
313 if (fCurContext) { 317 if (fCurContext) {
314 // in case we have queued drawing calls 318 // in case we have queued drawing calls
315 fCurContext->flush(); 319 fCurContext->flush();
320 }
316 321
317 if (!IsGpuDeviceType(dType)) { 322 if (kRGBA_F16_SkColorType == win->info().colorType() || fTenBitColor) {
323 // We made an off-screen surface. Get the contents as an SkImage:
324 SkBitmap bm;
325 bm.allocPixels(win->info());
326 canvas->readPixels(&bm, 0, 0);
327 SkPixmap pm;
328 bm.peekPixels(&pm);
329 sk_sp<SkImage> image(SkImage::MakeTextureFromPixmap(fCurContext, pm,
330 SkBudgeted::kNo) );
331 GrTexture* texture = as_IB(image)->peekTexture();
332 SkASSERT(texture);
333
334 // With ten-bit output, we need to manually apply the gamma of the o utput device
335 // (unless we're in non-gamma correct mode, in which case our data i s already
336 // fake-sRGB, like we're expected to put in the 10-bit buffer):
337 bool doGamma = fTenBitColor && SkImageInfoIsGammaCorrect(win->info() );
338 fCurContext->applyGamma(fCurRenderTarget, texture, doGamma ? 2.2f : 1.0f);
339 } else if (!IsGpuDeviceType(dType)) {
318 // need to send the raster bits to the (gpu) window 340 // need to send the raster bits to the (gpu) window
319 const SkBitmap& bm = win->getBitmap(); 341 const SkBitmap& bm = win->getBitmap();
320 fCurRenderTarget->writePixels(0, 0, bm.width(), bm.height(), 342 fCurRenderTarget->writePixels(0, 0, bm.width(), bm.height(),
321 SkImageInfo2GrPixelConfig(bm.colorT ype(), 343 SkImageInfo2GrPixelConfig(bm.color Type(),
322 bm.alphaT ype(), 344 bm.alpha Type(),
323 bm.profil eType(), 345 bm.profi leType(),
324 *fCurCont ext->caps()),
325 bm.getPixels(),
326 bm.rowBytes(),
327 GrContext::kFlushWrites_PixelOp);
328 } else if (kRGBA_F16_SkColorType == win->info().colorType()) {
329 SkBitmap bm;
330 bm.allocPixels(win->info());
331 canvas->readPixels(&bm, 0, 0);
332 fCurRenderTarget->writePixels(0, 0, bm.width(), bm.height(),
333 SkImageInfo2GrPixelConfig(bm.info( ),
334 *fCurCon text->caps()), 346 *fCurCon text->caps()),
335 bm.getPixels(), 347 bm.getPixels(),
336 bm.rowBytes(), 348 bm.rowBytes(),
337 GrContext::kFlushWrites_PixelOp); 349 GrContext::kFlushWrites_PixelOp);
338 } 350
339 } 351 }
340 #endif 352 #endif
341 353
342 win->present(); 354 win->present();
343 } 355 }
344 356
345 void windowSizeChanged(SampleWindow* win) override { 357 void windowSizeChanged(SampleWindow* win) override {
346 #if SK_SUPPORT_GPU 358 #if SK_SUPPORT_GPU
347 if (fCurContext) { 359 if (fCurContext) {
348 AttachmentInfo attachmentInfo; 360 AttachmentInfo attachmentInfo;
349 win->attach(fBackend, fMSAASampleCount, &attachmentInfo); 361 win->attach(fBackend, fMSAASampleCount, fTenBitColor, &attachmentInf o);
350 SkSafeUnref(fCurRenderTarget); 362 SkSafeUnref(fCurRenderTarget);
351 fCurRenderTarget = win->renderTarget(attachmentInfo, fCurIntf, fCurC ontext); 363 fCurRenderTarget = win->renderTarget(attachmentInfo, fCurIntf, fCurC ontext);
352 } 364 }
353 #endif 365 #endif
354 } 366 }
355 367
356 GrContext* getGrContext() override { 368 GrContext* getGrContext() override {
357 #if SK_SUPPORT_GPU 369 #if SK_SUPPORT_GPU
358 return fCurContext; 370 return fCurContext;
359 #else 371 #else
360 return nullptr; 372 return nullptr;
361 #endif 373 #endif
362 } 374 }
363 375
364 GrRenderTarget* getGrRenderTarget() override { 376 GrRenderTarget* getGrRenderTarget() override {
365 #if SK_SUPPORT_GPU 377 #if SK_SUPPORT_GPU
366 return fCurRenderTarget; 378 return fCurRenderTarget;
367 #else 379 #else
368 return nullptr; 380 return nullptr;
369 #endif 381 #endif
370 } 382 }
371 383
372 private: 384 private:
373 385
374 #if SK_SUPPORT_GPU 386 #if SK_SUPPORT_GPU
375 GrContext* fCurContext; 387 GrContext* fCurContext;
376 const GrGLInterface* fCurIntf; 388 const GrGLInterface* fCurIntf;
377 GrRenderTarget* fCurRenderTarget; 389 GrRenderTarget* fCurRenderTarget;
378 int fMSAASampleCount; 390 int fMSAASampleCount;
391 bool fTenBitColor;
379 #endif 392 #endif
380 393
381 SkOSWindow::SkBackEndTypes fBackend; 394 SkOSWindow::SkBackEndTypes fBackend;
382 395
383 typedef SampleWindow::DeviceManager INHERITED; 396 typedef SampleWindow::DeviceManager INHERITED;
384 }; 397 };
385 398
386 /////////////// 399 ///////////////
387 static const char view_inval_msg[] = "view-inval-msg"; 400 static const char view_inval_msg[] = "view-inval-msg";
388 401
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 newCount += 1; 779 newCount += 1;
767 } 780 }
768 } 781 }
769 if (newCount) { 782 if (newCount) {
770 factories.setCount(newCount); 783 factories.setCount(newCount);
771 } 784 }
772 } 785 }
773 786
774 DEFINE_string(slide, "", "Start on this sample."); 787 DEFINE_string(slide, "", "Start on this sample.");
775 DEFINE_int32(msaa, 0, "Request multisampling with this count."); 788 DEFINE_int32(msaa, 0, "Request multisampling with this count.");
789 DEFINE_bool(tenBit, false, "Request 10-bit/channel display buffer.");
776 DEFINE_string(pictureDir, "", "Read pictures from here."); 790 DEFINE_string(pictureDir, "", "Read pictures from here.");
777 DEFINE_string(picture, "", "Path to single picture."); 791 DEFINE_string(picture, "", "Path to single picture.");
778 DEFINE_string(sequence, "", "Path to file containing the desired samples/gms to show."); 792 DEFINE_string(sequence, "", "Path to file containing the desired samples/gms to show.");
779 DEFINE_bool(sort, false, "Sort samples by title."); 793 DEFINE_bool(sort, false, "Sort samples by title.");
780 DEFINE_bool(list, false, "List samples?"); 794 DEFINE_bool(list, false, "List samples?");
781 DEFINE_bool(gpu, false, "Start up with gpu?"); 795 DEFINE_bool(gpu, false, "Start up with gpu?");
782 DEFINE_bool(redraw, false, "Force continuous redrawing, for profiling or debuggi ng tools."); 796 DEFINE_bool(redraw, false, "Force continuous redrawing, for profiling or debuggi ng tools.");
783 DEFINE_string(key, "", ""); // dummy to enable gm tests that have platform-spec ific names 797 DEFINE_string(key, "", ""); // dummy to enable gm tests that have platform-spec ific names
784 #ifdef SAMPLE_PDF_FILE_VIEWER 798 #ifdef SAMPLE_PDF_FILE_VIEWER
785 DEFINE_string(pdfPath, "", "Path to direcotry of pdf files."); 799 DEFINE_string(pdfPath, "", "Path to direcotry of pdf files.");
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 868
855 if (!FLAGS_slide.isEmpty()) { 869 if (!FLAGS_slide.isEmpty()) {
856 fCurrIndex = findByTitle(FLAGS_slide[0]); 870 fCurrIndex = findByTitle(FLAGS_slide[0]);
857 if (fCurrIndex < 0) { 871 if (fCurrIndex < 0) {
858 fprintf(stderr, "Unknown sample \"%s\"\n", FLAGS_slide[0]); 872 fprintf(stderr, "Unknown sample \"%s\"\n", FLAGS_slide[0]);
859 listTitles(); 873 listTitles();
860 } 874 }
861 } 875 }
862 876
863 fMSAASampleCount = FLAGS_msaa; 877 fMSAASampleCount = FLAGS_msaa;
878 fTenBitColor = FLAGS_tenBit;
864 879
865 if (FLAGS_list) { 880 if (FLAGS_list) {
866 listTitles(); 881 listTitles();
867 } 882 }
868 883
869 if (fCurrIndex < 0) { 884 if (fCurrIndex < 0) {
870 SkString title; 885 SkString title;
871 if (readTitleFromPrefs(&title)) { 886 if (readTitleFromPrefs(&title)) {
872 fCurrIndex = findByTitle(title.c_str()); 887 fCurrIndex = findByTitle(title.c_str());
873 } 888 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 this->setClipToBounds(false); 1031 this->setClipToBounds(false);
1017 1032
1018 this->loadView((*fSamples[fCurrIndex])()); 1033 this->loadView((*fSamples[fCurrIndex])());
1019 1034
1020 if (nullptr == devManager) { 1035 if (nullptr == devManager) {
1021 fDevManager = new DefaultDeviceManager(); 1036 fDevManager = new DefaultDeviceManager();
1022 } else { 1037 } else {
1023 devManager->ref(); 1038 devManager->ref();
1024 fDevManager = devManager; 1039 fDevManager = devManager;
1025 } 1040 }
1026 fDevManager->setUpBackend(this, fMSAASampleCount); 1041 fDevManager->setUpBackend(this, fMSAASampleCount, fTenBitColor);
1027 1042
1028 // If another constructor set our dimensions, ensure that our 1043 // If another constructor set our dimensions, ensure that our
1029 // onSizeChange gets called. 1044 // onSizeChange gets called.
1030 if (this->height() && this->width()) { 1045 if (this->height() && this->width()) {
1031 this->onSizeChange(); 1046 this->onSizeChange();
1032 } 1047 }
1033 1048
1034 // can't call this synchronously, since it may require a subclass to 1049 // can't call this synchronously, since it may require a subclass to
1035 // to implement, or the caller may need us to have returned from the 1050 // to implement, or the caller may need us to have returned from the
1036 // constructor first. Hence we post an event to ourselves. 1051 // constructor first. Hence we post an event to ourselves.
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 } 1855 }
1841 return this->INHERITED::onHandleChar(uni); 1856 return this->INHERITED::onHandleChar(uni);
1842 } 1857 }
1843 1858
1844 void SampleWindow::setDeviceType(DeviceType type) { 1859 void SampleWindow::setDeviceType(DeviceType type) {
1845 if (type == fDeviceType) 1860 if (type == fDeviceType)
1846 return; 1861 return;
1847 1862
1848 fDevManager->tearDownBackend(this); 1863 fDevManager->tearDownBackend(this);
1849 fDeviceType = type; 1864 fDeviceType = type;
1850 fDevManager->setUpBackend(this, fMSAASampleCount); 1865 fDevManager->setUpBackend(this, fMSAASampleCount, fTenBitColor);
1851 1866
1852 this->updateTitle(); 1867 this->updateTitle();
1853 this->inval(nullptr); 1868 this->inval(nullptr);
1854 } 1869 }
1855 1870
1856 void SampleWindow::setDeviceColorType(SkColorType ct, SkColorProfileType pt) { 1871 void SampleWindow::setDeviceColorType(SkColorType ct, SkColorProfileType pt) {
1857 this->setColorType(ct, pt); 1872 this->setColorType(ct, pt);
1858 1873
1859 fDevManager->tearDownBackend(this); 1874 fDevManager->tearDownBackend(this);
1860 fDevManager->setUpBackend(this, fMSAASampleCount); 1875 fDevManager->setUpBackend(this, fMSAASampleCount, fTenBitColor);
1861 1876
1862 this->updateTitle(); 1877 this->updateTitle();
1863 this->inval(nullptr); 1878 this->inval(nullptr);
1864 } 1879 }
1865 1880
1866 void SampleWindow::toggleSlideshow() { 1881 void SampleWindow::toggleSlideshow() {
1867 fAnimating = !fAnimating; 1882 fAnimating = !fAnimating;
1868 this->postAnimatingEvent(); 1883 this->postAnimatingEvent();
1869 this->updateTitle(); 1884 this->updateTitle();
1870 } 1885 }
1871 1886
1872 void SampleWindow::toggleRendering() { 1887 void SampleWindow::toggleRendering() {
1873 this->setDeviceType(cycle_devicetype(fDeviceType)); 1888 this->setDeviceType(cycle_devicetype(fDeviceType));
1874 this->updateTitle(); 1889 this->updateTitle();
1875 this->inval(nullptr); 1890 this->inval(nullptr);
1876 } 1891 }
1877 1892
1878 void SampleWindow::toggleFPS() { 1893 void SampleWindow::toggleFPS() {
1879 fMeasureFPS = !fMeasureFPS; 1894 fMeasureFPS = !fMeasureFPS;
1880 this->updateTitle(); 1895 this->updateTitle();
1881 this->inval(nullptr); 1896 this->inval(nullptr);
1882 } 1897 }
1883 1898
1884 void SampleWindow::toggleDistanceFieldFonts() { 1899 void SampleWindow::toggleDistanceFieldFonts() {
1885 // reset backend 1900 // reset backend
1886 fDevManager->tearDownBackend(this); 1901 fDevManager->tearDownBackend(this);
1887 fDevManager->setUpBackend(this, fMSAASampleCount); 1902 fDevManager->setUpBackend(this, fMSAASampleCount, fTenBitColor);
1888 1903
1889 SkSurfaceProps props = this->getSurfaceProps(); 1904 SkSurfaceProps props = this->getSurfaceProps();
1890 uint32_t flags = props.flags() ^ SkSurfaceProps::kUseDeviceIndependentFonts_ Flag; 1905 uint32_t flags = props.flags() ^ SkSurfaceProps::kUseDeviceIndependentFonts_ Flag;
1891 this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry())); 1906 this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry()));
1892 1907
1893 this->updateTitle(); 1908 this->updateTitle();
1894 this->inval(nullptr); 1909 this->inval(nullptr);
1895 } 1910 }
1896 1911
1897 void SampleWindow::setPixelGeometry(int pixelGeometryIndex) { 1912 void SampleWindow::setPixelGeometry(int pixelGeometryIndex) {
1898 // reset backend 1913 // reset backend
1899 fDevManager->tearDownBackend(this); 1914 fDevManager->tearDownBackend(this);
1900 fDevManager->setUpBackend(this, fMSAASampleCount); 1915 fDevManager->setUpBackend(this, fMSAASampleCount, fTenBitColor);
1901 1916
1902 const SkSurfaceProps& oldProps = this->getSurfaceProps(); 1917 const SkSurfaceProps& oldProps = this->getSurfaceProps();
1903 SkSurfaceProps newProps(oldProps.flags(), SkSurfaceProps::kLegacyFontHost_In itType); 1918 SkSurfaceProps newProps(oldProps.flags(), SkSurfaceProps::kLegacyFontHost_In itType);
1904 if (pixelGeometryIndex > 0) { 1919 if (pixelGeometryIndex > 0) {
1905 newProps = SkSurfaceProps(oldProps.flags(), 1920 newProps = SkSurfaceProps(oldProps.flags(),
1906 gPixelGeometryStates[pixelGeometryIndex].pixel Geometry); 1921 gPixelGeometryStates[pixelGeometryIndex].pixel Geometry);
1907 } 1922 }
1908 this->setSurfaceProps(newProps); 1923 this->setSurfaceProps(newProps);
1909 1924
1910 this->updateTitle(); 1925 this->updateTitle();
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 fDevManager && 2170 fDevManager &&
2156 fDevManager->getGrRenderTarget() && 2171 fDevManager->getGrRenderTarget() &&
2157 fDevManager->getGrRenderTarget()->numColorSamples() > 0) { 2172 fDevManager->getGrRenderTarget()->numColorSamples() > 0) {
2158 title.appendf(" [MSAA: %d]", 2173 title.appendf(" [MSAA: %d]",
2159 fDevManager->getGrRenderTarget()->numColorSamples()); 2174 fDevManager->getGrRenderTarget()->numColorSamples());
2160 } 2175 }
2161 #endif 2176 #endif
2162 2177
2163 title.appendf(" %s", find_config_name(this->info())); 2178 title.appendf(" %s", find_config_name(this->info()));
2164 2179
2180 if (fTenBitColor) {
2181 title.append(" 10 bpc");
2182 }
2183
2165 if (gTreatSkColorAsSRGB) { 2184 if (gTreatSkColorAsSRGB) {
2166 title.append(" sRGB"); 2185 title.append(" sRGB");
2167 } 2186 }
2168 2187
2169 this->setTitle(title.c_str()); 2188 this->setTitle(title.c_str());
2170 } 2189 }
2171 2190
2172 void SampleWindow::onSizeChange() { 2191 void SampleWindow::onSizeChange() {
2173 this->INHERITED::onSizeChange(); 2192 this->INHERITED::onSizeChange();
2174 2193
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2401 #ifdef SK_BUILD_FOR_MAC 2420 #ifdef SK_BUILD_FOR_MAC
2402 setenv("ANDROID_ROOT", "/android/device/data", 0); 2421 setenv("ANDROID_ROOT", "/android/device/data", 0);
2403 #endif 2422 #endif
2404 SkGraphics::Init(); 2423 SkGraphics::Init();
2405 SkEvent::Init(); 2424 SkEvent::Init();
2406 } 2425 }
2407 2426
2408 void application_term() { 2427 void application_term() {
2409 SkEvent::Term(); 2428 SkEvent::Term();
2410 } 2429 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698