Commit Graph

44 Commits

Author SHA1 Message Date
vandebo@chromium.org
25adce81ce [PDF] Add support for Clear, Src, Dst, DstOver xfermodes.
This uses the refactoring in http://codereview.appspot.com/4459041/ to add support for additional xfer modes.  Calling setupContentEntry may affect previous content entries (removing, reordering, or modifying their clip) and indicates to the caller if it should draw the new item or not.

Review URL: http://codereview.appspot.com/4464043

git-svn-id: http://skia.googlecode.com/svn/trunk@1271 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-05-09 08:05:01 +00:00
vandebo@chromium.org
a0c7edbb08 [PDF] Fix setting of existing clip for layers.
The current approach of setting the existing clip just before drawing a layer into a device doesn't work.  SkDevice::clear() uses existing clip before that and if we need to put the content in a transparency group (i.e. for SrcIn xfermode), we need a valid existing clip.  Instead, change the factory to use a special constructor when creating a layer device.

Review URL: http://codereview.appspot.com/4495041

git-svn-id: http://skia.googlecode.com/svn/trunk@1270 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-05-09 07:58:08 +00:00
vandebo@chromium.org
9fbdf87518 [PDF] Refactor content stream creation in SkPDFDevice to support more xfermodes.
Instead of writing all drawing and state updates into the final content stream immediately, this change creates a new ContentEntry each time the transform, clip, or paint changes.  Drawing is done into a stream in the ContentEntry.  When the consumer asks for the content, we combine all the ContentEntries with appropriate updates to the state (clip, transform, paint) in between.  This allows us to modify the clip even after a drawing has completed.  It also lets us remove ContentEntries with no drawing.  Further optimization can be done to better use the stack features of PDF, for now we follow the previous model of having a single clip followed by a single transform on the graphic state stack.

Push rectangle logic into SkPDFUtil::AppendRectangle.
Change private functions to adhere to coding standards.

Review URL: http://codereview.appspot.com/4459041

git-svn-id: http://skia.googlecode.com/svn/trunk@1269 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-05-09 07:55:58 +00:00
vandebo@chromium.org
be2048a371 [PDF] Fix fallout from r1217.
The width and height we pass to SkDevice must be postive.
Shader can no longer use negative coordinates (without transform).
Shader unflip matrix should use same values as passed to SkPDFDevice (height).
Most Shader dictionary entries should be scalars and not ints.

Review URL: http://codereview.appspot.com/4454047

git-svn-id: http://skia.googlecode.com/svn/trunk@1219 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-05-02 15:24:01 +00:00
ctguil@chromium.org
1526129380 PDF Device should report non-transformed size for width and height.
Review URL: http://codereview.appspot.com/4435074

git-svn-id: http://skia.googlecode.com/svn/trunk@1217 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-04-29 17:54:16 +00:00
mike@reedtribe.org
ea4ac97dec make SkDeviceFactory reference counted
git-svn-id: http://skia.googlecode.com/svn/trunk@1180 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-04-26 11:48:33 +00:00
vandebo@chromium.org
77bcaa324a [PDF] Implement clear() method and a couple fixes.
+ If the clip matches the initial clip, don't set the clip.
+ Don't change the transform for drawPaint.

Review URL: http://codereview.appspot.com/4424041

git-svn-id: http://skia.googlecode.com/svn/trunk@1142 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-04-15 20:57:37 +00:00
vandebo@chromium.org
75f97e452e Generalize the flip origin argument to the PDF device constructor.
The argument still has a default value that does what most users will want, but provides more flexibility.
Chrome will use this change to support an initial translation of the origin to simulate a margin and to scale the entire content (needed on Windows).

When landing to Chrome, this will need http://codereview.chromium.org/6820038

Review URL: http://codereview.appspot.com/4373052

git-svn-id: http://skia.googlecode.com/svn/trunk@1111 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-04-11 23:24:18 +00:00
vandebo@chromium.org
f71b2103d5 [PDF] Make the NOT_IMPLEMENTED macro not print anything by default.
Review URL: http://codereview.appspot.com/4351046

git-svn-id: http://skia.googlecode.com/svn/trunk@1050 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-04-04 19:46:31 +00:00
ctguil@chromium.org
dfc5ffe478 Additional SK_API annotations needed for print preview on windows.
Review URL: http://codereview.appspot.com/4324042

