OLD | NEW |
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::NewFromBitmap(bm)) { |
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::NewFromBitmap(n32bitmap)); |
151 } | 151 } |
| 152 |
| 153 sk_sp<SkPDFStream> SkPDFCanon::makeInvertFunction() { |
| 154 if (fInvertFunction) { |
| 155 return fInvertFunction; |
| 156 } |
| 157 fInvertFunction = SkPDFGraphicState::MakeInvertFunction(); |
| 158 return fInvertFunction; |
| 159 } |
| 160 sk_sp<SkPDFDict> SkPDFCanon::makeNoSmaskGraphicState() { |
| 161 if (fNoSmaskGraphicState) { |
| 162 return fNoSmaskGraphicState; |
| 163 } |
| 164 fNoSmaskGraphicState = SkPDFGraphicState::MakeNoSmaskGraphicState(); |
| 165 return fNoSmaskGraphicState; |
| 166 } |
| 167 sk_sp<SkPDFArray> SkPDFCanon::makeRangeObject() { |
| 168 if (fRangeObject) { |
| 169 return fRangeObject; |
| 170 } |
| 171 fRangeObject = SkPDFShader::MakeRangeObject(); |
| 172 return fRangeObject; |
| 173 } |
OLD | NEW |