OLD | NEW |
1 #import "SkSampleUIView.h" | 1 #import "SkSampleUIView.h" |
2 | 2 |
3 #define SKGL_CONFIG kEAGLColorFormatRGB565 | 3 #define SKGL_CONFIG kEAGLColorFormatRGB565 |
4 //#define SKGL_CONFIG kEAGLColorFormatRGBA8 | 4 //#define SKGL_CONFIG kEAGLColorFormatRGBA8 |
5 | 5 |
6 #define FORCE_REDRAW | 6 #define FORCE_REDRAW |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkCGUtils.h" | 9 #include "SkCGUtils.h" |
10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 fBackend = SkOSWindow::kNone_BackEndType; | 46 fBackend = SkOSWindow::kNone_BackEndType; |
47 | 47 |
48 #if SK_SUPPORT_GPU | 48 #if SK_SUPPORT_GPU |
49 switch (win->getDeviceType()) { | 49 switch (win->getDeviceType()) { |
50 // these two don't use GL | 50 // these two don't use GL |
51 case SampleWindow::kRaster_DeviceType: | 51 case SampleWindow::kRaster_DeviceType: |
52 case SampleWindow::kPicture_DeviceType: | 52 case SampleWindow::kPicture_DeviceType: |
53 break; | 53 break; |
54 // these guys use the native backend | 54 // these guys use the native backend |
55 case SampleWindow::kGPU_DeviceType: | 55 case SampleWindow::kGPU_DeviceType: |
56 case SampleWindow::kNullGPU_DeviceType: | |
57 fBackend = SkOSWindow::kNativeGL_BackEndType; | 56 fBackend = SkOSWindow::kNativeGL_BackEndType; |
58 break; | 57 break; |
59 default: | 58 default: |
60 SkASSERT(false); | 59 SkASSERT(false); |
61 break; | 60 break; |
62 } | 61 } |
63 SkOSWindow::AttachmentInfo info; | 62 SkOSWindow::AttachmentInfo info; |
64 bool result = win->attach(fBackend, msaaSampleCount, &info); | 63 bool result = win->attach(fBackend, msaaSampleCount, &info); |
65 if (!result) { | 64 if (!result) { |
66 SkDebugf("Failed to initialize GL"); | 65 SkDebugf("Failed to initialize GL"); |
67 return; | 66 return; |
68 } | 67 } |
69 fMSAASampleCount = msaaSampleCount; | 68 fMSAASampleCount = msaaSampleCount; |
70 | 69 |
71 SkASSERT(NULL == fCurIntf); | 70 SkASSERT(NULL == fCurIntf); |
72 switch (win->getDeviceType()) { | 71 switch (win->getDeviceType()) { |
73 // these two don't use GL | 72 // these two don't use GL |
74 case SampleWindow::kRaster_DeviceType: | 73 case SampleWindow::kRaster_DeviceType: |
75 case SampleWindow::kPicture_DeviceType: | 74 case SampleWindow::kPicture_DeviceType: |
76 fCurIntf = NULL; | 75 fCurIntf = NULL; |
77 break; | 76 break; |
78 case SampleWindow::kGPU_DeviceType: | 77 case SampleWindow::kGPU_DeviceType: |
79 fCurIntf = GrGLCreateNativeInterface(); | 78 fCurIntf = GrGLCreateNativeInterface(); |
80 break; | 79 break; |
81 case SampleWindow::kNullGPU_DeviceType: | |
82 fCurIntf = GrGLCreateNullInterface(); | |
83 break; | |
84 default: | 80 default: |
85 SkASSERT(false); | 81 SkASSERT(false); |
86 break; | 82 break; |
87 } | 83 } |
88 | 84 |
89 SkASSERT(NULL == fCurContext); | 85 SkASSERT(NULL == fCurContext); |
90 if (SkOSWindow::kNone_BackEndType != fBackend) { | 86 if (SkOSWindow::kNone_BackEndType != fBackend) { |
91 fCurContext = GrContext::Create(kOpenGL_GrBackend, | 87 fCurContext = GrContext::Create(kOpenGL_GrBackend, |
92 (GrBackendContext) fCurIntf); | 88 (GrBackendContext) fCurIntf); |
93 } | 89 } |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer); | 464 glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer); |
469 glGetRenderbufferParameteriv(GL_RENDERBUFFER, | 465 glGetRenderbufferParameteriv(GL_RENDERBUFFER, |
470 GL_RENDERBUFFER_STENCIL_SIZE, | 466 GL_RENDERBUFFER_STENCIL_SIZE, |
471 &info->fStencilBits); | 467 &info->fStencilBits); |
472 glGetRenderbufferParameteriv(GL_RENDERBUFFER, | 468 glGetRenderbufferParameteriv(GL_RENDERBUFFER, |
473 GL_RENDERBUFFER_SAMPLES_APPLE, | 469 GL_RENDERBUFFER_SAMPLES_APPLE, |
474 &info->fSampleCount); | 470 &info->fSampleCount); |
475 } | 471 } |
476 | 472 |
477 @end | 473 @end |
OLD | NEW |