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

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

Issue 1229143007: Start to propagate constness of GrPipelineBuilder up the stack (Closed) Base URL: https://skia.googlesource.com/skia.git@const-fix
Patch Set: rebase Created 5 years, 5 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/GrAARectRenderer.h ('k') | src/gpu/GrClipMaskManager.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 2012 Google Inc. 2 * Copyright 2012 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 "GrAARectRenderer.h" 8 #include "GrAARectRenderer.h"
9 #include "GrBatch.h" 9 #include "GrBatch.h"
10 #include "GrBatchTarget.h" 10 #include "GrBatchTarget.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 namespace { 308 namespace {
309 // Should the coverage be multiplied into the color attrib or use a separate att rib. 309 // Should the coverage be multiplied into the color attrib or use a separate att rib.
310 enum CoverageAttribType { 310 enum CoverageAttribType {
311 kUseColor_CoverageAttribType, 311 kUseColor_CoverageAttribType,
312 kUseCoverage_CoverageAttribType, 312 kUseCoverage_CoverageAttribType,
313 }; 313 };
314 } 314 }
315 315
316 void GrAARectRenderer::GeometryFillAARect(GrDrawTarget* target, 316 void GrAARectRenderer::GeometryFillAARect(GrDrawTarget* target,
317 GrPipelineBuilder* pipelineBuilder, 317 const GrPipelineBuilder& pipelineBuild er,
318 GrColor color, 318 GrColor color,
319 const SkMatrix& viewMatrix, 319 const SkMatrix& viewMatrix,
320 const SkRect& rect, 320 const SkRect& rect,
321 const SkRect& devRect) { 321 const SkRect& devRect) {
322 AAFillRectBatch::Geometry geometry; 322 AAFillRectBatch::Geometry geometry;
323 geometry.fRect = rect; 323 geometry.fRect = rect;
324 geometry.fViewMatrix = viewMatrix; 324 geometry.fViewMatrix = viewMatrix;
325 geometry.fDevRect = devRect; 325 geometry.fDevRect = devRect;
326 geometry.fColor = color; 326 geometry.fColor = color;
327 327
328 328
329 SkAutoTUnref<GrBatch> batch(AAFillRectBatch::Create(geometry)); 329 SkAutoTUnref<GrBatch> batch(AAFillRectBatch::Create(geometry));
330 target->drawBatch(pipelineBuilder, batch); 330 target->drawBatch(pipelineBuilder, batch);
331 } 331 }
332 332
333 void GrAARectRenderer::StrokeAARect(GrDrawTarget* target, 333 void GrAARectRenderer::StrokeAARect(GrDrawTarget* target,
334 GrPipelineBuilder* pipelineBuilder, 334 const GrPipelineBuilder& pipelineBuilder,
335 GrColor color, 335 GrColor color,
336 const SkMatrix& viewMatrix, 336 const SkMatrix& viewMatrix,
337 const SkRect& rect, 337 const SkRect& rect,
338 const SkRect& devRect, 338 const SkRect& devRect,
339 const SkStrokeRec& stroke) { 339 const SkStrokeRec& stroke) {
340 SkVector devStrokeSize; 340 SkVector devStrokeSize;
341 SkScalar width = stroke.getWidth(); 341 SkScalar width = stroke.getWidth();
342 if (width > 0) { 342 if (width > 0) {
343 devStrokeSize.set(width, width); 343 devStrokeSize.set(width, width);
344 viewMatrix.mapVectors(&devStrokeSize, 1); 344 viewMatrix.mapVectors(&devStrokeSize, 1);
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 bool fCoverageIgnored; 766 bool fCoverageIgnored;
767 bool fMiterStroke; 767 bool fMiterStroke;
768 bool fCanTweakAlphaForCoverage; 768 bool fCanTweakAlphaForCoverage;
769 }; 769 };
770 770
771 BatchTracker fBatch; 771 BatchTracker fBatch;
772 SkSTArray<1, Geometry, true> fGeoData; 772 SkSTArray<1, Geometry, true> fGeoData;
773 }; 773 };
774 774
775 void GrAARectRenderer::GeometryStrokeAARect(GrDrawTarget* target, 775 void GrAARectRenderer::GeometryStrokeAARect(GrDrawTarget* target,
776 GrPipelineBuilder* pipelineBuilder, 776 const GrPipelineBuilder& pipelineBui lder,
777 GrColor color, 777 GrColor color,
778 const SkMatrix& viewMatrix, 778 const SkMatrix& viewMatrix,
779 const SkRect& devOutside, 779 const SkRect& devOutside,
780 const SkRect& devOutsideAssist, 780 const SkRect& devOutsideAssist,
781 const SkRect& devInside, 781 const SkRect& devInside,
782 bool miterStroke) { 782 bool miterStroke) {
783 AAStrokeRectBatch::Geometry geometry; 783 AAStrokeRectBatch::Geometry geometry;
784 geometry.fColor = color; 784 geometry.fColor = color;
785 geometry.fDevOutside = devOutside; 785 geometry.fDevOutside = devOutside;
786 geometry.fDevOutsideAssist = devOutsideAssist; 786 geometry.fDevOutsideAssist = devOutsideAssist;
787 geometry.fDevInside = devInside; 787 geometry.fDevInside = devInside;
788 geometry.fMiterStroke = miterStroke; 788 geometry.fMiterStroke = miterStroke;
789 789
790 SkAutoTUnref<GrBatch> batch(AAStrokeRectBatch::Create(geometry, viewMatrix)) ; 790 SkAutoTUnref<GrBatch> batch(AAStrokeRectBatch::Create(geometry, viewMatrix)) ;
791 target->drawBatch(pipelineBuilder, batch); 791 target->drawBatch(pipelineBuilder, batch);
792 } 792 }
793 793
794 void GrAARectRenderer::FillAANestedRects(GrDrawTarget* target, 794 void GrAARectRenderer::FillAANestedRects(GrDrawTarget* target,
795 GrPipelineBuilder* pipelineBuilder, 795 const GrPipelineBuilder& pipelineBuilde r,
796 GrColor color, 796 GrColor color,
797 const SkMatrix& viewMatrix, 797 const SkMatrix& viewMatrix,
798 const SkRect rects[2]) { 798 const SkRect rects[2]) {
799 SkASSERT(viewMatrix.rectStaysRect()); 799 SkASSERT(viewMatrix.rectStaysRect());
800 SkASSERT(!rects[0].isEmpty() && !rects[1].isEmpty()); 800 SkASSERT(!rects[0].isEmpty() && !rects[1].isEmpty());
801 801
802 SkRect devOutside, devInside; 802 SkRect devOutside, devInside;
803 viewMatrix.mapRect(&devOutside, rects[0]); 803 viewMatrix.mapRect(&devOutside, rects[0]);
804 viewMatrix.mapRect(&devInside, rects[1]); 804 viewMatrix.mapRect(&devInside, rects[1]);
805 805
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 geo.fColor = GrRandomColor(random); 841 geo.fColor = GrRandomColor(random);
842 geo.fDevOutside = outside; 842 geo.fDevOutside = outside;
843 geo.fDevOutsideAssist = outsideAssist; 843 geo.fDevOutsideAssist = outsideAssist;
844 geo.fDevInside = inside; 844 geo.fDevInside = inside;
845 geo.fMiterStroke = miterStroke; 845 geo.fMiterStroke = miterStroke;
846 846
847 return AAStrokeRectBatch::Create(geo, GrTest::TestMatrix(random)); 847 return AAStrokeRectBatch::Create(geo, GrTest::TestMatrix(random));
848 } 848 }
849 849
850 #endif 850 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAARectRenderer.h ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698