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

Side by Side Diff: experimental/PdfViewer/SkPdfFont.cpp

Issue 21738005: pdfviewer: add indexed rbg image support, enhanche caching(setData) for SkPdfObject (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/SkPdfFont.h ('k') | experimental/PdfViewer/SkPdfRenderer.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 #include "SkPdfFont.h" 1 #include "SkPdfFont.h"
2 2
3 #include "SkStream.h" 3 #include "SkStream.h"
4 #include "SkTypeface.h" 4 #include "SkTypeface.h"
5 #include "SkPdfNativeTokenizer.h" 5 #include "SkPdfNativeTokenizer.h"
6 6
7 std::map<std::string, SkPdfStandardFontEntry>& getStandardFonts() { 7 std::map<std::string, SkPdfStandardFontEntry>& getStandardFonts() {
8 static std::map<std::string, SkPdfStandardFontEntry> gPdfStandardFonts; 8 static std::map<std::string, SkPdfStandardFontEntry> gPdfStandardFonts;
9 9
10 // TODO (edisonn): , vs - ? what does it mean? 10 // TODO (edisonn): , vs - ? what does it mean?
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // TODO(edisonn): report error? 248 // TODO(edisonn): report error?
249 return NULL; 249 return NULL;
250 } 250 }
251 } 251 }
252 252
253 SkPdfFont* SkPdfFont::fontFromPdfDictionary(SkNativeParsedPDF* doc, SkPdfFontDic tionary* dict) { 253 SkPdfFont* SkPdfFont::fontFromPdfDictionary(SkNativeParsedPDF* doc, SkPdfFontDic tionary* dict) {
254 if (dict == NULL) { 254 if (dict == NULL) {
255 return NULL; // TODO(edisonn): report default one? 255 return NULL; // TODO(edisonn): report default one?
256 } 256 }
257 257
258 if (dict->data() == NULL) { 258 if (!dict->hasData(SkPdfObject::kFont_Data)) {
259 dict->setData(fontFromPdfDictionaryOnce(doc, dict)); 259 dict->setData(fontFromPdfDictionaryOnce(doc, dict), SkPdfObject::kFont_D ata);
260 } 260 }
261 return (SkPdfFont*)dict->data(); 261 return (SkPdfFont*)dict->data(SkPdfObject::kFont_Data);
262 } 262 }
263 263
264 264
265 265
266 SkPdfType0Font* SkPdfFont::fontFromType0FontDictionary(SkNativeParsedPDF* doc, S kPdfType0FontDictionary* dict) { 266 SkPdfType0Font* SkPdfFont::fontFromType0FontDictionary(SkNativeParsedPDF* doc, S kPdfType0FontDictionary* dict) {
267 if (dict == NULL) { 267 if (dict == NULL) {
268 return NULL; // default one? 268 return NULL; // default one?
269 } 269 }
270 270
271 return new SkPdfType0Font(doc, dict); 271 return new SkPdfType0Font(doc, dict);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) { 445 SkPdfEncoding* SkPdfEncoding::fromName(const char* name) {
446 SkPdfEncoding* encoding = getStandardEncodings()[name]; 446 SkPdfEncoding* encoding = getStandardEncodings()[name];
447 447
448 #ifdef PDF_TRACE 448 #ifdef PDF_TRACE
449 if (encoding == NULL) { 449 if (encoding == NULL) {
450 printf("Encoding not found: %s\n", name); 450 printf("Encoding not found: %s\n", name);
451 } 451 }
452 #endif 452 #endif
453 return encoding; 453 return encoding;
454 } 454 }
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfFont.h ('k') | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698