| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 SkClipStack fClipStack; | 163 SkClipStack fClipStack; |
| 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 | |
| 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. | |
| 176 SkPDFFont* fFont; | |
| 177 // In PDF, text size has no default value. It is only valid if fFont is | |
| 178 // not nullptr. | |
| 179 SkScalar fTextSize; | |
| 180 }; | 173 }; |
| 181 | 174 |
| 182 protected: | 175 protected: |
| 183 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) over
ride; | 176 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) over
ride; |
| 184 | 177 |
| 185 void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData*
value) override; | 178 void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData*
value) override; |
| 186 | 179 |
| 187 void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const SkPaint
&) override; | 180 void drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, const SkPaint
&) override; |
| 188 sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override; | 181 sk_sp<SkSpecialImage> makeSpecial(const SkBitmap&) override; |
| 189 sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override; | 182 sk_sp<SkSpecialImage> makeSpecial(const SkImage*) override; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 265 |
| 273 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix, | 266 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix, |
| 274 const SkClipStack& clipStack, | 267 const SkClipStack& clipStack, |
| 275 const SkRegion& clipRegion, | 268 const SkRegion& clipRegion, |
| 276 const SkPaint& paint, | 269 const SkPaint& paint, |
| 277 bool hasText, | 270 bool hasText, |
| 278 GraphicStateEntry* entry); | 271 GraphicStateEntry* entry); |
| 279 int addGraphicStateResource(SkPDFObject* gs); | 272 int addGraphicStateResource(SkPDFObject* gs); |
| 280 int addXObjectResource(SkPDFObject* xObject); | 273 int addXObjectResource(SkPDFObject* xObject); |
| 281 | 274 |
| 282 // returns nullptr when a valid SkFont can not be produced | |
| 283 SkPDFFont* updateFont(SkTypeface* typeface, | |
| 284 SkScalar textSize, | |
| 285 uint16_t glyphID, | |
| 286 ContentEntry* contentEntry); | |
| 287 int getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID); | 275 int getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID); |
| 288 | 276 |
| 289 | 277 |
| 290 void internalDrawText(const SkDraw&, const void*, size_t, const SkScalar pos
[], | 278 void internalDrawText(const SkDraw&, const void*, size_t, const SkScalar pos
[], |
| 291 SkTextBlob::GlyphPositioning, SkPoint, const SkPaint&, | 279 SkTextBlob::GlyphPositioning, SkPoint, const SkPaint&, |
| 292 const uint32_t*, uint32_t, const char*); | 280 const uint32_t*, uint32_t, const char*); |
| 293 | 281 |
| 294 void internalDrawPaint(const SkPaint& paint, ContentEntry* contentEntry); | 282 void internalDrawPaint(const SkPaint& paint, ContentEntry* contentEntry); |
| 295 | 283 |
| 296 void internalDrawImage(const SkMatrix& origMatrix, | 284 void internalDrawImage(const SkMatrix& origMatrix, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 307 | 295 |
| 308 typedef SkBaseDevice INHERITED; | 296 typedef SkBaseDevice INHERITED; |
| 309 | 297 |
| 310 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create | 298 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create |
| 311 // an SkPDFDevice | 299 // an SkPDFDevice |
| 312 //friend class SkDocument_PDF; | 300 //friend class SkDocument_PDF; |
| 313 //friend class SkPDFImageShader; | 301 //friend class SkPDFImageShader; |
| 314 }; | 302 }; |
| 315 | 303 |
| 316 #endif | 304 #endif |
| OLD | NEW |