git-svn-id: http://skia.googlecode.com/svn/trunk@1022 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-30 20:14:49 +00:00
vandebo@chromium.org
cae5fba82e Store content streams in an SkStream instead of an SkString (64k size limit).
Review URL: http://codereview.appspot.com/4272070

git-svn-id: http://skia.googlecode.com/svn/trunk@1011 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-28 19:03:50 +00:00
vandebo@chromium.org
f77e27deb9 Use Type3 fonts for platforms that don't yet support SkFontHost::GetAdvancedTypefaceMetrics.
Review URL: http://codereview.appspot.com/4273041

git-svn-id: http://skia.googlecode.com/svn/trunk@922 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-10 22:50:28 +00:00
vandebo@chromium.org
da912d61ed [PDF] Add support for Shaders.
- Shaders, or as they are referred to in PDF, patterns, are drawn in the coordinate system of the initial page, so when we canonicalize them, we have to consider the current transform and where they are constructed.

- Image shaders are tiled by default, this makes repeat and mirror modes easy, but means we have to draw a pattern as large as the current clip to support clamp mode.

- Gradient shaders are implemented with type 4 functions, which are basically small snippets of post script code.  I've tried to make the code generation modular and heavily commented to make it easy to understand or expand.

Review URL: http://codereview.appspot.com/4239061

git-svn-id: http://skia.googlecode.com/svn/trunk@905 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-08 18:31:02 +00:00
ctguil@chromium.org
f966fd35cf Add SkPDFUtils.cpp to build.
git-svn-id: http://skia.googlecode.com/svn/trunk@893 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-04 21:47:04 +00:00
ctguil@chromium.org
9db86bb9cd PDF Type3 Support.
git-svn-id: http://skia.googlecode.com/svn/trunk@892 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-04 21:43:27 +00:00
vandebo@chromium.org
094316bd28 [PDF] Restrict scalars to the range that PDF understands.
* Add a config flag to ignore the restrictions
* Apply restriction to both SkPDFScalar and scalars used in content streams.
* +/- 32,767 for the integer part.
* +/1 1/65536 for the fraction part.

Review URL: http://codereview.appspot.com/4240050

git-svn-id: http://skia.googlecode.com/svn/trunk@882 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-04 03:15:13 +00:00
vandebo@chromium.org
0129410fbe [PDF] Fix broken encoding conversion code for non-multibyte fonts.
Review URL: http://codereview.appspot.com/4245044

git-svn-id: http://skia.googlecode.com/svn/trunk@863 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-28 19:52:18 +00:00
vandebo@chromium.org
c2a9b7fe56 [PDF] Remove one copy of each content stream.
Review URL: http://codereview.appspot.com/4231044

git-svn-id: http://skia.googlecode.com/svn/trunk@856 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-24 23:22:30 +00:00
vandebo@chromium.org
f60a001d1a [PDF] Change the way flip origin is done.
The PDF shader matrix is dependent on flip origin or not, so we need to set it at device creation time.

Review URL: http://codereview.appspot.com/4216046

git-svn-id: http://skia.googlecode.com/svn/trunk@855 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-24 23:14:04 +00:00
vandebo@chromium.org
d90c141feb [PDF] Clean up SkPDFStream and make it inherit from SkPDFDict.
A stream is a dictionary (with a couple particular entries) plus the data.
The common parent is useful for the shader implementation.

Review URL: http://codereview.appspot.com/4221045

git-svn-id: http://skia.googlecode.com/svn/trunk@852 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-24 21:50:04 +00:00
reed@google.com
46799cd9f0 change virtual setMatrixClip() to take a SkClipStack parameter.
git-svn-id: http://skia.googlecode.com/svn/trunk@831 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-22 20:56:26 +00:00
vandebo@chromium.org
79ac4fd6eb [PDF] Change SkPDFFormXObject to not hold a reference to device.
This prevents two copies of the content stream from sticking around.  It also fixes an invalid memory reference because SkCanvas::internalRestore deletes the device (maybe it should just unref) after drawing it onto the main device.

Review URL: http://codereview.appspot.com/4080056

