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

Side by Side Diff: tools/render_pictures_main.cpp

Issue 12800002: Fixing crash in render_pictures when failing to create referenceBitmap for --validate (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 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 "CopyTilesRenderer.h" 8 #include "CopyTilesRenderer.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkBitmapFactory.h" 10 #include "SkBitmapFactory.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 SkDELETE(bitmap); 156 SkDELETE(bitmap);
157 return false; 157 return false;
158 } 158 }
159 159
160 if (FLAGS_validate) { 160 if (FLAGS_validate) {
161 SkBitmap* referenceBitmap = NULL; 161 SkBitmap* referenceBitmap = NULL;
162 sk_tools::SimplePictureRenderer referenceRenderer; 162 sk_tools::SimplePictureRenderer referenceRenderer;
163 success = render_picture(inputPath, NULL, referenceRenderer, 163 success = render_picture(inputPath, NULL, referenceRenderer,
164 &referenceBitmap); 164 &referenceBitmap);
165 165
166 if (!success || !referenceBitmap) { 166 if (!success || NULL == referenceBitmap || NULL == referenceBitmap->getP ixels()) {
167 SkDebugf("Failed to draw the reference picture.\n"); 167 SkDebugf("Failed to draw the reference picture.\n");
168 SkDELETE(bitmap); 168 SkDELETE(bitmap);
169 SkDELETE(referenceBitmap); 169 SkDELETE(referenceBitmap);
170 return false; 170 return false;
171 } 171 }
172 172
173 if (success && (bitmap->width() != referenceBitmap->width())) { 173 if (success && (bitmap->width() != referenceBitmap->width())) {
174 SkDebugf("Expected image width: %i, actual image width %i.\n", 174 SkDebugf("Expected image width: %i, actual image width %i.\n",
175 referenceBitmap->width(), bitmap->width()); 175 referenceBitmap->width(), bitmap->width());
176 SkDELETE(bitmap); 176 SkDELETE(bitmap);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 #endif 323 #endif
324 #endif 324 #endif
325 return 0; 325 return 0;
326 } 326 }
327 327
328 #if !defined SK_BUILD_FOR_IOS 328 #if !defined SK_BUILD_FOR_IOS
329 int main(int argc, char * const argv[]) { 329 int main(int argc, char * const argv[]) {
330 return tool_main(argc, (char**) argv); 330 return tool_main(argc, (char**) argv);
331 } 331 }
332 #endif 332 #endif
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