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

Side by Side Diff: src/gpu/GrSoftwarePathRenderer.cpp

Issue 1584703003: Remove two varieties of drawNonAARect from GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@hidedrawtargetabit
Patch Set: deprecation message on GrTest Created 4 years, 11 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/GrSWMaskHelper.cpp ('k') | src/gpu/GrTest.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 #include "GrSoftwarePathRenderer.h" 9 #include "GrSoftwarePathRenderer.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
11 #include "GrSWMaskHelper.h" 11 #include "GrSWMaskHelper.h"
12 #include "GrVertexBuffer.h" 12 #include "GrVertexBuffer.h"
13 #include "batches/GrRectBatchFactory.h"
13 14
14 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
15 bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { 16 bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
16 if (nullptr == fContext) { 17 if (nullptr == fContext) {
17 return false; 18 return false;
18 } 19 }
19 if (args.fStroke->isDashed()) { 20 if (args.fStroke->isDashed()) {
20 return false; 21 return false;
21 } 22 }
22 return true; 23 return true;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return false; 59 return false;
59 } 60 }
60 } else { 61 } else {
61 *devPathBounds = SkIRect::EmptyIRect(); 62 *devPathBounds = SkIRect::EmptyIRect();
62 return false; 63 return false;
63 } 64 }
64 return true; 65 return true;
65 } 66 }
66 67
67 //////////////////////////////////////////////////////////////////////////////// 68 ////////////////////////////////////////////////////////////////////////////////
69 static void draw_non_aa_rect(GrDrawTarget* drawTarget,
70 const GrPipelineBuilder& pipelineBuilder,
71 GrColor color,
72 const SkMatrix& viewMatrix,
73 const SkRect& rect,
74 const SkMatrix& localMatrix) {
75 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, v iewMatrix, rect,
76 nullptr, &localMatrix));
77 drawTarget->drawBatch(pipelineBuilder, batch);
78 }
79
68 void draw_around_inv_path(GrDrawTarget* target, 80 void draw_around_inv_path(GrDrawTarget* target,
69 GrPipelineBuilder* pipelineBuilder, 81 GrPipelineBuilder* pipelineBuilder,
70 GrColor color, 82 GrColor color,
71 const SkMatrix& viewMatrix, 83 const SkMatrix& viewMatrix,
72 const SkIRect& devClipBounds, 84 const SkIRect& devClipBounds,
73 const SkIRect& devPathBounds) { 85 const SkIRect& devPathBounds) {
74 SkMatrix invert; 86 SkMatrix invert;
75 if (!viewMatrix.invert(&invert)) { 87 if (!viewMatrix.invert(&invert)) {
76 return; 88 return;
77 } 89 }
78 90
79 SkRect rect; 91 SkRect rect;
80 if (devClipBounds.fTop < devPathBounds.fTop) { 92 if (devClipBounds.fTop < devPathBounds.fTop) {
81 rect.iset(devClipBounds.fLeft, devClipBounds.fTop, 93 rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
82 devClipBounds.fRight, devPathBounds.fTop); 94 devClipBounds.fRight, devPathBounds.fTop);
83 target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), rect, inve rt); 95 draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, i nvert);
84 } 96 }
85 if (devClipBounds.fLeft < devPathBounds.fLeft) { 97 if (devClipBounds.fLeft < devPathBounds.fLeft) {
86 rect.iset(devClipBounds.fLeft, devPathBounds.fTop, 98 rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
87 devPathBounds.fLeft, devPathBounds.fBottom); 99 devPathBounds.fLeft, devPathBounds.fBottom);
88 target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), rect, inve rt); 100 draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, i nvert);
89 } 101 }
90 if (devClipBounds.fRight > devPathBounds.fRight) { 102 if (devClipBounds.fRight > devPathBounds.fRight) {
91 rect.iset(devPathBounds.fRight, devPathBounds.fTop, 103 rect.iset(devPathBounds.fRight, devPathBounds.fTop,
92 devClipBounds.fRight, devPathBounds.fBottom); 104 devClipBounds.fRight, devPathBounds.fBottom);
93 target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), rect, inve rt); 105 draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, i nvert);
94 } 106 }
95 if (devClipBounds.fBottom > devPathBounds.fBottom) { 107 if (devClipBounds.fBottom > devPathBounds.fBottom) {
96 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, 108 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
97 devClipBounds.fRight, devClipBounds.fBottom); 109 devClipBounds.fRight, devClipBounds.fBottom);
98 target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), rect, inve rt); 110 draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, i nvert);
99 } 111 }
100 } 112 }
101 113
102 } 114 }
103 115
104 //////////////////////////////////////////////////////////////////////////////// 116 ////////////////////////////////////////////////////////////////////////////////
105 // return true on success; false on failure 117 // return true on success; false on failure
106 bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) { 118 bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
107 if (nullptr == fContext) { 119 if (nullptr == fContext) {
108 return false; 120 return false;
(...skipping 20 matching lines...) Expand all
129 GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipeli neBuilder, 141 GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipeli neBuilder,
130 args.fColor, *args.fViewMatrix, dev PathBounds); 142 args.fColor, *args.fViewMatrix, dev PathBounds);
131 143
132 if (args.fPath->isInverseFillType()) { 144 if (args.fPath->isInverseFillType()) {
133 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, * args.fViewMatrix, 145 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, * args.fViewMatrix,
134 devClipBounds, devPathBounds); 146 devClipBounds, devPathBounds);
135 } 147 }
136 148
137 return true; 149 return true;
138 } 150 }
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/gpu/GrTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698