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 #include "SampleApp.h" | 7 #include "SampleApp.h" |
8 | 8 |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 #if SK_ANGLE | 181 #if SK_ANGLE |
182 case kANGLE_DeviceType: | 182 case kANGLE_DeviceType: |
183 // ANGLE is really the only odd man out | 183 // ANGLE is really the only odd man out |
184 fBackend = kANGLE_BackEndType; | 184 fBackend = kANGLE_BackEndType; |
185 break; | 185 break; |
186 #endif // SK_ANGLE | 186 #endif // SK_ANGLE |
187 default: | 187 default: |
188 SkASSERT(false); | 188 SkASSERT(false); |
189 break; | 189 break; |
190 } | 190 } |
191 | 191 AttachmentInfo attachmentInfo; |
192 bool result = win->attach(fBackend, msaaSampleCount); | 192 bool result = win->attach(fBackend, msaaSampleCount, &attachmentInfo); |
193 if (!result) { | 193 if (!result) { |
194 SkDebugf("Failed to initialize GL"); | 194 SkDebugf("Failed to initialize GL"); |
195 return; | 195 return; |
196 } | 196 } |
197 fMSAASampleCount = msaaSampleCount; | 197 fMSAASampleCount = msaaSampleCount; |
198 | 198 |
199 SkASSERT(NULL == fCurIntf); | 199 SkASSERT(NULL == fCurIntf); |
200 switch (win->getDeviceType()) { | 200 switch (win->getDeviceType()) { |
201 case kRaster_DeviceType: | 201 case kRaster_DeviceType: |
202 // fallthrough | 202 // fallthrough |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 } | 283 } |
284 #endif | 284 #endif |
285 | 285 |
286 win->present(); | 286 win->present(); |
287 } | 287 } |
288 | 288 |
289 virtual void windowSizeChanged(SampleWindow* win) { | 289 virtual void windowSizeChanged(SampleWindow* win) { |
290 #if SK_SUPPORT_GPU | 290 #if SK_SUPPORT_GPU |
291 if (fCurContext) { | 291 if (fCurContext) { |
292 win->attach(fBackend, fMSAASampleCount); | 292 AttachmentInfo attachmentInfo; |
| 293 win->attach(fBackend, fMSAASampleCount, &attachmentInfo); |
293 | 294 |
294 GrBackendRenderTargetDesc desc; | 295 GrBackendRenderTargetDesc desc; |
295 desc.fWidth = SkScalarRound(win->width()); | 296 desc.fWidth = SkScalarRound(win->width()); |
296 desc.fHeight = SkScalarRound(win->height()); | 297 desc.fHeight = SkScalarRound(win->height()); |
297 desc.fConfig = kSkia8888_GrPixelConfig; | 298 desc.fConfig = kSkia8888_GrPixelConfig; |
298 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 299 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
299 GR_GL_GetIntegerv(fCurIntf, GR_GL_SAMPLES, &desc.fSampleCnt); | 300 desc.fSampleCnt = attachmentInfo.fSampleCount; |
300 GR_GL_GetIntegerv(fCurIntf, GR_GL_STENCIL_BITS, &desc.fStencilBits); | 301 desc.fStencilBits = attachmentInfo.fStencilBits; |
301 GrGLint buffer; | 302 GrGLint buffer; |
302 GR_GL_GetIntegerv(fCurIntf, GR_GL_FRAMEBUFFER_BINDING, &buffer); | 303 GR_GL_GetIntegerv(fCurIntf, GR_GL_FRAMEBUFFER_BINDING, &buffer); |
303 desc.fRenderTargetHandle = buffer; | 304 desc.fRenderTargetHandle = buffer; |
304 | 305 |
305 SkSafeUnref(fCurRenderTarget); | 306 SkSafeUnref(fCurRenderTarget); |
306 fCurRenderTarget = fCurContext->wrapBackendRenderTarget(desc); | 307 fCurRenderTarget = fCurContext->wrapBackendRenderTarget(desc); |
307 } | 308 } |
308 #endif | 309 #endif |
309 } | 310 } |
310 | 311 |
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 SkGraphics::Init(); | 2452 SkGraphics::Init(); |
2452 SkEvent::Init(); | 2453 SkEvent::Init(); |
2453 } | 2454 } |
2454 | 2455 |
2455 // FIXME: this should be in a header | 2456 // FIXME: this should be in a header |
2456 void application_term(); | 2457 void application_term(); |
2457 void application_term() { | 2458 void application_term() { |
2458 SkEvent::Term(); | 2459 SkEvent::Term(); |
2459 SkGraphics::Term(); | 2460 SkGraphics::Term(); |
2460 } | 2461 } |
OLD | NEW |