OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 | 9 |
10 #include "SkGLWidget.h" | 10 #include "SkGLWidget.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 glClearStencil(0); | 57 glClearStencil(0); |
58 glClear(GL_STENCIL_BUFFER_BIT); | 58 glClear(GL_STENCIL_BUFFER_BIT); |
59 fCurContext->resetContext(); | 59 fCurContext->resetContext(); |
60 | 60 |
61 fGpuDevice.reset(NULL); | 61 fGpuDevice.reset(NULL); |
62 fCanvas.reset(NULL); | 62 fCanvas.reset(NULL); |
63 | 63 |
64 GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height()
); | 64 GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height()
); |
65 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 65 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
66 SkAutoTUnref<GrRenderTarget> curRenderTarget(fCurContext->wrapBackendRenderT
arget(desc)); | 66 SkAutoTUnref<GrRenderTarget> curRenderTarget(fCurContext->wrapBackendRenderT
arget(desc)); |
67 fGpuDevice.reset(SkGpuDevice::Create(curRenderTarget.get(), | 67 SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); |
68 SkSurfaceProps(SkSurfaceProps::kLegacyF
ontHost_InitType))); | 68 fGpuDevice.reset(SkGpuDevice::Create(curRenderTarget, &props)); |
69 fCanvas.reset(new SkCanvas(fGpuDevice)); | 69 fCanvas.reset(new SkCanvas(fGpuDevice)); |
70 } | 70 } |
71 | 71 |
72 void SkGLWidget::resizeGL(int w, int h) { | 72 void SkGLWidget::resizeGL(int w, int h) { |
73 SkASSERT(w == this->width() && h == this->height()); | 73 SkASSERT(w == this->width() && h == this->height()); |
74 this->createRenderTarget(); | 74 this->createRenderTarget(); |
75 } | 75 } |
76 | 76 |
77 void SkGLWidget::paintGL() { | 77 void SkGLWidget::paintGL() { |
78 if (!this->isHidden() && fCanvas) { | 78 if (!this->isHidden() && fCanvas) { |
(...skipping 12 matching lines...) Expand all Loading... |
91 GR_GL_GetIntegerv(fCurIntf, GR_GL_SAMPLES, &desc.fSampleCnt); | 91 GR_GL_GetIntegerv(fCurIntf, GR_GL_SAMPLES, &desc.fSampleCnt); |
92 GR_GL_GetIntegerv(fCurIntf, GR_GL_STENCIL_BITS, &desc.fStencilBits); | 92 GR_GL_GetIntegerv(fCurIntf, GR_GL_STENCIL_BITS, &desc.fStencilBits); |
93 GrGLint buffer; | 93 GrGLint buffer; |
94 GR_GL_GetIntegerv(fCurIntf, GR_GL_FRAMEBUFFER_BINDING, &buffer); | 94 GR_GL_GetIntegerv(fCurIntf, GR_GL_FRAMEBUFFER_BINDING, &buffer); |
95 desc.fRenderTargetHandle = buffer; | 95 desc.fRenderTargetHandle = buffer; |
96 | 96 |
97 return desc; | 97 return desc; |
98 } | 98 } |
99 | 99 |
100 #endif | 100 #endif |
OLD | NEW |