git-svn-id: http://skia.googlecode.com/svn/trunk@773 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-08 19:22:40 +00:00
vandebo@chromium.org
1aef2ed83c [PDF] Start from an identity transform for drawDevice.
drawDevice, like drawSprite should start from the identity transform instead of applying the passed translation on top of the current transform.

Review URL: http://codereview.appspot.com/4023066

git-svn-id: http://skia.googlecode.com/svn/trunk@757 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-03 21:46:10 +00:00
vandebo@chromium.org
c48b2b330f Cleanup SkPDFTypfaceInfo and make it more generic.
Renamed to SkAdvancedTypefaceMetrics.
Include Em size and return all metrics in unscaled font units.
Make retrieval of advances optional.
Reorder SkAdvancedTypefaceMetrics to be somewhat logical.
Change the types of fields in SkAdvancedTypefaceMetrics to their minimum required size.

Review URL: http://codereview.appspot.com/4121049

git-svn-id: http://skia.googlecode.com/svn/trunk@752 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-02 02:11:22 +00:00
vandebo@chromium.org
f7c157610f [PDF] Clean up ref counting.
Return ref'd objs where possible enabling removal of many SkRefPtr<> variables.

Review URL: http://codereview.appspot.com/4029051

git-svn-id: http://skia.googlecode.com/svn/trunk@750 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-01 22:19:44 +00:00
vandebo@chromium.org
1cfa2c4586 [PDF] Support image alpha channel plus a couple small fixes.
Fix bug in rendering paths with cubic segments.
Only compress data if the compressed size is smaller than the uncompressed size.

Review URL: http://codereview.appspot.com/4079048

git-svn-id: http://skia.googlecode.com/svn/trunk@747 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-31 19:35:43 +00:00
vandebo@chromium.org
befebb8a84 [PDF] Honor srcRect in drawBitmap.
Review URL: http://codereview.appspot.com/4083045

git-svn-id: http://skia.googlecode.com/svn/trunk@745 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-29 01:38:50 +00:00
vandebo@chromium.org
8af0b36165 Fix windows build.
Review URL: http://codereview.appspot.com/3996048

