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

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

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage 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/image/SkSurface_Raster.cpp ('k') | src/pdf/SkPDFDevice.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 2015 Google Inc. 2 * Copyright 2015 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 "SkImage.h" 8 #include "SkImage.h"
9 #include "SkPDFBitmap.h" 9 #include "SkPDFBitmap.h"
10 #include "SkPDFCanon.h" 10 #include "SkPDFCanon.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void SkPDFCanon::addPDFBitmap(uint32_t imageUniqueID, SkPDFObject* pdfBitmap) { 135 void SkPDFCanon::addPDFBitmap(uint32_t imageUniqueID, SkPDFObject* pdfBitmap) {
136 fPDFBitmapMap.set(imageUniqueID, SkRef(pdfBitmap)); 136 fPDFBitmapMap.set(imageUniqueID, SkRef(pdfBitmap));
137 } 137 }
138 138
139 const SkImage* SkPDFCanon::bitmapToImage(const SkBitmap& bm) { 139 const SkImage* SkPDFCanon::bitmapToImage(const SkBitmap& bm) {
140 // reference remains owned by the fBitmapToImageMap! 140 // reference remains owned by the fBitmapToImageMap!
141 SkBitmapKey key(bm); 141 SkBitmapKey key(bm);
142 if (const SkImage** img = fBitmapToImageMap.find(key)) { 142 if (const SkImage** img = fBitmapToImageMap.find(key)) {
143 return *img; 143 return *img;
144 } 144 }
145 if (SkImage* image = SkImage::NewFromBitmap(bm)) { 145 if (SkImage* image = SkImage::MakeFromBitmap(bm).release()) {
146 return *fBitmapToImageMap.set(key, image); 146 return *fBitmapToImageMap.set(key, image);
147 } 147 }
148 SkBitmap n32bitmap; // SkImage::NewFromBitmap can be finicky. 148 SkBitmap n32bitmap; // SkImage::NewFromBitmap can be finicky.
149 bm.copyTo(&n32bitmap, kN32_SkColorType); 149 bm.copyTo(&n32bitmap, kN32_SkColorType);
150 return *fBitmapToImageMap.set(key, SkImage::NewFromBitmap(n32bitmap)); 150 return *fBitmapToImageMap.set(key, SkImage::MakeFromBitmap(n32bitmap).releas e());
151 } 151 }
152 152
153 sk_sp<SkPDFStream> SkPDFCanon::makeInvertFunction() { 153 sk_sp<SkPDFStream> SkPDFCanon::makeInvertFunction() {
154 if (fInvertFunction) { 154 if (fInvertFunction) {
155 return fInvertFunction; 155 return fInvertFunction;
156 } 156 }
157 fInvertFunction = SkPDFGraphicState::MakeInvertFunction(); 157 fInvertFunction = SkPDFGraphicState::MakeInvertFunction();
158 return fInvertFunction; 158 return fInvertFunction;
159 } 159 }
160 sk_sp<SkPDFDict> SkPDFCanon::makeNoSmaskGraphicState() { 160 sk_sp<SkPDFDict> SkPDFCanon::makeNoSmaskGraphicState() {
161 if (fNoSmaskGraphicState) { 161 if (fNoSmaskGraphicState) {
162 return fNoSmaskGraphicState; 162 return fNoSmaskGraphicState;
163 } 163 }
164 fNoSmaskGraphicState = SkPDFGraphicState::MakeNoSmaskGraphicState(); 164 fNoSmaskGraphicState = SkPDFGraphicState::MakeNoSmaskGraphicState();
165 return fNoSmaskGraphicState; 165 return fNoSmaskGraphicState;
166 } 166 }
167 sk_sp<SkPDFArray> SkPDFCanon::makeRangeObject() { 167 sk_sp<SkPDFArray> SkPDFCanon::makeRangeObject() {
168 if (fRangeObject) { 168 if (fRangeObject) {
169 return fRangeObject; 169 return fRangeObject;
170 } 170 }
171 fRangeObject = SkPDFShader::MakeRangeObject(); 171 fRangeObject = SkPDFShader::MakeRangeObject();
172 return fRangeObject; 172 return fRangeObject;
173 } 173 }
OLDNEW
« no previous file with comments | « src/image/SkSurface_Raster.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698