Reduce use of GrRenderTarget in GrTextContexts
Cleanup prior to switching over to GrRenderTargetProxy. Review URL: https://codereview.chromium.org/1485973004
This commit is contained in:
parent
c60b310af7
commit
954cbc15b3
@ -248,15 +248,13 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
|||||||
|
|
||||||
AutoCheckFlush acf(fDrawingManager);
|
AutoCheckFlush acf(fDrawingManager);
|
||||||
|
|
||||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
|
|
||||||
|
|
||||||
SkScalar width = nullptr == strokeInfo ? -1 : strokeInfo->getWidth();
|
SkScalar width = nullptr == strokeInfo ? -1 : strokeInfo->getWidth();
|
||||||
|
|
||||||
// Check if this is a full RT draw and can be replaced with a clear. We don't bother checking
|
// Check if this is a full RT draw and can be replaced with a clear. We don't bother checking
|
||||||
// cases where the RT is fully inside a stroke.
|
// cases where the RT is fully inside a stroke.
|
||||||
if (width < 0) {
|
if (width < 0) {
|
||||||
SkRect rtRect;
|
SkRect rtRect;
|
||||||
pipelineBuilder.getRenderTarget()->getBoundsRect(&rtRect);
|
fRenderTarget->getBoundsRect(&rtRect);
|
||||||
SkRect clipSpaceRTRect = rtRect;
|
SkRect clipSpaceRTRect = rtRect;
|
||||||
bool checkClip = GrClip::kWideOpen_ClipType != clip.clipType();
|
bool checkClip = GrClip::kWideOpen_ClipType != clip.clipType();
|
||||||
if (checkClip) {
|
if (checkClip) {
|
||||||
@ -287,7 +285,7 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrColor color = paint.getColor();
|
GrColor color = paint.getColor();
|
||||||
bool needAA = should_apply_coverage_aa(paint, pipelineBuilder.getRenderTarget());
|
bool needAA = should_apply_coverage_aa(paint, fRenderTarget);
|
||||||
|
|
||||||
// The fill path can handle rotation but not skew
|
// The fill path can handle rotation but not skew
|
||||||
// The stroke path needs the rect to remain axis aligned (no rotation or skew)
|
// The stroke path needs the rect to remain axis aligned (no rotation or skew)
|
||||||
@ -295,6 +293,8 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
|||||||
bool canApplyAA = width >=0 ? viewMatrix.rectStaysRect() :
|
bool canApplyAA = width >=0 ? viewMatrix.rectStaysRect() :
|
||||||
view_matrix_ok_for_aa_fill_rect(viewMatrix);
|
view_matrix_ok_for_aa_fill_rect(viewMatrix);
|
||||||
|
|
||||||
|
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
|
||||||
|
|
||||||
if (needAA && canApplyAA) {
|
if (needAA && canApplyAA) {
|
||||||
SkASSERT(!viewMatrix.hasPerspective());
|
SkASSERT(!viewMatrix.hasPerspective());
|
||||||
SkAutoTUnref<GrDrawBatch> batch;
|
SkAutoTUnref<GrDrawBatch> batch;
|
||||||
@ -365,7 +365,8 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
|
|||||||
AutoCheckFlush acf(fDrawingManager);
|
AutoCheckFlush acf(fDrawingManager);
|
||||||
|
|
||||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
|
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
|
||||||
if (should_apply_coverage_aa(paint, pipelineBuilder.getRenderTarget()) &&
|
|
||||||
|
if (should_apply_coverage_aa(paint, fRenderTarget) &&
|
||||||
view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
|
view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
|
||||||
SkAutoTUnref<GrDrawBatch> batch(GrAAFillRectBatch::Create(
|
SkAutoTUnref<GrDrawBatch> batch(GrAAFillRectBatch::Create(
|
||||||
paint.getColor(), viewMatrix, localMatrix, rectToDraw));
|
paint.getColor(), viewMatrix, localMatrix, rectToDraw));
|
||||||
|
Loading…
Reference in New Issue
Block a user