git-svn-id: http://skia.googlecode.com/svn/trunk@739 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-26 21:59:00 +00:00
reed@google.com
dea520fc93 move into core for now, so we can build SkFontHost_FreeType.cpp
git-svn-id: http://skia.googlecode.com/svn/trunk@738 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-26 20:32:23 +00:00
reed@google.com
c93a17f2df fix mac build (don't need typedef struct foo foo)
git-svn-id: http://skia.googlecode.com/svn/trunk@733 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-26 04:37:53 +00:00
vandebo@chromium.org
02cc5aa736 Update SkPDFDevice::drawPath signature to match SkDevice.
Review URL: http://codereview.appspot.com/4068044

git-svn-id: http://skia.googlecode.com/svn/trunk@729 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-25 22:06:29 +00:00
vandebo@chromium.org
2a22e10ab2 Add Truetype and Type 1 font embedding support
Sorry this is such a large CL.  It was very exploratory for me to make this
work.

- Add an interface to SkFontHost to retrieve font information and provide NULL implementations on all platforms except Linux.
- Segment large Type 1 fonts into fonts with shared resources with 255 glyphs each.
- Convert the various Type 1 formats to the form PDF wants.
- Update font as we draw text instead of as part of the graphical state.
- Remove built-in font support, we can't really use it.

Other changes I can pull out to a separate CL if you like.

- Add SkTScopedPtr class.
- Fix double free of resources.
- Fix bug in resource unique-ifying code.
- Don't print anything for any empty clip path.
- Fix copy paste error - MiterLimit.
- Fix sign extension bug in SkPDFString
- Fix FlateTest rename that was missed on a previous commit.

Review URL: http://codereview.appspot.com/4082042

git-svn-id: http://skia.googlecode.com/svn/trunk@728 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-25 21:01:34 +00:00
reed@android.com
f2b98d67dc merge with changes for GPU backend
git-svn-id: http://skia.googlecode.com/svn/trunk@637 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-20 18:26:13 +00:00
vandebo@chromium.org
a09ef977b6 Add deflate support to SkPDFStream.
Review URL: http://codereview.appspot.com/3326043

git-svn-id: http://skia.googlecode.com/svn/trunk@627 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-01 22:17:20 +00:00
vandebo@chromium.org
28be72b63e PDF: Add text support with a font framework (font embedding to come).
Supports fakeBold, underline, strikethrough, mode (fill, stroke, both), size, skew, alignment (left, center, right).
Missing is drawFontOnPath and font lookup and embedding.
Changed SkPDFString to support how it is used from drawText methods.
Moved compile assert into SkTypes.
Moved constants and utility function used to support fakeBold, underline, and strikethrough into higher level locations.

Review URL: http://codereview.appspot.com/2946041

git-svn-id: http://skia.googlecode.com/svn/trunk@624 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-11-11 21:37:00 +00:00
vandebo@chromium.org
7e2ff7cf7d Add clipping support and some small fixes.
Reorganize how the PDF graphic state stack is managed (fixing several bugs incidentally).
Style: fix variables with underscores.
Bug: fix image matrix application order, which enabled a small refactor.

Review URL: http://codereview.appspot.com/2771042

git-svn-id: http://skia.googlecode.com/svn/trunk@622 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-11-03 23:55:28 +00:00
vandebo@chromium.org
eb6c7596af Add PDF support for drawDevice using a form xobject.
This depends on:
http://codereview.appspot.com/2719041
http://codereview.appspot.com/2720041
http://codereview.appspot.com/2721041

Review URL: http://codereview.appspot.com/2710042

git-svn-id: http://skia.googlecode.com/svn/trunk@621 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-26 19:54:45 +00:00
vandebo@chromium.org
a518086928 Several cleanups:
Fix the spelling of resource in several places
Make getResouce(resourceList) part of SkPDFObject
make SkDynamicMemoryWStream::getOffset and SkPDFPage::getMediaBox const
Add a temporary NOT_IMPLEMENTED macro instead of using SkASSERT

Review URL: http://codereview.appspot.com/2721041

git-svn-id: http://skia.googlecode.com/svn/trunk@619 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-26 19:48:49 +00:00
vandebo@chromium.org
35fc62b960 Move the device capability method to SkDevice.
These are not the capabilities of the factory, but of the device.  Additionally, it is more often needed when you have a device then when you have a factory, which caused creating of a new factory.

Review URL: http://codereview.appspot.com/2720041

git-svn-id: http://skia.googlecode.com/svn/trunk@618 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-26 19:47:30 +00:00
vandebo@chromium.org
ddbbd805b5 Cleanup/unify matrix transform for PDF backend.
Review URL: http://codereview.appspot.com/2719041

git-svn-id: http://skia.googlecode.com/svn/trunk@617 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-26 19:45:06 +00:00
vandebo@chromium.org
9b49dc0db8 First pieces of SkPDFDevice. Supports:
Matrix transforms.
Rendering bitmaps.
Basic paint parameters.
Rendering rectangles, points, lines, polygons.
Render a paint to the page.

Review URL: http://codereview.appspot.com/2584041

git-svn-id: http://skia.googlecode.com/svn/trunk@614 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-20 22:23:29 +00:00
vandebo@chromium.org
d877fdbb6e High level pdf classes and pdf specific interface.
The guts of the implementation will be in SkPDFDevice and below.  This is a first implementation of everything above that point.

Review URL: http://codereview.appspot.com/2342043

git-svn-id: http://skia.googlecode.com/svn/trunk@602 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-12 23:08:13 +00:00
vandebo@chromium.org
f66025d59a Address senorblanco's comments on r600.
Don't inline constructors and destructors.
Include license in test file.
A few nits
Also, cleanup a couple compile warnings.

Review URL: http://codereview.appspot.com/2279043

git-svn-id: http://skia.googlecode.com/svn/trunk@601 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-01 23:26:55 +00:00
vandebo@chromium.org
8459d4e5e3 Initial PDF backend commit: directories, build rules, primitives
This change establishes and tests the building blocks of the PDF file format.
For now, PDF code is not compiled by default.

Review URL: http://codereview.appspot.com/1950044

git-svn-id: http://skia.googlecode.com/svn/trunk@600 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-09-24 22:25:30 +00:00