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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 glStencilMask(0xffffffff); | 53 glStencilMask(0xffffffff); |
54 glClearStencil(0); | 54 glClearStencil(0); |
55 glClear(GL_STENCIL_BUFFER_BIT); | 55 glClear(GL_STENCIL_BUFFER_BIT); |
56 fCurContext->resetContext(); | 56 fCurContext->resetContext(); |
57 | 57 |
58 fGpuDevice.reset(nullptr); | 58 fGpuDevice.reset(nullptr); |
59 fCanvas.reset(nullptr); | 59 fCanvas.reset(nullptr); |
60 | 60 |
61 GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height()
); | 61 GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height()
); |
62 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 62 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
63 SkAutoTUnref<GrRenderTarget> curRenderTarget( | 63 sk_sp<GrRenderTarget> curRenderTarget( |
64 fCurContext->textureProvider()->wrapBackendRenderTarget(desc)); | 64 fCurContext->textureProvider()->wrapBackendRenderTarget(desc)); |
65 SkSurfaceProps props(0, kUnknown_SkPixelGeometry); | 65 SkSurfaceProps props(0, kUnknown_SkPixelGeometry); |
66 fGpuDevice.reset(SkGpuDevice::Create(curRenderTarget, &props, | 66 fGpuDevice.reset(SkGpuDevice::Make(std::move(curRenderTarget), &props, |
67 SkGpuDevice::kUninit_InitContents)); | 67 SkGpuDevice::kUninit_InitContents).releas
e()); |
68 fCanvas.reset(new SkCanvas(fGpuDevice)); | 68 fCanvas.reset(new SkCanvas(fGpuDevice)); |
69 } | 69 } |
70 | 70 |
71 void SkGLWidget::resizeGL(int w, int h) { | 71 void SkGLWidget::resizeGL(int w, int h) { |
72 SkASSERT(w == this->width() && h == this->height()); | 72 SkASSERT(w == this->width() && h == this->height()); |
73 this->createRenderTarget(); | 73 this->createRenderTarget(); |
74 } | 74 } |
75 | 75 |
76 void SkGLWidget::paintGL() { | 76 void SkGLWidget::paintGL() { |
77 if (!this->isHidden() && fCanvas) { | 77 if (!this->isHidden() && fCanvas) { |
(...skipping 13 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 |