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

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

Issue 2271053004: Convert drawPaint to drawRRect in simple cases (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix another msvs warning Created 4 years, 3 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/GrClipStackClip.cpp ('k') | src/gpu/GrFixedClip.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrBatchTest.h" 8 #include "GrBatchTest.h"
9 #include "GrColor.h" 9 #include "GrColor.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPaint"); 244 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPaint");
245 245
246 // set rect to be big enough to fill the space, but not super-huge, so we 246 // set rect to be big enough to fill the space, but not super-huge, so we
247 // don't overflow fixed-point implementations 247 // don't overflow fixed-point implementations
248 SkRect r; 248 SkRect r;
249 r.setLTRB(0, 0, 249 r.setLTRB(0, 0,
250 SkIntToScalar(fRenderTarget->width()), 250 SkIntToScalar(fRenderTarget->width()),
251 SkIntToScalar(fRenderTarget->height())); 251 SkIntToScalar(fRenderTarget->height()));
252 SkTCopyOnFirstWrite<GrPaint> paint(origPaint); 252 SkTCopyOnFirstWrite<GrPaint> paint(origPaint);
253 253
254 SkRRect rrect;
255 bool aaRRect;
256 // Check if we can replace a clipRRect()/drawPaint() with a drawRRect(). We only do the
257 // transformation for non-rect rrects. Rects caused a performance regression on an Android
258 // test that needs investigation. We also skip cases where there are fragmen t processors
259 // because they may depend on having correct local coords and this path draw s in device space
260 // without a local matrix.
261 if (!paint->numTotalFragmentProcessors() &&
262 clip.isRRect(r, &rrect, &aaRRect) && !rrect.isRect()) {
263 paint.writable()->setAntiAlias(aaRRect);
264 this->drawRRect(GrNoClip(), *paint, SkMatrix::I(), rrect, GrStyle::Simpl eFill());
265 return;
266 }
267
254 // by definition this fills the entire clip, no need for AA 268 // by definition this fills the entire clip, no need for AA
255 if (paint->isAntiAlias()) { 269 if (paint->isAntiAlias()) {
256 paint.writable()->setAntiAlias(false); 270 paint.writable()->setAntiAlias(false);
257 } 271 }
258 272
259 bool isPerspective = viewMatrix.hasPerspective(); 273 bool isPerspective = viewMatrix.hasPerspective();
260 274
261 // We attempt to map r by the inverse matrix and draw that. mapRect will 275 // We attempt to map r by the inverse matrix and draw that. mapRect will
262 // map the four corners and bound them with a new rect. This will not 276 // map the four corners and bound them with a new rect. This will not
263 // produce a correct result for some perspective matrices. 277 // produce a correct result for some perspective matrices.
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 1383
1370 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, 1384 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip,
1371 GrDrawBatch* batch) { 1385 GrDrawBatch* batch) {
1372 ASSERT_SINGLE_OWNER 1386 ASSERT_SINGLE_OWNER
1373 RETURN_IF_ABANDONED 1387 RETURN_IF_ABANDONED
1374 SkDEBUGCODE(this->validate();) 1388 SkDEBUGCODE(this->validate();)
1375 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 1389 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
1376 1390
1377 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); 1391 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
1378 } 1392 }
OLDNEW
« no previous file with comments | « src/gpu/GrClipStackClip.cpp ('k') | src/gpu/GrFixedClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698