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

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

Issue 817853002: Remove localcoordchange functions off paint (Closed) Base URL: https://skia.googlesource.com/skia.git@local-matrix-on-gp
Patch Set: changing ignores Created 6 years 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/GrClipMaskManager.cpp ('k') | src/gpu/GrDefaultGeoProcFactory.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 2011 Google Inc. 3 * Copyright 2011 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 "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 548 }
549 549
550 void GrContext::drawPaint(const GrPaint& origPaint, const SkMatrix& viewMatrix) { 550 void GrContext::drawPaint(const GrPaint& origPaint, const SkMatrix& viewMatrix) {
551 // set rect to be big enough to fill the space, but not super-huge, so we 551 // set rect to be big enough to fill the space, but not super-huge, so we
552 // don't overflow fixed-point implementations 552 // don't overflow fixed-point implementations
553 SkRect r; 553 SkRect r;
554 r.setLTRB(0, 0, 554 r.setLTRB(0, 0,
555 SkIntToScalar(getRenderTarget()->width()), 555 SkIntToScalar(getRenderTarget()->width()),
556 SkIntToScalar(getRenderTarget()->height())); 556 SkIntToScalar(getRenderTarget()->height()));
557 SkTCopyOnFirstWrite<GrPaint> paint(origPaint); 557 SkTCopyOnFirstWrite<GrPaint> paint(origPaint);
558 GR_CREATE_TRACE_MARKER_CONTEXT("GrContext::drawPaint", this); 558
559 // by definition this fills the entire clip, no need for AA
560 if (paint->isAntiAlias()) {
561 paint.writable()->setAntiAlias(false);
562 }
563
564 bool isPerspective = viewMatrix.hasPerspective();
559 565
560 // We attempt to map r by the inverse matrix and draw that. mapRect will 566 // We attempt to map r by the inverse matrix and draw that. mapRect will
561 // map the four corners and bound them with a new rect. This will not 567 // map the four corners and bound them with a new rect. This will not
562 // produce a correct result for some perspective matrices. 568 // produce a correct result for some perspective matrices.
563 if (!viewMatrix.hasPerspective()) { 569 if (!isPerspective) {
564 SkMatrix inverse; 570 SkMatrix inverse;
565 if (!viewMatrix.invert(&inverse)) { 571 if (!viewMatrix.invert(&inverse)) {
566 SkDebugf("Could not invert matrix\n"); 572 SkDebugf("Could not invert matrix\n");
567 return; 573 return;
568 } 574 }
569 inverse.mapRect(&r); 575 inverse.mapRect(&r);
576 this->drawRect(*paint, viewMatrix, r);
570 } else { 577 } else {
571 if (!paint.writable()->localCoordChangeInverse(viewMatrix)) { 578 SkMatrix localMatrix;
579 if (!viewMatrix.invert(&localMatrix)) {
572 SkDebugf("Could not invert matrix\n"); 580 SkDebugf("Could not invert matrix\n");
573 return; 581 return;
574 } 582 }
583
584 AutoCheckFlush acf(this);
585 GrDrawState drawState;
586 GrDrawTarget* target = this->prepareToDraw(&drawState, paint, &SkMatrix: :I(), &acf);
587 if (NULL == target) {
588 return;
589 }
590
591 GR_CREATE_TRACE_MARKER("GrContext::drawPaintWithPerspective", target);
592 target->drawRect(&drawState, paint->getColor(), r, NULL, &localMatrix);
575 } 593 }
576 // by definition this fills the entire clip, no need for AA
577 if (paint->isAntiAlias()) {
578 paint.writable()->setAntiAlias(false);
579 }
580 this->drawRect(*paint, viewMatrix.hasPerspective() ? SkMatrix::I() : viewMat rix, r);
581 } 594 }
582 595
583 #ifdef SK_DEVELOPER 596 #ifdef SK_DEVELOPER
584 void GrContext::dumpFontCache() const { 597 void GrContext::dumpFontCache() const {
585 fFontCache->dump(); 598 fFontCache->dump();
586 } 599 }
587 #endif 600 #endif
588 601
589 //////////////////////////////////////////////////////////////////////////////// 602 ////////////////////////////////////////////////////////////////////////////////
590 603
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 fResourceCache2->printStats(); 1749 fResourceCache2->printStats();
1737 } 1750 }
1738 #endif 1751 #endif
1739 1752
1740 #if GR_GPU_STATS 1753 #if GR_GPU_STATS
1741 const GrContext::GPUStats* GrContext::gpuStats() const { 1754 const GrContext::GPUStats* GrContext::gpuStats() const {
1742 return fGpu->gpuStats(); 1755 return fGpu->gpuStats();
1743 } 1756 }
1744 #endif 1757 #endif
1745 1758
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDefaultGeoProcFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698