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

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

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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/GrBitmapTextContext.h ('k') | src/gpu/GrDefaultGeoProcFactory.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 /* 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 GrColor fColor; 498 GrColor fColor;
499 SkMatrix fViewMatrix; 499 SkMatrix fViewMatrix;
500 SkRect fRect; 500 SkRect fRect;
501 SkScalar fStrokeWidth; 501 SkScalar fStrokeWidth;
502 }; 502 };
503 503
504 static GrBatch* Create(const Geometry& geometry) { 504 static GrBatch* Create(const Geometry& geometry) {
505 return SkNEW_ARGS(StrokeRectBatch, (geometry)); 505 return SkNEW_ARGS(StrokeRectBatch, (geometry));
506 } 506 }
507 507
508 const char* name() const SK_OVERRIDE { return "StrokeRectBatch"; } 508 const char* name() const override { return "StrokeRectBatch"; }
509 509
510 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE { 510 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
511 // When this is called on a batch, there is only one geometry bundle 511 // When this is called on a batch, there is only one geometry bundle
512 out->setKnownFourComponents(fGeoData[0].fColor); 512 out->setKnownFourComponents(fGeoData[0].fColor);
513 } 513 }
514 514
515 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRID E { 515 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
516 out->setKnownSingleComponent(0xff); 516 out->setKnownSingleComponent(0xff);
517 } 517 }
518 518
519 void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE { 519 void initBatchTracker(const GrPipelineInfo& init) override {
520 // Handle any color overrides 520 // Handle any color overrides
521 if (init.fColorIgnored) { 521 if (init.fColorIgnored) {
522 fGeoData[0].fColor = GrColor_ILLEGAL; 522 fGeoData[0].fColor = GrColor_ILLEGAL;
523 } else if (GrColor_ILLEGAL != init.fOverrideColor) { 523 } else if (GrColor_ILLEGAL != init.fOverrideColor) {
524 fGeoData[0].fColor = init.fOverrideColor; 524 fGeoData[0].fColor = init.fOverrideColor;
525 } 525 }
526 526
527 // setup batch properties 527 // setup batch properties
528 fBatch.fColorIgnored = init.fColorIgnored; 528 fBatch.fColorIgnored = init.fColorIgnored;
529 fBatch.fColor = fGeoData[0].fColor; 529 fBatch.fColor = fGeoData[0].fColor;
530 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 530 fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
531 fBatch.fCoverageIgnored = init.fCoverageIgnored; 531 fBatch.fCoverageIgnored = init.fCoverageIgnored;
532 } 532 }
533 533
534 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) SK_OVERRIDE { 534 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
535 SkAutoTUnref<const GrGeometryProcessor> gp( 535 SkAutoTUnref<const GrGeometryProcessor> gp(
536 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi on_GPType, 536 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi on_GPType,
537 this->color(), 537 this->color(),
538 this->viewMatrix(), 538 this->viewMatrix(),
539 SkMatrix::I())); 539 SkMatrix::I()));
540 540
541 batchTarget->initDraw(gp, pipeline); 541 batchTarget->initDraw(gp, pipeline);
542 542
543 // TODO this is hacky, but the only way we have to initialize the GP is to use the 543 // TODO this is hacky, but the only way we have to initialize the GP is to use the
544 // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch 544 // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 verts[9] = verts[1]; 639 verts[9] = verts[1];
640 } 640 }
641 641
642 642
643 GrColor color() const { return fBatch.fColor; } 643 GrColor color() const { return fBatch.fColor; }
644 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } 644 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
645 bool colorIgnored() const { return fBatch.fColorIgnored; } 645 bool colorIgnored() const { return fBatch.fColorIgnored; }
646 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } 646 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
647 bool hairline() const { return fBatch.fHairline; } 647 bool hairline() const { return fBatch.fHairline; }
648 648
649 bool onCombineIfPossible(GrBatch* t) SK_OVERRIDE { 649 bool onCombineIfPossible(GrBatch* t) override {
650 // StrokeRectBatch* that = t->cast<StrokeRectBatch>(); 650 // StrokeRectBatch* that = t->cast<StrokeRectBatch>();
651 651
652 // NonAA stroke rects cannot batch right now 652 // NonAA stroke rects cannot batch right now
653 // TODO make these batchable 653 // TODO make these batchable
654 return false; 654 return false;
655 } 655 }
656 656
657 struct BatchTracker { 657 struct BatchTracker {
658 GrColor fColor; 658 GrColor fColor;
659 bool fUsesLocalCoords; 659 bool fUsesLocalCoords;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 static GrBatch* Create(const Geometry& geometry, GrPrimitiveType primitiveTy pe, 837 static GrBatch* Create(const Geometry& geometry, GrPrimitiveType primitiveTy pe,
838 const SkMatrix& viewMatrix, 838 const SkMatrix& viewMatrix,
839 const SkPoint* positions, int vertexCount, 839 const SkPoint* positions, int vertexCount,
840 const uint16_t* indices, int indexCount, 840 const uint16_t* indices, int indexCount,
841 const GrColor* colors, const SkPoint* localCoords) { 841 const GrColor* colors, const SkPoint* localCoords) {
842 return SkNEW_ARGS(DrawVerticesBatch, (geometry, primitiveType, viewMatri x, positions, 842 return SkNEW_ARGS(DrawVerticesBatch, (geometry, primitiveType, viewMatri x, positions,
843 vertexCount, indices, indexCount, colors, 843 vertexCount, indices, indexCount, colors,
844 localCoords)); 844 localCoords));
845 } 845 }
846 846
847 const char* name() const SK_OVERRIDE { return "DrawVerticesBatch"; } 847 const char* name() const override { return "DrawVerticesBatch"; }
848 848
849 void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE { 849 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
850 // When this is called on a batch, there is only one geometry bundle 850 // When this is called on a batch, there is only one geometry bundle
851 if (this->hasColors()) { 851 if (this->hasColors()) {
852 out->setUnknownFourComponents(); 852 out->setUnknownFourComponents();
853 } else { 853 } else {
854 out->setKnownFourComponents(fGeoData[0].fColor); 854 out->setKnownFourComponents(fGeoData[0].fColor);
855 } 855 }
856 } 856 }
857 857
858 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRID E { 858 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
859 out->setKnownSingleComponent(0xff); 859 out->setKnownSingleComponent(0xff);
860 } 860 }
861 861
862 void initBatchTracker(const GrPipelineInfo& init) SK_OVERRIDE { 862 void initBatchTracker(const GrPipelineInfo& init) override {
863 // Handle any color overrides 863 // Handle any color overrides
864 if (init.fColorIgnored) { 864 if (init.fColorIgnored) {
865 fGeoData[0].fColor = GrColor_ILLEGAL; 865 fGeoData[0].fColor = GrColor_ILLEGAL;
866 } else if (GrColor_ILLEGAL != init.fOverrideColor) { 866 } else if (GrColor_ILLEGAL != init.fOverrideColor) {
867 fGeoData[0].fColor = init.fOverrideColor; 867 fGeoData[0].fColor = init.fOverrideColor;
868 } 868 }
869 869
870 // setup batch properties 870 // setup batch properties
871 fBatch.fColorIgnored = init.fColorIgnored; 871 fBatch.fColorIgnored = init.fColorIgnored;
872 fBatch.fColor = fGeoData[0].fColor; 872 fBatch.fColor = fGeoData[0].fColor;
873 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 873 fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
874 fBatch.fCoverageIgnored = init.fCoverageIgnored; 874 fBatch.fCoverageIgnored = init.fCoverageIgnored;
875 } 875 }
876 876
877 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) SK_OVERRIDE { 877 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
878 int colorOffset = -1, texOffset = -1; 878 int colorOffset = -1, texOffset = -1;
879 SkAutoTUnref<const GrGeometryProcessor> gp( 879 SkAutoTUnref<const GrGeometryProcessor> gp(
880 set_vertex_attributes(this->hasLocalCoords(), this->hasColors(), &colorOffset, 880 set_vertex_attributes(this->hasLocalCoords(), this->hasColors(), &colorOffset,
881 &texOffset, this->color(), this->viewMatri x())); 881 &texOffset, this->color(), this->viewMatri x()));
882 882
883 batchTarget->initDraw(gp, pipeline); 883 batchTarget->initDraw(gp, pipeline);
884 884
885 // TODO this is hacky, but the only way we have to initialize the GP is to use the 885 // TODO this is hacky, but the only way we have to initialize the GP is to use the
886 // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch 886 // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch
887 // everywhere we can remove this nastiness 887 // everywhere we can remove this nastiness
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 GrColor color() const { return fBatch.fColor; } 1017 GrColor color() const { return fBatch.fColor; }
1018 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } 1018 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
1019 bool colorIgnored() const { return fBatch.fColorIgnored; } 1019 bool colorIgnored() const { return fBatch.fColorIgnored; }
1020 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } 1020 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; }
1021 bool hasColors() const { return fBatch.fHasColors; } 1021 bool hasColors() const { return fBatch.fHasColors; }
1022 bool hasIndices() const { return fBatch.fHasIndices; } 1022 bool hasIndices() const { return fBatch.fHasIndices; }
1023 bool hasLocalCoords() const { return fBatch.fHasLocalCoords; } 1023 bool hasLocalCoords() const { return fBatch.fHasLocalCoords; }
1024 int vertexCount() const { return fBatch.fVertexCount; } 1024 int vertexCount() const { return fBatch.fVertexCount; }
1025 int indexCount() const { return fBatch.fIndexCount; } 1025 int indexCount() const { return fBatch.fIndexCount; }
1026 1026
1027 bool onCombineIfPossible(GrBatch* t) SK_OVERRIDE { 1027 bool onCombineIfPossible(GrBatch* t) override {
1028 DrawVerticesBatch* that = t->cast<DrawVerticesBatch>(); 1028 DrawVerticesBatch* that = t->cast<DrawVerticesBatch>();
1029 1029
1030 if (!this->batchablePrimitiveType() || this->primitiveType() != that->pr imitiveType()) { 1030 if (!this->batchablePrimitiveType() || this->primitiveType() != that->pr imitiveType()) {
1031 return false; 1031 return false;
1032 } 1032 }
1033 1033
1034 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); 1034 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
1035 1035
1036 // We currently use a uniform viewmatrix for this batch 1036 // We currently use a uniform viewmatrix for this batch
1037 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) { 1037 if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 } 1999 }
2000 } 2000 }
2001 2001
2002 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 2002 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
2003 fGpu->removeGpuTraceMarker(marker); 2003 fGpu->removeGpuTraceMarker(marker);
2004 if (fDrawBuffer) { 2004 if (fDrawBuffer) {
2005 fDrawBuffer->removeGpuTraceMarker(marker); 2005 fDrawBuffer->removeGpuTraceMarker(marker);
2006 } 2006 }
2007 } 2007 }
2008 2008
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.h ('k') | src/gpu/GrDefaultGeoProcFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698