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

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

Issue 1825073002: Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove flag Created 4 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
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/utils/SkLua.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 "SkPDFDevice.h" 8 #include "SkPDFDevice.h"
9 9
10 #include "SkAnnotationKeys.h" 10 #include "SkAnnotationKeys.h"
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 fFontResources.push(newFont.get()); 2107 fFontResources.push(newFont.get());
2108 newFont.get()->ref(); 2108 newFont.get()->ref();
2109 } 2109 }
2110 return resourceIndex; 2110 return resourceIndex;
2111 } 2111 }
2112 2112
2113 static SkSize rect_to_size(const SkRect& r) { 2113 static SkSize rect_to_size(const SkRect& r) {
2114 return SkSize::Make(r.width(), r.height()); 2114 return SkSize::Make(r.width(), r.height());
2115 } 2115 }
2116 2116
2117 static const SkImage* color_filter(const SkImage* image, 2117 static const SkImage* color_filter(const SkImage* image, SkColorFilter* colorFil ter) {
2118 SkColorFilter* colorFilter) {
2119 sk_sp<SkSurface> surface(SkSurface::NewRaster( 2118 sk_sp<SkSurface> surface(SkSurface::NewRaster(
2120 SkImageInfo::MakeN32Premul(image->dimensions()))); 2119 SkImageInfo::MakeN32Premul(image->dimensions())));
2121 if (!surface) { 2120 if (!surface) {
2122 return image; 2121 return image;
2123 } 2122 }
2124 SkCanvas* canvas = surface->getCanvas(); 2123 SkCanvas* canvas = surface->getCanvas();
2125 canvas->clear(SK_ColorTRANSPARENT); 2124 canvas->clear(SK_ColorTRANSPARENT);
2126 SkPaint paint; 2125 SkPaint paint;
2127 paint.setColorFilter(colorFilter); 2126 paint.setColorFilter(sk_ref_sp(colorFilter));
2128 canvas->drawImage(image, 0, 0, &paint); 2127 canvas->drawImage(image, 0, 0, &paint);
2129 canvas->flush(); 2128 canvas->flush();
2130 return surface->makeImageSnapshot().release(); 2129 return surface->makeImageSnapshot().release();
2131 } 2130 }
2132 2131
2133 //////////////////////////////////////////////////////////////////////////////// 2132 ////////////////////////////////////////////////////////////////////////////////
2134 void SkPDFDevice::internalDrawImage(const SkMatrix& origMatrix, 2133 void SkPDFDevice::internalDrawImage(const SkMatrix& origMatrix,
2135 const SkClipStack* clipStack, 2134 const SkClipStack* clipStack,
2136 const SkRegion& origClipRegion, 2135 const SkRegion& origClipRegion,
2137 const SkImage* image, 2136 const SkImage* image,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 sk_sp<SkData> encodedImage(image->refEncodedData()); 2274 sk_sp<SkData> encodedImage(image->refEncodedData());
2276 if (!encodedImage) { 2275 if (!encodedImage) {
2277 fDocument->serialize(pdfimage); 2276 fDocument->serialize(pdfimage);
2278 } 2277 }
2279 #endif 2278 #endif
2280 fDocument->canon()->addPDFBitmap(image->uniqueID(), pdfimage.get()); 2279 fDocument->canon()->addPDFBitmap(image->uniqueID(), pdfimage.get());
2281 } 2280 }
2282 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), 2281 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()),
2283 &content.entry()->fContent); 2282 &content.entry()->fContent);
2284 } 2283 }
OLDNEW
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/utils/SkLua.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698