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

Side by Side Diff: experimental/iOSSampleApp/SkSampleUIView.mm

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: Rebase 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
« no previous file with comments | « experimental/SkV8Example/SkV8Example.cpp ('k') | gyp/gpu.gypi » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 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 #import "SkSampleUIView.h" 8 #import "SkSampleUIView.h"
9 9
10 //#define SKGL_CONFIG kEAGLColorFormatRGB565 10 //#define SKGL_CONFIG kEAGLColorFormatRGB565
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 virtual ~SkiOSDeviceManager() { 42 virtual ~SkiOSDeviceManager() {
43 #if SK_SUPPORT_GPU 43 #if SK_SUPPORT_GPU
44 SkSafeUnref(fCurContext); 44 SkSafeUnref(fCurContext);
45 SkSafeUnref(fCurIntf); 45 SkSafeUnref(fCurIntf);
46 SkSafeUnref(fCurRenderTarget); 46 SkSafeUnref(fCurRenderTarget);
47 #endif 47 #endif
48 } 48 }
49 49
50 void setUpBackend(SampleWindow* win, int msaaSampleCount) override { 50 void setUpBackend(SampleWindow* win, int msaaSampleCount, bool deepColor) ov erride {
51 SkASSERT(SkOSWindow::kNone_BackEndType == fBackend); 51 SkASSERT(SkOSWindow::kNone_BackEndType == fBackend);
52 52
53 fBackend = SkOSWindow::kNone_BackEndType; 53 fBackend = SkOSWindow::kNone_BackEndType;
54 54
55 #if SK_SUPPORT_GPU 55 #if SK_SUPPORT_GPU
56 switch (win->getDeviceType()) { 56 switch (win->getDeviceType()) {
57 case SampleWindow::kRaster_DeviceType: 57 case SampleWindow::kRaster_DeviceType:
58 break; 58 break;
59 // these guys use the native backend 59 // these guys use the native backend
60 case SampleWindow::kGPU_DeviceType: 60 case SampleWindow::kGPU_DeviceType:
61 fBackend = SkOSWindow::kNativeGL_BackEndType; 61 fBackend = SkOSWindow::kNativeGL_BackEndType;
62 break; 62 break;
63 default: 63 default:
64 SkASSERT(false); 64 SkASSERT(false);
65 break; 65 break;
66 } 66 }
67 SkOSWindow::AttachmentInfo info; 67 SkOSWindow::AttachmentInfo info;
68 bool result = win->attach(fBackend, msaaSampleCount, &info); 68 bool result = win->attach(fBackend, msaaSampleCount, false, &info);
69 if (!result) { 69 if (!result) {
70 SkDebugf("Failed to initialize GL"); 70 SkDebugf("Failed to initialize GL");
71 return; 71 return;
72 } 72 }
73 fMSAASampleCount = msaaSampleCount; 73 fMSAASampleCount = msaaSampleCount;
74 74
75 SkASSERT(NULL == fCurIntf); 75 SkASSERT(NULL == fCurIntf);
76 switch (win->getDeviceType()) { 76 switch (win->getDeviceType()) {
77 case SampleWindow::kRaster_DeviceType: 77 case SampleWindow::kRaster_DeviceType:
78 fCurIntf = NULL; 78 fCurIntf = NULL;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 #endif 139 #endif
140 win->present(); 140 win->present();
141 } 141 }
142 142
143 void windowSizeChanged(SampleWindow* win) override { 143 void windowSizeChanged(SampleWindow* win) override {
144 #if SK_SUPPORT_GPU 144 #if SK_SUPPORT_GPU
145 if (NULL != fCurContext) { 145 if (NULL != fCurContext) {
146 SkOSWindow::AttachmentInfo info; 146 SkOSWindow::AttachmentInfo info;
147 147
148 win->attach(fBackend, fMSAASampleCount, &info); 148 win->attach(fBackend, fMSAASampleCount, false, &info);
149 149
150 glBindFramebuffer(GL_FRAMEBUFFER, fLayerFBO); 150 glBindFramebuffer(GL_FRAMEBUFFER, fLayerFBO);
151 GrBackendRenderTargetDesc desc; 151 GrBackendRenderTargetDesc desc;
152 desc.fWidth = SkScalarRoundToInt(win->width()); 152 desc.fWidth = SkScalarRoundToInt(win->width());
153 desc.fHeight = SkScalarRoundToInt(win->height()); 153 desc.fHeight = SkScalarRoundToInt(win->height());
154 desc.fConfig = kSkia8888_GrPixelConfig; 154 desc.fConfig = kSkia8888_GrPixelConfig;
155 desc.fRenderTargetHandle = fLayerFBO; 155 desc.fRenderTargetHandle = fLayerFBO;
156 desc.fSampleCnt = info.fSampleCount; 156 desc.fSampleCnt = info.fSampleCount;
157 desc.fStencilBits = info.fStencilBits; 157 desc.fStencilBits = info.fStencilBits;
158 158
(...skipping 11 matching lines...) Expand all
170 #endif 170 #endif
171 } 171 }
172 172
173 GrRenderTarget* getGrRenderTarget() override { 173 GrRenderTarget* getGrRenderTarget() override {
174 #if SK_SUPPORT_GPU 174 #if SK_SUPPORT_GPU
175 return fCurRenderTarget; 175 return fCurRenderTarget;
176 #else 176 #else
177 return NULL; 177 return NULL;
178 #endif 178 #endif
179 } 179 }
180 180
181 int getColorBits() override {
182 return 24;
183 }
184
181 bool isUsingGL() const { return SkOSWindow::kNone_BackEndType != fBackend; } 185 bool isUsingGL() const { return SkOSWindow::kNone_BackEndType != fBackend; }
182 186
183 private: 187 private:
184 188
185 #if SK_SUPPORT_GPU 189 #if SK_SUPPORT_GPU
186 GrContext* fCurContext; 190 GrContext* fCurContext;
187 const GrGLInterface* fCurIntf; 191 const GrGLInterface* fCurIntf;
188 GrRenderTarget* fCurRenderTarget; 192 GrRenderTarget* fCurRenderTarget;
189 int fMSAASampleCount; 193 int fMSAASampleCount;
190 GLint fLayerFBO; 194 GLint fLayerFBO;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer); 485 glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
482 glGetRenderbufferParameteriv(GL_RENDERBUFFER, 486 glGetRenderbufferParameteriv(GL_RENDERBUFFER,
483 GL_RENDERBUFFER_STENCIL_SIZE, 487 GL_RENDERBUFFER_STENCIL_SIZE,
484 &info->fStencilBits); 488 &info->fStencilBits);
485 glGetRenderbufferParameteriv(GL_RENDERBUFFER, 489 glGetRenderbufferParameteriv(GL_RENDERBUFFER,
486 GL_RENDERBUFFER_SAMPLES_APPLE, 490 GL_RENDERBUFFER_SAMPLES_APPLE,
487 &info->fSampleCount); 491 &info->fSampleCount);
488 } 492 }
489 493
490 @end 494 @end
OLDNEW
« no previous file with comments | « experimental/SkV8Example/SkV8Example.cpp ('k') | gyp/gpu.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698