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

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

Issue 1820303002: Revert of switch colorfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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, SkColorFilter* colorFil ter) { 2117 static const SkImage* color_filter(const SkImage* image,
2118 SkColorFilter* colorFilter) {
2118 sk_sp<SkSurface> surface(SkSurface::NewRaster( 2119 sk_sp<SkSurface> surface(SkSurface::NewRaster(
2119 SkImageInfo::MakeN32Premul(image->dimensions()))); 2120 SkImageInfo::MakeN32Premul(image->dimensions())));
2120 if (!surface) { 2121 if (!surface) {
2121 return image; 2122 return image;
2122 } 2123 }
2123 SkCanvas* canvas = surface->getCanvas(); 2124 SkCanvas* canvas = surface->getCanvas();
2124 canvas->clear(SK_ColorTRANSPARENT); 2125 canvas->clear(SK_ColorTRANSPARENT);
2125 SkPaint paint; 2126 SkPaint paint;
2126 paint.setColorFilter(sk_ref_sp(colorFilter)); 2127 paint.setColorFilter(colorFilter);
2127 canvas->drawImage(image, 0, 0, &paint); 2128 canvas->drawImage(image, 0, 0, &paint);
2128 canvas->flush(); 2129 canvas->flush();
2129 return surface->makeImageSnapshot().release(); 2130 return surface->makeImageSnapshot().release();
2130 } 2131 }
2131 2132
2132 //////////////////////////////////////////////////////////////////////////////// 2133 ////////////////////////////////////////////////////////////////////////////////
2133 void SkPDFDevice::internalDrawImage(const SkMatrix& origMatrix, 2134 void SkPDFDevice::internalDrawImage(const SkMatrix& origMatrix,
2134 const SkClipStack* clipStack, 2135 const SkClipStack* clipStack,
2135 const SkRegion& origClipRegion, 2136 const SkRegion& origClipRegion,
2136 const SkImage* image, 2137 const SkImage* image,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 sk_sp<SkData> encodedImage(image->refEncodedData()); 2275 sk_sp<SkData> encodedImage(image->refEncodedData());
2275 if (!encodedImage) { 2276 if (!encodedImage) {
2276 fDocument->serialize(pdfimage); 2277 fDocument->serialize(pdfimage);
2277 } 2278 }
2278 #endif 2279 #endif
2279 fDocument->canon()->addPDFBitmap(image->uniqueID(), pdfimage.get()); 2280 fDocument->canon()->addPDFBitmap(image->uniqueID(), pdfimage.get());
2280 } 2281 }
2281 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), 2282 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()),
2282 &content.entry()->fContent); 2283 &content.entry()->fContent);
2283 } 2284 }
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