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

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

Issue 441623005: Remove unused matrix param from GrContext/GrDrawTarget rect drawing functions. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 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/GrInOrderDrawBuffer.h ('k') | src/gpu/GrOvalRenderer.cpp » ('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 * 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 #include "GrInOrderDrawBuffer.h" 8 #include "GrInOrderDrawBuffer.h"
9 9
10 #include "GrBufferAllocPool.h" 10 #include "GrBufferAllocPool.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 static uint8_t strip_trace_bit(uint8_t cmd) { 131 static uint8_t strip_trace_bit(uint8_t cmd) {
132 return cmd & kCmdMask; 132 return cmd & kCmdMask;
133 } 133 }
134 134
135 static bool cmd_has_trace_marker(uint8_t cmd) { 135 static bool cmd_has_trace_marker(uint8_t cmd) {
136 return SkToBool(cmd & kTraceCmdBit); 136 return SkToBool(cmd & kTraceCmdBit);
137 } 137 }
138 138
139 void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, 139 void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
140 const SkMatrix* matrix,
141 const SkRect* localRect, 140 const SkRect* localRect,
142 const SkMatrix* localMatrix) { 141 const SkMatrix* localMatrix) {
143 GrDrawState::AutoColorRestore acr; 142 GrDrawState::AutoColorRestore acr;
144 143
145 GrDrawState* drawState = this->drawState(); 144 GrDrawState* drawState = this->drawState();
146 145
147 GrColor color = drawState->getColor(); 146 GrColor color = drawState->getColor();
148 147
149 int colorOffset, localOffset; 148 int colorOffset, localOffset;
150 set_vertex_attributes(drawState, 149 set_vertex_attributes(drawState,
151 this->caps()->dualSourceBlendingSupport() || drawState->hasSo lidCoverage(), 150 this->caps()->dualSourceBlendingSupport() || drawState->hasSo lidCoverage(),
152 NULL != localRect, 151 NULL != localRect,
153 &colorOffset, &localOffset); 152 &colorOffset, &localOffset);
154 if (colorOffset >= 0) { 153 if (colorOffset >= 0) {
155 // We set the draw state's color to white here. This is done so that any batching performed 154 // We set the draw state's color to white here. This is done so that any batching performed
156 // in our subclass's onDraw() won't get a false from GrDrawState::op== d ue to a color 155 // in our subclass's onDraw() won't get a false from GrDrawState::op== d ue to a color
157 // mismatch. TODO: Once vertex layout is owned by GrDrawState it should skip comparing the 156 // mismatch. TODO: Once vertex layout is owned by GrDrawState it should skip comparing the
158 // constant color in its op== when the kColor layout bit is set and then we can remove 157 // constant color in its op== when the kColor layout bit is set and then we can remove
159 // this. 158 // this.
160 acr.set(drawState, 0xFFFFFFFF); 159 acr.set(drawState, 0xFFFFFFFF);
161 } 160 }
162 161
163 AutoReleaseGeometry geo(this, 4, 0); 162 AutoReleaseGeometry geo(this, 4, 0);
164 if (!geo.succeeded()) { 163 if (!geo.succeeded()) {
165 GrPrintf("Failed to get space for vertices!\n"); 164 GrPrintf("Failed to get space for vertices!\n");
166 return; 165 return;
167 } 166 }
168 167
169 // Go to device coords to allow batching across matrix changes 168 // Go to device coords to allow batching across matrix changes
170 SkMatrix combinedMatrix; 169 SkMatrix matrix = drawState->getViewMatrix();
171 if (NULL != matrix) { 170
172 combinedMatrix = *matrix;
173 } else {
174 combinedMatrix.reset();
175 }
176 combinedMatrix.postConcat(drawState->getViewMatrix());
177 // When the caller has provided an explicit source rect for a stage then we don't want to 171 // When the caller has provided an explicit source rect for a stage then we don't want to
178 // modify that stage's matrix. Otherwise if the effect is generating its sou rce rect from 172 // modify that stage's matrix. Otherwise if the effect is generating its sou rce rect from
179 // the vertex positions then we have to account for the view matrix change. 173 // the vertex positions then we have to account for the view matrix change.
180 GrDrawState::AutoViewMatrixRestore avmr; 174 GrDrawState::AutoViewMatrixRestore avmr;
181 if (!avmr.setIdentity(drawState)) { 175 if (!avmr.setIdentity(drawState)) {
182 return; 176 return;
183 } 177 }
184 178
185 size_t vsize = drawState->getVertexSize(); 179 size_t vsize = drawState->getVertexSize();
186 180
187 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom , vsize); 181 geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom , vsize);
188 combinedMatrix.mapPointsWithStride(geo.positions(), vsize, 4); 182 matrix.mapPointsWithStride(geo.positions(), vsize, 4);
189 183
190 SkRect devBounds; 184 SkRect devBounds;
191 // since we already computed the dev verts, set the bounds hint. This will h elp us avoid 185 // since we already computed the dev verts, set the bounds hint. This will h elp us avoid
192 // unnecessary clipping in our onDraw(). 186 // unnecessary clipping in our onDraw().
193 get_vertex_bounds(geo.vertices(), vsize, 4, &devBounds); 187 get_vertex_bounds(geo.vertices(), vsize, 4, &devBounds);
194 188
195 if (localOffset >= 0) { 189 if (localOffset >= 0) {
196 SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + localOffset); 190 SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + localOffset);
197 coords->setRectFan(localRect->fLeft, localRect->fTop, 191 coords->setRectFan(localRect->fLeft, localRect->fTop,
198 localRect->fRight, localRect->fBottom, 192 localRect->fRight, localRect->fBottom,
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 GrInOrderDrawBuffer::CopySurface* GrInOrderDrawBuffer::recordCopySurface() { 986 GrInOrderDrawBuffer::CopySurface* GrInOrderDrawBuffer::recordCopySurface() {
993 this->addToCmdBuffer(kCopySurface_Cmd); 987 this->addToCmdBuffer(kCopySurface_Cmd);
994 return &fCopySurfaces.push_back(); 988 return &fCopySurfaces.push_back();
995 } 989 }
996 990
997 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { 991 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) {
998 INHERITED::clipWillBeSet(newClipData); 992 INHERITED::clipWillBeSet(newClipData);
999 fClipSet = true; 993 fClipSet = true;
1000 fClipProxyState = kUnknown_ClipProxyState; 994 fClipProxyState = kUnknown_ClipProxyState;
1001 } 995 }
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698