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

Side by Side Diff: src/pdf/SkPDFDevice.cpp

Issue 12989032: Don't pretend we can draw MaskFilters, it produces artifacts that make the text unreadable when usi… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "SkPDFDevice.h" 8 #include "SkPDFDevice.h"
9 9
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 return; 939 return;
940 } 940 }
941 941
942 SkMatrix matrix; 942 SkMatrix matrix;
943 matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y)); 943 matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y));
944 internalDrawBitmap(matrix, d.fClipStack, *d.fClip, bitmap, NULL, paint); 944 internalDrawBitmap(matrix, d.fClipStack, *d.fClip, bitmap, NULL, paint);
945 } 945 }
946 946
947 void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len, 947 void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
948 SkScalar x, SkScalar y, const SkPaint& paint) { 948 SkScalar x, SkScalar y, const SkPaint& paint) {
949 NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false);
950 if (paint.getMaskFilter() != NULL) {
951 // Don't pretend we support drawing MaskFilters, it makes for artifacts
952 // making text unreadable (e.g. same text twice when using CSS shadows).
953 return;
954 }
949 SkPaint textPaint = calculate_text_paint(paint); 955 SkPaint textPaint = calculate_text_paint(paint);
950 ScopedContentEntry content(this, d, textPaint, true); 956 ScopedContentEntry content(this, d, textPaint, true);
951 if (!content.entry()) { 957 if (!content.entry()) {
952 return; 958 return;
953 } 959 }
954 960
955 SkGlyphStorage storage(0); 961 SkGlyphStorage storage(0);
956 uint16_t* glyphIDs = NULL; 962 uint16_t* glyphIDs = NULL;
957 size_t numGlyphs = force_glyph_encoding(paint, text, len, &storage, 963 size_t numGlyphs = force_glyph_encoding(paint, text, len, &storage,
958 &glyphIDs); 964 &glyphIDs);
(...skipping 19 matching lines...) Expand all
978 content.entry()->fContent.writeText(encodedString.c_str()); 984 content.entry()->fContent.writeText(encodedString.c_str());
979 consumedGlyphCount += availableGlyphs; 985 consumedGlyphCount += availableGlyphs;
980 content.entry()->fContent.writeText(" Tj\n"); 986 content.entry()->fContent.writeText(" Tj\n");
981 } 987 }
982 content.entry()->fContent.writeText("ET\n"); 988 content.entry()->fContent.writeText("ET\n");
983 } 989 }
984 990
985 void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len, 991 void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
986 const SkScalar pos[], SkScalar constY, 992 const SkScalar pos[], SkScalar constY,
987 int scalarsPerPos, const SkPaint& paint) { 993 int scalarsPerPos, const SkPaint& paint) {
994 NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false);
995 if (paint.getMaskFilter() != NULL) {
996 // Don't pretend we support drawing MaskFilters, it makes for artifacts
997 // making text unreadable (e.g. same text twice when using CSS shadows).
998 return;
999 }
988 SkASSERT(1 == scalarsPerPos || 2 == scalarsPerPos); 1000 SkASSERT(1 == scalarsPerPos || 2 == scalarsPerPos);
989 SkPaint textPaint = calculate_text_paint(paint); 1001 SkPaint textPaint = calculate_text_paint(paint);
990 ScopedContentEntry content(this, d, textPaint, true); 1002 ScopedContentEntry content(this, d, textPaint, true);
991 if (!content.entry()) { 1003 if (!content.entry()) {
992 return; 1004 return;
993 } 1005 }
994 1006
995 SkGlyphStorage storage(0); 1007 SkGlyphStorage storage(0);
996 uint16_t* glyphIDs = NULL; 1008 uint16_t* glyphIDs = NULL;
997 size_t numGlyphs = force_glyph_encoding(paint, text, len, &storage, 1009 size_t numGlyphs = force_glyph_encoding(paint, text, len, &storage,
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 } 1814 }
1803 1815
1804 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, 1816 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
1805 SkCanvas::Config8888) { 1817 SkCanvas::Config8888) {
1806 return false; 1818 return false;
1807 } 1819 }
1808 1820
1809 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { 1821 bool SkPDFDevice::allowImageFilter(SkImageFilter*) {
1810 return false; 1822 return false;
1811 } 1823 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698