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

Unified Diff: src/gpu/GrContext.cpp

Issue 956083002: Revert of Pass clip to context (Closed) Base URL: https://skia.googlesource.com/skia.git@pass_down_rendertarget
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDistanceFieldTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index b574614eb0236a82bfaf5978a07211329e096e26..0395e1bae80259789c8caa1b1758b1eef04d1084 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -86,6 +86,7 @@
GrContext::GrContext(const Options& opts) : fOptions(opts) {
fGpu = NULL;
+ fClip = NULL;
fPathRendererChain = NULL;
fSoftwarePathRenderer = NULL;
fResourceCache = NULL;
@@ -362,7 +363,7 @@
AutoCheckFlush acf(this);
GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::clear", this);
- GrDrawTarget* target = this->prepareToDraw();
+ GrDrawTarget* target = this->prepareToDraw(NULL, renderTarget, NULL, &acf);
if (NULL == target) {
return;
}
@@ -370,7 +371,6 @@
}
void GrContext::drawPaint(GrRenderTarget* rt,
- const GrClip& clip,
const GrPaint& origPaint,
const SkMatrix& viewMatrix) {
// set rect to be big enough to fill the space, but not super-huge, so we
@@ -398,7 +398,7 @@
return;
}
inverse.mapRect(&r);
- this->drawRect(rt, clip, *paint, viewMatrix, r);
+ this->drawRect(rt, *paint, viewMatrix, r);
} else {
SkMatrix localMatrix;
if (!viewMatrix.invert(&localMatrix)) {
@@ -408,7 +408,7 @@
AutoCheckFlush acf(this);
GrPipelineBuilder pipelineBuilder;
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, paint, &acf);
if (NULL == target) {
return;
}
@@ -502,7 +502,6 @@
}
void GrContext::drawRect(GrRenderTarget* rt,
- const GrClip& clip,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRect& rect,
@@ -510,13 +509,13 @@
if (strokeInfo && strokeInfo->isDashed()) {
SkPath path;
path.addRect(rect);
- this->drawPath(rt, clip, paint, viewMatrix, path, *strokeInfo);
+ this->drawPath(rt, paint, viewMatrix, path, *strokeInfo);
return;
}
AutoCheckFlush acf(this);
GrPipelineBuilder pipelineBuilder;
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, &paint, &acf);
if (NULL == target) {
return;
}
@@ -530,13 +529,13 @@
SkRect rtRect;
pipelineBuilder.getRenderTarget()->getBoundsRect(&rtRect);
SkRect clipSpaceRTRect = rtRect;
- bool checkClip = GrClip::kWideOpen_ClipType != clip.clipType();
+ bool checkClip = fClip && GrClip::kWideOpen_ClipType != fClip->clipType();
if (checkClip) {
- clipSpaceRTRect.offset(SkIntToScalar(clip.origin().fX),
- SkIntToScalar(clip.origin().fY));
+ clipSpaceRTRect.offset(SkIntToScalar(this->getClip()->origin().fX),
+ SkIntToScalar(this->getClip()->origin().fY));
}
// Does the clip contain the entire RT?
- if (!checkClip || clip.quickContains(clipSpaceRTRect)) {
+ if (!checkClip || fClip->clipStack()->quickContains(clipSpaceRTRect)) {
SkMatrix invM;
if (!viewMatrix.invert(&invM)) {
return;
@@ -635,7 +634,6 @@
}
void GrContext::drawNonAARectToRect(GrRenderTarget* rt,
- const GrClip& clip,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRect& rectToDraw,
@@ -643,7 +641,7 @@
const SkMatrix* localMatrix) {
AutoCheckFlush acf(this);
GrPipelineBuilder pipelineBuilder;
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, &paint, &acf);
if (NULL == target) {
return;
}
@@ -683,7 +681,6 @@
}
void GrContext::drawVertices(GrRenderTarget* rt,
- const GrClip& clip,
const GrPaint& paint,
const SkMatrix& viewMatrix,
GrPrimitiveType primitiveType,
@@ -697,7 +694,7 @@
GrPipelineBuilder pipelineBuilder;
GrDrawTarget::AutoReleaseGeometry geo; // must be inside AutoCheckFlush scope
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, &paint, &acf);
if (NULL == target) {
return;
}
@@ -746,7 +743,6 @@
///////////////////////////////////////////////////////////////////////////////
void GrContext::drawRRect(GrRenderTarget*rt,
- const GrClip& clip,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRRect& rrect,
@@ -758,13 +754,13 @@
if (strokeInfo.isDashed()) {
SkPath path;
path.addRRect(rrect);
- this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo);
+ this->drawPath(rt, paint, viewMatrix, path, strokeInfo);
return;
}
AutoCheckFlush acf(this);
GrPipelineBuilder pipelineBuilder;
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, &paint, &acf);
if (NULL == target) {
return;
}
@@ -791,7 +787,6 @@
///////////////////////////////////////////////////////////////////////////////
void GrContext::drawDRRect(GrRenderTarget* rt,
- const GrClip& clip,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRRect& outer,
@@ -802,7 +797,7 @@
AutoCheckFlush acf(this);
GrPipelineBuilder pipelineBuilder;
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, &paint, &acf);
GR_CREATE_TRACE_MARKER("GrContext::drawDRRect", target);
@@ -827,8 +822,7 @@
///////////////////////////////////////////////////////////////////////////////
-void GrContext::drawOval(GrRenderTarget* rt,
- const GrClip& clip,
+void GrContext::drawOval(GrRenderTarget*rt,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRect& oval,
@@ -840,13 +834,13 @@
if (strokeInfo.isDashed()) {
SkPath path;
path.addOval(oval);
- this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo);
+ this->drawPath(rt, paint, viewMatrix, path, strokeInfo);
return;
}
AutoCheckFlush acf(this);
GrPipelineBuilder pipelineBuilder;
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, &paint, &acf);
if (NULL == target) {
return;
}
@@ -924,7 +918,6 @@
}
void GrContext::drawPath(GrRenderTarget* rt,
- const GrClip& clip,
const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkPath& path,
@@ -932,7 +925,7 @@
if (path.isEmpty()) {
if (path.isInverseFillType()) {
- this->drawPaint(rt, clip, paint, viewMatrix);
+ this->drawPaint(rt, paint, viewMatrix);
}
return;
}
@@ -943,7 +936,7 @@
if (path.isLine(pts)) {
AutoCheckFlush acf(this);
GrPipelineBuilder pipelineBuilder;
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, &paint, &acf);
if (NULL == target) {
return;
}
@@ -960,11 +953,11 @@
GrStrokeInfo newStrokeInfo(strokeInfo, false);
SkStrokeRec* stroke = newStrokeInfo.getStrokeRecPtr();
if (SkDashPath::FilterDashPath(effectPath.init(), path, stroke, NULL, info)) {
- this->drawPath(rt, clip, paint, viewMatrix, *effectPath.get(), newStrokeInfo);
+ this->drawPath(rt, paint, viewMatrix, *effectPath.get(), newStrokeInfo);
return;
}
- this->drawPath(rt, clip, paint, viewMatrix, path, newStrokeInfo);
+ this->drawPath(rt, paint, viewMatrix, path, newStrokeInfo);
return;
}
@@ -975,7 +968,7 @@
// OK.
AutoCheckFlush acf(this);
GrPipelineBuilder pipelineBuilder;
- GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, clip, &paint, &acf);
+ GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, rt, &paint, &acf);
if (NULL == target) {
return;
}
@@ -1204,10 +1197,7 @@
// drawing a rect to the render target.
// The bracket ensures we pop the stack if we wind up flushing below.
{
- GrDrawTarget* drawTarget = this->prepareToDraw();
- if (!drawTarget) {
- return false;
- }
+ GrDrawTarget* drawTarget = this->prepareToDraw(NULL, NULL, NULL, NULL);
GrDrawTarget::AutoGeometryPush agp(drawTarget);
GrPipelineBuilder pipelineBuilder;
@@ -1393,7 +1383,7 @@
SkASSERT(renderTarget);
ASSERT_OWNED_RESOURCE(renderTarget);
AutoCheckFlush acf(this);
- GrDrawTarget* target = this->prepareToDraw();
+ GrDrawTarget* target = this->prepareToDraw(NULL, NULL, NULL, NULL);
if (NULL == target) {
return;
}
@@ -1411,7 +1401,7 @@
// Since we're going to the draw target and not GPU, no need to check kNoFlush
// here.
- GrDrawTarget* target = this->prepareToDraw();
+ GrDrawTarget* target = this->prepareToDraw(NULL, NULL, NULL, NULL);
if (NULL == target) {
return;
}
@@ -1430,22 +1420,16 @@
GrDrawTarget* GrContext::prepareToDraw(GrPipelineBuilder* pipelineBuilder,
GrRenderTarget* rt,
- const GrClip& clip,
const GrPaint* paint,
const AutoCheckFlush* acf) {
if (NULL == fGpu) {
return NULL;
}
- ASSERT_OWNED_RESOURCE(rt);
- SkASSERT(rt && paint && acf);
- pipelineBuilder->setFromPaint(*paint, rt, clip);
- return fDrawBuffer;
-}
-
-GrDrawTarget* GrContext::prepareToDraw() {
- if (NULL == fGpu) {
- return NULL;
+ if (pipelineBuilder) {
+ ASSERT_OWNED_RESOURCE(rt);
+ SkASSERT(rt && paint && acf);
+ pipelineBuilder->setFromPaint(*paint, rt, fClip);
}
return fDrawBuffer;
}
@@ -1529,7 +1513,7 @@
}
GrDrawTarget* GrContext::getTextTarget() {
- return this->prepareToDraw();
+ return this->prepareToDraw(NULL, NULL, NULL, NULL);
}
const GrIndexBuffer* GrContext::getQuadIndexBuffer() const {
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDistanceFieldTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698