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

Side by Side Diff: src/pdf/SkPDFDevice.cpp

Issue 1381073005: SkPDF: ASAN fix: don't double ref new SkPDFBitmap objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 "SkPDFDevice.h" 8 #include "SkPDFDevice.h"
9 9
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 // TODO(http://skbug.com/4378): implement colorfilter on other 2275 // TODO(http://skbug.com/4378): implement colorfilter on other
2276 // draw calls. This code here works for all 2276 // draw calls. This code here works for all
2277 // drawBitmap*()/drawImage*() calls amd ImageFilters (which 2277 // drawBitmap*()/drawImage*() calls amd ImageFilters (which
2278 // rasterize a layer on this backend). Fortuanely, this seems 2278 // rasterize a layer on this backend). Fortuanely, this seems
2279 // to be how Chromium impements most color-filters. 2279 // to be how Chromium impements most color-filters.
2280 autoImageUnref.reset(color_filter(image, colorFilter)); 2280 autoImageUnref.reset(color_filter(image, colorFilter));
2281 image = autoImageUnref; 2281 image = autoImageUnref;
2282 // TODO(halcanary): de-dupe this by caching filtered images. 2282 // TODO(halcanary): de-dupe this by caching filtered images.
2283 // (maybe in the resource cache?) 2283 // (maybe in the resource cache?)
2284 } 2284 }
2285 SkAutoTUnref<SkPDFObject> pdfimage(fCanon->findPDFBitmap(image)); 2285 SkAutoTUnref<SkPDFObject> pdfimage(SkSafeRef(fCanon->findPDFBitmap(image)));
2286 if (!pdfimage) { 2286 if (!pdfimage) {
2287 pdfimage.reset(SkPDFCreateBitmapObject(image)); 2287 pdfimage.reset(SkPDFCreateBitmapObject(image));
2288 if (!pdfimage) { 2288 if (!pdfimage) {
2289 return; 2289 return;
2290 } 2290 }
2291 fCanon->addPDFBitmap(image->uniqueID(), pdfimage); 2291 fCanon->addPDFBitmap(image->uniqueID(), pdfimage);
2292 } 2292 }
2293 SkPDFUtils::DrawFormXObject(this->addXObjectResource(SkRef(pdfimage.get())), 2293 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()),
2294 &content.entry()->fContent); 2294 &content.entry()->fContent);
2295 } 2295 }
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