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/core/SkDevice.cpp

Issue 469333002: Patches memory leak and crashing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Don't switch to unsigned Created 6 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 | src/utils/SkPatchUtils.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 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 "SkDevice.h" 8 #include "SkDevice.h"
9 #include "SkDraw.h" 9 #include "SkDraw.h"
10 #include "SkMetaData.h" 10 #include "SkMetaData.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 this->drawPath(draw, path, paint, preMatrix, pathIsMutable); 79 this->drawPath(draw, path, paint, preMatrix, pathIsMutable);
80 } 80 }
81 81
82 void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPoint cubics[12], const SkColor colors[4], 82 void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPoint cubics[12], const SkColor colors[4],
83 const SkPoint texCoords[4], SkXfermode* xmode, cons t SkPaint& paint) { 83 const SkPoint texCoords[4], SkXfermode* xmode, cons t SkPaint& paint) {
84 SkPatchUtils::VertexData data; 84 SkPatchUtils::VertexData data;
85 85
86 SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, draw.fMatrix); 86 SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, draw.fMatrix);
87 87
88 // It automatically adjusts lodX and lodY in case it exceeds the number of i ndices. 88 // It automatically adjusts lodX and lodY in case it exceeds the number of i ndices.
89 SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(), l od.height()); 89 // If it fails to generate the vertices, then we do not draw.
90 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.fPoints, 90 if (SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width( ), lod.height())) {
91 data.fTexCoords, data.fColors, xmode, data.fIndices, data .fIndexCount, 91 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCo unt, data.fPoints,
92 paint); 92 data.fTexCoords, data.fColors, xmode, data.fIndices, data.fIndexCount,
93 paint);
94 }
93 } 95 }
94 96
95 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt es, int x, int y) { 97 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt es, int x, int y) {
96 #ifdef SK_DEBUG 98 #ifdef SK_DEBUG
97 SkASSERT(info.width() > 0 && info.height() > 0); 99 SkASSERT(info.width() > 0 && info.height() > 0);
98 SkASSERT(dstP); 100 SkASSERT(dstP);
99 SkASSERT(rowBytes >= info.minRowBytes()); 101 SkASSERT(rowBytes >= info.minRowBytes());
100 SkASSERT(x >= 0 && y >= 0); 102 SkASSERT(x >= 0 && y >= 0);
101 103
102 const SkImageInfo& srcInfo = this->imageInfo(); 104 const SkImageInfo& srcInfo = this->imageInfo();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 149
148 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { 150 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) {
149 // The base class doesn't perform any analysis but derived classes may 151 // The base class doesn't perform any analysis but derived classes may
150 } 152 }
151 153
152 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S kMatrix*, 154 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S kMatrix*,
153 const SkPaint*) { 155 const SkPaint*) {
154 // The base class doesn't perform any accelerated picture rendering 156 // The base class doesn't perform any accelerated picture rendering
155 return false; 157 return false;
156 } 158 }
OLDNEW
« no previous file with comments | « no previous file | src/utils/SkPatchUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698