OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 GrBackendRenderTargetDesc desc; | 76 GrBackendRenderTargetDesc desc; |
77 desc.fWidth = this->fWidth; | 77 desc.fWidth = this->fWidth; |
78 desc.fHeight = this->fHeight; | 78 desc.fHeight = this->fHeight; |
79 desc.fConfig = fPixelConfig; | 79 desc.fConfig = fPixelConfig; |
80 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 80 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
81 desc.fSampleCnt = fSampleCount; | 81 desc.fSampleCnt = fSampleCount; |
82 desc.fStencilBits = fStencilBits; | 82 desc.fStencilBits = fStencilBits; |
83 GrGLint buffer; | 83 GrGLint buffer; |
84 GR_GL_CALL(fBackendContext, GetIntegerv(GR_GL_FRAMEBUFFER_BINDING, &
buffer)); | 84 GR_GL_CALL(fBackendContext, GetIntegerv(GR_GL_FRAMEBUFFER_BINDING, &
buffer)); |
85 desc.fRenderTargetHandle = buffer; | 85 desc.fRenderTargetHandle = buffer; |
86 fRenderTarget.reset(fContext->textureProvider()->wrapBackendRenderTa
rget(desc)); | |
87 | 86 |
88 fSurface = this->createRenderSurface(fRenderTarget, fActualColorBits
); | 87 fSurface = this->createRenderSurface(desc, fActualColorBits); |
89 } | 88 } |
90 } | 89 } |
91 | 90 |
92 return fSurface; | 91 return fSurface; |
93 } | 92 } |
94 | 93 |
95 void GLWindowContext::swapBuffers() { | 94 void GLWindowContext::swapBuffers() { |
96 this->presentRenderSurface(fSurface, fRenderTarget, fActualColorBits); | 95 this->presentRenderSurface(fSurface, fRenderTarget, fActualColorBits); |
97 this->onSwapBuffers(); | 96 this->onSwapBuffers(); |
98 } | 97 } |
99 | 98 |
100 void GLWindowContext::resize(uint32_t w, uint32_t h) { | 99 void GLWindowContext::resize(uint32_t w, uint32_t h) { |
101 this->destroyContext(); | 100 this->destroyContext(); |
102 | 101 |
103 this->initializeContext(nullptr, fDisplayParams); | 102 this->initializeContext(nullptr, fDisplayParams); |
104 } | 103 } |
105 | 104 |
106 void GLWindowContext::setDisplayParams(const DisplayParams& params) { | 105 void GLWindowContext::setDisplayParams(const DisplayParams& params) { |
107 this->destroyContext(); | 106 this->destroyContext(); |
108 | 107 |
109 this->initializeContext(nullptr, params); | 108 this->initializeContext(nullptr, params); |
110 } | 109 } |
111 | 110 |
112 } //namespace sk_app | 111 } //namespace sk_app |
OLD | NEW |