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

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

Issue 930123002: fix for ASAN heap overflow (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 10 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 | « no previous file | no next file » | 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 "GrAAHairLinePathRenderer.h" 8 #include "GrAAHairLinePathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 batchTarget->caps(), 862 batchTarget->caps(),
863 *geometryProcessorLocalM, 863 *geometryProcessorLocalM,
864 this->coverage())); 864 this->coverage()));
865 865
866 // This is hand inlined for maximum performance. 866 // This is hand inlined for maximum performance.
867 PREALLOC_PTARRAY(128) lines; 867 PREALLOC_PTARRAY(128) lines;
868 PREALLOC_PTARRAY(128) quads; 868 PREALLOC_PTARRAY(128) quads;
869 PREALLOC_PTARRAY(128) conics; 869 PREALLOC_PTARRAY(128) conics;
870 IntArray qSubdivs; 870 IntArray qSubdivs;
871 FloatArray cWeights; 871 FloatArray cWeights;
872 int quadCount = 0;
872 873
873 int instanceCount = fGeoData.count(); 874 int instanceCount = fGeoData.count();
874 for (int i = 0; i < instanceCount; i++) { 875 for (int i = 0; i < instanceCount; i++) {
875 const Geometry& args = fGeoData[i]; 876 const Geometry& args = fGeoData[i];
876 gather_lines_and_quads(args.fPath, args.fViewMatrix, args.fDevClipBounds , 877 quadCount += gather_lines_and_quads(args.fPath, args.fViewMatrix, args.f DevClipBounds,
877 &lines, &quads, &conics, &qSubdivs, &cWeights); 878 &lines, &quads, &conics, &qSubdivs, &cWeights);
878 } 879 }
879 880
880 int quadCount = quads.count() / 3;
881 int lineCount = lines.count() / 2; 881 int lineCount = lines.count() / 2;
882 int conicCount = conics.count() / 3; 882 int conicCount = conics.count() / 3;
883 883
884 // do lines first 884 // do lines first
885 if (lineCount) { 885 if (lineCount) {
886 batchTarget->initDraw(lineGP, pipeline); 886 batchTarget->initDraw(lineGP, pipeline);
887 887
888 // TODO remove this when batch is everywhere 888 // TODO remove this when batch is everywhere
889 GrPipelineInfo init; 889 GrPipelineInfo init;
890 init.fColorIgnored = fBatch.fColorIgnored; 890 init.fColorIgnored = fBatch.fColorIgnored;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 size_t vertexStride = sizeof(BezierVertex); 938 size_t vertexStride = sizeof(BezierVertex);
939 int vertexCount = kQuadNumVertices * quadCount + kQuadNumVertices * coni cCount; 939 int vertexCount = kQuadNumVertices * quadCount + kQuadNumVertices * coni cCount;
940 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride, 940 void *vertices = batchTarget->vertexPool()->makeSpace(vertexStride,
941 vertexCount, 941 vertexCount,
942 &vertexBuffer, 942 &vertexBuffer,
943 &firstVertex); 943 &firstVertex);
944 944
945 // Setup vertices 945 // Setup vertices
946 BezierVertex* verts = reinterpret_cast<BezierVertex*>(vertices); 946 BezierVertex* verts = reinterpret_cast<BezierVertex*>(vertices);
947 947
948 // is this the same as quadcount? TODO
949 int unsubdivQuadCnt = quads.count() / 3; 948 int unsubdivQuadCnt = quads.count() / 3;
950 for (int i = 0; i < unsubdivQuadCnt; ++i) { 949 for (int i = 0; i < unsubdivQuadCnt; ++i) {
951 SkASSERT(qSubdivs[i] >= 0); 950 SkASSERT(qSubdivs[i] >= 0);
952 add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts); 951 add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts);
953 } 952 }
954 953
955 // Start Conics 954 // Start Conics
956 for (int i = 0; i < conicCount; ++i) { 955 for (int i = 0; i < conicCount; ++i) {
957 add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &verts); 956 add_conics(&conics[3*i], cWeights[i], toDevice, toSrc, &verts);
958 } 957 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 geometry.fPath = path; 1051 geometry.fPath = path;
1053 SkDEBUGCODE(geometry.fDevBounds = devRect;) 1052 SkDEBUGCODE(geometry.fDevBounds = devRect;)
1054 geometry.fDevClipBounds = devClipBounds; 1053 geometry.fDevClipBounds = devClipBounds;
1055 1054
1056 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf fer, 1055 SkAutoTUnref<GrBatch> batch(AAHairlineBatch::Create(geometry, fLinesIndexBuf fer,
1057 fQuadsIndexBuffer)); 1056 fQuadsIndexBuffer));
1058 target->drawBatch(pipelineBuilder, batch, &devRect); 1057 target->drawBatch(pipelineBuilder, batch, &devRect);
1059 1058
1060 return true; 1059 return true;
1061 } 1060 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698