Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: debugger/QT/SkGLWidget.cpp

Issue 517033002: Make SkGpuDevice constructors private. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more replacements of cons with factory Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 return; 40 return;
41 } 41 }
42 glStencilMask(0xffffffff); 42 glStencilMask(0xffffffff);
43 glClearStencil(0); 43 glClearStencil(0);
44 glClear(GL_STENCIL_BUFFER_BIT); 44 glClear(GL_STENCIL_BUFFER_BIT);
45 45
46 fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIn tf); 46 fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIn tf);
47 GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height() ); 47 GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height() );
48 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; 48 desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
49 GrRenderTarget* curRenderTarget = fCurContext->wrapBackendRenderTarget(desc) ; 49 GrRenderTarget* curRenderTarget = fCurContext->wrapBackendRenderTarget(desc) ;
50 fGpuDevice = new SkGpuDevice(fCurContext, curRenderTarget); 50 fGpuDevice = SkGpuDevice::Create(curRenderTarget);
51 fCanvas = new SkCanvas(fGpuDevice); 51 fCanvas = new SkCanvas(fGpuDevice);
52 curRenderTarget->unref(); 52 curRenderTarget->unref();
53 } 53 }
54 54
55 void SkGLWidget::resizeGL(int w, int h) { 55 void SkGLWidget::resizeGL(int w, int h) {
56 if (fCurContext) { 56 if (fCurContext) {
57 glDisable(GL_SCISSOR_TEST); 57 glDisable(GL_SCISSOR_TEST);
58 glStencilMask(0xffffffff); 58 glStencilMask(0xffffffff);
59 glClearStencil(0); 59 glClearStencil(0);
60 glClear(GL_STENCIL_BUFFER_BIT); 60 glClear(GL_STENCIL_BUFFER_BIT);
61 fCurContext->resetContext(); 61 fCurContext->resetContext();
62 62
63 GrBackendRenderTargetDesc desc = this->getDesc(w, h); 63 GrBackendRenderTargetDesc desc = this->getDesc(w, h);
64 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; 64 desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
65 GrRenderTarget* curRenderTarget = fCurContext->wrapBackendRenderTarget(d esc); 65 GrRenderTarget* curRenderTarget = fCurContext->wrapBackendRenderTarget(d esc);
66 SkSafeUnref(fGpuDevice); 66 SkSafeUnref(fGpuDevice);
67 SkSafeUnref(fCanvas); 67 SkSafeUnref(fCanvas);
68 fGpuDevice = new SkGpuDevice(fCurContext, curRenderTarget); 68 fGpuDevice = SkGpuDevice::Create(curRenderTarget);
69 fCanvas = new SkCanvas(fGpuDevice); 69 fCanvas = new SkCanvas(fGpuDevice);
70 } 70 }
71 fDebugger->resize(w, h); 71 fDebugger->resize(w, h);
72 draw(); 72 draw();
73 } 73 }
74 74
75 void SkGLWidget::paintGL() { 75 void SkGLWidget::paintGL() {
76 if (!this->isHidden() && fCanvas) { 76 if (!this->isHidden() && fCanvas) {
77 fDebugger->draw(fCanvas); 77 fDebugger->draw(fCanvas);
78 // TODO(chudy): Implement an optional flush button in Gui. 78 // TODO(chudy): Implement an optional flush button in Gui.
(...skipping 10 matching lines...) Expand all
89 GR_GL_GetIntegerv(fCurIntf, GR_GL_SAMPLES, &desc.fSampleCnt); 89 GR_GL_GetIntegerv(fCurIntf, GR_GL_SAMPLES, &desc.fSampleCnt);
90 GR_GL_GetIntegerv(fCurIntf, GR_GL_STENCIL_BITS, &desc.fStencilBits); 90 GR_GL_GetIntegerv(fCurIntf, GR_GL_STENCIL_BITS, &desc.fStencilBits);
91 GrGLint buffer; 91 GrGLint buffer;
92 GR_GL_GetIntegerv(fCurIntf, GR_GL_FRAMEBUFFER_BINDING, &buffer); 92 GR_GL_GetIntegerv(fCurIntf, GR_GL_FRAMEBUFFER_BINDING, &buffer);
93 desc.fRenderTargetHandle = buffer; 93 desc.fRenderTargetHandle = buffer;
94 94
95 return desc; 95 return desc;
96 } 96 }
97 97
98 #endif 98 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698