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

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

Issue 1270103003: Fix SkData leaks at GrResourceKey::setCustomData() call sites. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | tests/ResourceCacheTest.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 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 "GrTessellatingPathRenderer.h" 8 #include "GrTessellatingPathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 SkPoint* end = polys_to_triangles(polys, fillType, verts); 1482 SkPoint* end = polys_to_triangles(polys, fillType, verts);
1483 vertexBuffer->unmap(); 1483 vertexBuffer->unmap();
1484 int actualCount = static_cast<int>(end - verts); 1484 int actualCount = static_cast<int>(end - verts);
1485 LOG("actual count: %d\n", actualCount); 1485 LOG("actual count: %d\n", actualCount);
1486 SkASSERT(actualCount <= count); 1486 SkASSERT(actualCount <= count);
1487 1487
1488 if (!fPath.isVolatile()) { 1488 if (!fPath.isVolatile()) {
1489 TessInfo info; 1489 TessInfo info;
1490 info.fTolerance = isLinear ? 0 : tol; 1490 info.fTolerance = isLinear ? 0 : tol;
1491 info.fCount = actualCount; 1491 info.fCount = actualCount;
1492 key->setCustomData(SkData::NewWithCopy(&info, sizeof(info))); 1492 SkAutoTUnref<SkData> data(SkData::NewWithCopy(&info, sizeof(info)));
1493 key->setCustomData(data.get());
1493 resourceProvider->assignUniqueKeyToResource(*key, vertexBuffer.get() ); 1494 resourceProvider->assignUniqueKeyToResource(*key, vertexBuffer.get() );
1494 SkPathPriv::AddGenIDChangeListener(fPath, SkNEW(PathInvalidator(*key ))); 1495 SkPathPriv::AddGenIDChangeListener(fPath, SkNEW(PathInvalidator(*key )));
1495 } 1496 }
1496 return actualCount; 1497 return actualCount;
1497 } 1498 }
1498 1499
1499 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 1500 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
1500 // construct a cache key from the path's genID and the view matrix 1501 // construct a cache key from the path's genID and the view matrix
1501 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain() ; 1502 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain() ;
1502 GrUniqueKey key; 1503 GrUniqueKey key;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 SkMatrix vmi; 1608 SkMatrix vmi;
1608 bool result = viewMatrix.invert(&vmi); 1609 bool result = viewMatrix.invert(&vmi);
1609 if (!result) { 1610 if (!result) {
1610 SkFAIL("Cannot invert matrix\n"); 1611 SkFAIL("Cannot invert matrix\n");
1611 } 1612 }
1612 vmi.mapRect(&clipBounds); 1613 vmi.mapRect(&clipBounds);
1613 return TessellatingPathBatch::Create(color, path, viewMatrix, clipBounds); 1614 return TessellatingPathBatch::Create(color, path, viewMatrix, clipBounds);
1614 } 1615 }
1615 1616
1616 #endif 1617 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/ResourceCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698