OLD | NEW |
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 #ifndef SkPDFDevice_DEFINED | 8 #ifndef SkPDFDevice_DEFINED |
9 #define SkPDFDevice_DEFINED | 9 #define SkPDFDevice_DEFINED |
10 | 10 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 SkRegion fClipRegion; | 164 SkRegion fClipRegion; |
165 | 165 |
166 // When emitting the content entry, we will ensure the graphic state | 166 // When emitting the content entry, we will ensure the graphic state |
167 // is set to these values first. | 167 // is set to these values first. |
168 SkColor fColor; | 168 SkColor fColor; |
169 SkScalar fTextScaleX; // Zero means we don't care what the value is. | 169 SkScalar fTextScaleX; // Zero means we don't care what the value is. |
170 SkPaint::Style fTextFill; // Only if TextScaleX is non-zero. | 170 SkPaint::Style fTextFill; // Only if TextScaleX is non-zero. |
171 int fShaderIndex; | 171 int fShaderIndex; |
172 int fGraphicStateIndex; | 172 int fGraphicStateIndex; |
173 | 173 |
174 // We may change the font (i.e. for Type1 support) within a | 174 // // We may change the font (i.e. for Type1 support) within a |
175 // ContentEntry. This is the one currently in effect, or nullptr if non
e. | 175 // // ContentEntry. This is the one currently in effect, or nul
lptr if none. |
176 SkPDFFont* fFont; | 176 // SkPDFFont* fFont; |
177 // In PDF, text size has no default value. It is only valid if fFont is | 177 // // In PDF, text size has no default value. It is only valid i
f fFont is |
178 // not nullptr. | 178 // // not nullptr. |
179 SkScalar fTextSize; | 179 // SkScalar fTextSize; |
180 }; | 180 }; |
181 | 181 |
182 protected: | 182 protected: |
183 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) over
ride; | 183 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) over
ride; |
184 | 184 |
185 void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData*
value) override; | 185 void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData*
value) override; |
186 | 186 |
187 void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const SkPaint
&) override; | 187 void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const SkPaint
&) override; |
188 sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override; | 188 sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override; |
189 sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override; | 189 sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix, | 273 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix, |
274 const SkClipStack& clipStack, | 274 const SkClipStack& clipStack, |
275 const SkRegion& clipRegion, | 275 const SkRegion& clipRegion, |
276 const SkPaint& paint, | 276 const SkPaint& paint, |
277 bool hasText, | 277 bool hasText, |
278 GraphicStateEntry* entry); | 278 GraphicStateEntry* entry); |
279 int addGraphicStateResource(SkPDFObject* gs); | 279 int addGraphicStateResource(SkPDFObject* gs); |
280 int addXObjectResource(SkPDFObject* xObject); | 280 int addXObjectResource(SkPDFObject* xObject); |
281 | 281 |
282 // returns nullptr when a valid SkFont can not be produced | 282 // // returns nullptr when a valid SkFont can not be produced |
283 SkPDFFont* updateFont(SkTypeface* typeface, | 283 // SkPDFFont* updateFont(SkTypeface* typeface, |
284 SkScalar textSize, | 284 // SkScalar textSize, |
285 uint16_t glyphID, | 285 // uint16_t glyphID, |
286 ContentEntry* contentEntry); | 286 // ContentEntry* contentEntry); |
287 int getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID); | 287 int getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID); |
288 | 288 |
289 | 289 |
290 void internalDrawText(const SkDraw&, const void*, size_t, const SkScalar pos
[], | 290 void internalDrawText(const SkDraw&, const void*, size_t, const SkScalar pos
[], |
291 SkTextBlob::GlyphPositioning, SkPoint, const SkPaint&, | 291 SkTextBlob::GlyphPositioning, SkPoint, const SkPaint&, |
292 const uint32_t*, uint32_t, const char*); | 292 const uint32_t*, uint32_t, const char*); |
293 | 293 |
294 void internalDrawPaint(const SkPaint& paint, ContentEntry* contentEntry); | 294 void internalDrawPaint(const SkPaint& paint, ContentEntry* contentEntry); |
295 | 295 |
296 void internalDrawImage(const SkMatrix& origMatrix, | 296 void internalDrawImage(const SkMatrix& origMatrix, |
(...skipping 10 matching lines...) Expand all Loading... |
307 | 307 |
308 typedef SkBaseDevice INHERITED; | 308 typedef SkBaseDevice INHERITED; |
309 | 309 |
310 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create | 310 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create |
311 // an SkPDFDevice | 311 // an SkPDFDevice |
312 //friend class SkDocument_PDF; | 312 //friend class SkDocument_PDF; |
313 //friend class SkPDFImageShader; | 313 //friend class SkPDFImageShader; |
314 }; | 314 }; |
315 | 315 |
316 #endif | 316 #endif |
OLD | NEW |