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

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1275543005: Move some work from backend onClear to base class clear (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Pass references and rebase Created 5 years, 4 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 | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | 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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 } 1562 }
1563 1563
1564 void GrGLGpu::disableScissor() { 1564 void GrGLGpu::disableScissor() {
1565 if (kNo_TriState != fHWScissorSettings.fEnabled) { 1565 if (kNo_TriState != fHWScissorSettings.fEnabled) {
1566 GL_CALL(Disable(GR_GL_SCISSOR_TEST)); 1566 GL_CALL(Disable(GR_GL_SCISSOR_TEST));
1567 fHWScissorSettings.fEnabled = kNo_TriState; 1567 fHWScissorSettings.fEnabled = kNo_TriState;
1568 return; 1568 return;
1569 } 1569 }
1570 } 1570 }
1571 1571
1572 void GrGLGpu::onClear(GrRenderTarget* target, const SkIRect* rect, GrColor color , 1572 void GrGLGpu::onClear(GrRenderTarget* target, const SkIRect& rect, GrColor color ) {
1573 bool canIgnoreRect) {
1574 // parent class should never let us get here with no RT 1573 // parent class should never let us get here with no RT
1575 SkASSERT(target); 1574 SkASSERT(target);
1576 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); 1575 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
1577 1576
1578 if (canIgnoreRect && this->glCaps().fullClearIsFree()) { 1577 this->flushRenderTarget(glRT, &rect);
1579 rect = NULL;
1580 }
1581
1582 SkIRect clippedRect;
1583 if (rect) {
1584 // flushScissor expects rect to be clipped to the target.
1585 clippedRect = *rect;
1586 SkIRect rtRect = SkIRect::MakeWH(target->width(), target->height());
1587 if (clippedRect.intersect(rtRect)) {
1588 rect = &clippedRect;
1589 } else {
1590 return;
1591 }
1592 }
1593
1594 this->flushRenderTarget(glRT, rect);
1595 GrScissorState scissorState; 1578 GrScissorState scissorState;
1596 if (rect) { 1579 scissorState.set(rect);
1597 scissorState.set(*rect);
1598 }
1599 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); 1580 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin());
1600 1581
1601 GrGLfloat r, g, b, a; 1582 GrGLfloat r, g, b, a;
1602 static const GrGLfloat scale255 = 1.f / 255.f; 1583 static const GrGLfloat scale255 = 1.f / 255.f;
1603 a = GrColorUnpackA(color) * scale255; 1584 a = GrColorUnpackA(color) * scale255;
1604 GrGLfloat scaleRGB = scale255; 1585 GrGLfloat scaleRGB = scale255;
1605 r = GrColorUnpackR(color) * scaleRGB; 1586 r = GrColorUnpackR(color) * scaleRGB;
1606 g = GrColorUnpackG(color) * scaleRGB; 1587 g = GrColorUnpackG(color) * scaleRGB;
1607 b = GrColorUnpackB(color) * scaleRGB; 1588 b = GrColorUnpackB(color) * scaleRGB;
1608 1589
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 this->setVertexArrayID(gpu, 0); 3194 this->setVertexArrayID(gpu, 0);
3214 } 3195 }
3215 int attrCount = gpu->glCaps().maxVertexAttributes(); 3196 int attrCount = gpu->glCaps().maxVertexAttributes();
3216 if (fDefaultVertexArrayAttribState.count() != attrCount) { 3197 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3217 fDefaultVertexArrayAttribState.resize(attrCount); 3198 fDefaultVertexArrayAttribState.resize(attrCount);
3218 } 3199 }
3219 attribState = &fDefaultVertexArrayAttribState; 3200 attribState = &fDefaultVertexArrayAttribState;
3220 } 3201 }
3221 return attribState; 3202 return attribState;
3222 } 3203 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698