OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkPdfRenderer.h" | 8 #include "SkPdfRenderer.h" |
9 | 9 |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 skfont->encoding()->decodeText(binary, &decoded); | 483 skfont->encoding()->decodeText(binary, &decoded); |
484 | 484 |
485 SkPaint paint; | 485 SkPaint paint; |
486 // TODO(edisonn): does size 0 mean anything special? | 486 // TODO(edisonn): does size 0 mean anything special? |
487 if (pdfContext->fGraphicsState.fCurFontSize != 0) { | 487 if (pdfContext->fGraphicsState.fCurFontSize != 0) { |
488 paint.setTextSize(SkDoubleToScalar(pdfContext->fGraphicsState.fCurFontSi
ze)); | 488 paint.setTextSize(SkDoubleToScalar(pdfContext->fGraphicsState.fCurFontSi
ze)); |
489 } | 489 } |
490 | 490 |
491 // TODO(edisonn): implement font scaler | 491 // TODO(edisonn): implement font scaler |
492 // if (fCurFont && fCurFont->GetFontScale() != 0) { | 492 // if (fCurFont && fCurFont->GetFontScale() != 0) { |
493 // paint.setTextScaleX(SkFloatToScalar(fCurFont->GetFontScale() / 100.0))
; | 493 // paint.setTextScaleX(fCurFont->GetFontScale() / 100.0); |
494 // } | 494 // } |
495 | 495 |
496 pdfContext->fGraphicsState.applyGraphicsState(&paint, false); | 496 pdfContext->fGraphicsState.applyGraphicsState(&paint, false); |
497 | 497 |
498 skfont->drawText(decoded, &paint, pdfContext, canvas); | 498 skfont->drawText(decoded, &paint, pdfContext, canvas); |
499 | 499 |
500 return kOK_SkPdfResult; | 500 return kOK_SkPdfResult; |
501 } | 501 } |
502 | 502 |
503 // TODO(edisonn): create header files with declarations! | 503 // TODO(edisonn): create header files with declarations! |
(...skipping 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3133 | 3133 |
3134 rect = SkRect::MakeWH(width, height); | 3134 rect = SkRect::MakeWH(width, height); |
3135 | 3135 |
3136 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); | 3136 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); |
3137 | 3137 |
3138 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); | 3138 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); |
3139 SkCanvas canvas(device); | 3139 SkCanvas canvas(device); |
3140 | 3140 |
3141 return renderer->renderPage(page, &canvas, rect); | 3141 return renderer->renderPage(page, &canvas, rect); |
3142 } | 3142 } |
OLD | NEW |