Commit Graph

233 Commits

Author SHA1 Message Date
wjmaclean@chromium.org
116b2bcd2c Proposed fix for crash in Cr70244.
git-svn-id: http://skia.googlecode.com/svn/trunk@764 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-07 17:48:37 +00:00
reed@google.com
82065d667f remove SkRefCnt safeRef() and safeUnref(), and replace the call-sites with
SkSafeRef() and SkSafeUnref().

This is basically a bug waiting to happen. An optimizing compiler can remove
checks for null on "this" if it chooses. However, SkRefCnt::safeRef() relies on
precisely this check...

void SkRefCnt::safeRef() {
    if (this) {
        this->ref();
    }
}

Since a compiler might skip the if-clause, it breaks the intention of this
method, hence its removal.

static inline void SkSafeRef(SkRefCnt* obj) {
    if (obj) {
        obj->ref();
    }
}

This form is not ignored by an optimizing compile, so we use it instead.




git-svn-id: http://skia.googlecode.com/svn/trunk@762 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-07 15:30:46 +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
reed@android.com
48cf8ac144 change forward decl of SkMatrix from struct (wrong) to class (correct)
fixes issue http://code.google.com/p/skia/issues/detail?id=139



git-svn-id: http://skia.googlecode.com/svn/trunk@755 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-03 15:51:56 +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
reed@google.com
9d0d195ca4 update dox on bitmap configs
document testing build-flag for large bitmaps



git-svn-id: http://skia.googlecode.com/svn/trunk@744 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-28 22:19:22 +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
reed@google.com
3636ed558f embed a refdict inside SkDevice
udate unittests to test refdict's destructor



git-svn-id: http://skia.googlecode.com/svn/trunk@731 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-25 23:50:57 +00:00
reed@google.com
0e190d0e12 add refdict class, for holding a dictionary of reference-counted objects
-- experimental



git-svn-id: http://skia.googlecode.com/svn/trunk@730 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-25 23:36:05 +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@google.com
c921843d85 fixes for some warnings:
- #if of something that was not defined
- explicit constructor call for baseclass in copy-constructor of subclass

http://code.google.com/p/skia/issues/detail?id=112



git-svn-id: http://skia.googlecode.com/svn/trunk@727 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-25 19:05:12 +00:00
reed@google.com
37a3133d20 fix comments for U8CPU and S16CPU
http://code.google.com/p/skia/issues/detail?id=113



git-svn-id: http://skia.googlecode.com/svn/trunk@723 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-25 14:55:42 +00:00
bsalomon@google.com
5782d712ff Rev the GrContext interface. Context has draw* functions that take a new GrPaint object. Removed many of the lower-level GrGpu function call-throughs on context.
Remove unused/unsupported point size (we don't draw non-hairline points using GL points).
Change current* getter functions to get* for consistency.
Fix bounds when drawing inverse-filled paths.


git-svn-id: http://skia.googlecode.com/svn/trunk@718 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-21 21:03:59 +00:00
bsalomon@google.com
2e7b43d33c Remove notion of default rendertarget. This doesn't map well to usage patterns outside sample app. Make binding between SkGpuDevice and a GrRenderTarget more explicit. Create method on GrContext to wrap the current target in the 3D API with a GrRenderTarget.
git-svn-id: http://skia.googlecode.com/svn/trunk@706 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-18 20:57:22 +00:00
reed@google.com
d3b13bd5af initialize SkGlyph::fMaskFormat to avoid valgrind warnings
rebaseline gradients now that we dither our 32bit src



git-svn-id: http://skia.googlecode.com/svn/trunk@692 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-13 16:33:36 +00:00
reed@google.com
7b201d2254 expose gpu-device-factory
use that factory in gpucanvas, rather than overriding createDevice

note: I think we now don't need the canvas parameter in device-factory



git-svn-id: http://skia.googlecode.com/svn/trunk@684 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-11 18:59:23 +00:00
reed@google.com
4b22602383 add getter/setter for device-factory on canvas
git-svn-id: http://skia.googlecode.com/svn/trunk@683 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-11 18:32:13 +00:00
reed@google.com
232a660169 remove obsolete, unsupported sound files
git-svn-id: http://skia.googlecode.com/svn/trunk@679 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-07 15:34:36 +00:00
reed@google.com
5a8a131d8a update dox to reflect that the default colorspace is CGColorSpaceCreateDeviceRGB()
git-svn-id: http://skia.googlecode.com/svn/trunk@676 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-05 16:29:02 +00:00
reed@google.com
1fcd51e6b2 add template macro to "safely" perform casts w/o breaking strict-aliasing
fix aliasing warnings



git-svn-id: http://skia.googlecode.com/svn/trunk@674 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-05 15:50:27 +00:00
reed@google.com
72cf4927e5 fix build for scalar==fixed
git-svn-id: http://skia.googlecode.com/svn/trunk@671 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-04 19:58:20 +00:00
reed@android.com
4aaee0aecd static inline eliminates multiple definitions (and makes it zero-cost, since
it will be inlined)



git-svn-id: http://skia.googlecode.com/svn/trunk@668 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-04 01:29:52 +00:00
reed@android.com
ad789ee56f make inline helper static, so it can be included from than one .cpp
git-svn-id: http://skia.googlecode.com/svn/trunk@667 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-03 19:52:17 +00:00
reed@android.com
38669c12c5 add colorspace option to SkBitmap -> CGImageRef utility (patch from nico)
git-svn-id: http://skia.googlecode.com/svn/trunk@666 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-03 13:48:50 +00:00
reed@google.com
51df9e3fe3 add gpu to gm tool
add pass-through read/write pixels API to canvas



git-svn-id: http://skia.googlecode.com/svn/trunk@660 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-23 19:29:18 +00:00
reed@google.com
873cb1e23b add gpu to the default makefile
move skia-gpu files into skia/src/gpu



git-svn-id: http://skia.googlecode.com/svn/trunk@653 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-23 15:00:45 +00:00
reed@google.com
c31ce1076c add for quick gl-offscreen context (so we can draw and then readpixels for GM)
git-svn-id: http://skia.googlecode.com/svn/trunk@645 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-21 16:26:39 +00:00
reed@google.com
d642329293 remove ZLIB include from SkUserConfig for how (doesn't work on mac sampleapp) but,
add it to Makefile if SKIA_PDF_SUPPORT is true

Use compile_assert (yea!)



git-svn-id: http://skia.googlecode.com/svn/trunk@643 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-20 20:53:13 +00:00
reed@google.com
0770044da6 add option to write PDFs from gm
fix some compile warnings (reorder initializers, init local ptr)



git-svn-id: http://skia.googlecode.com/svn/trunk@642 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-20 19:46:07 +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
senorblanco@chromium.org
29e5054dd0 Fix perf regression in Color32.
The regression was due to the fact that we were calling PlatformColorProc() for
every span (which in turns makes CPUID, a fairly expensive call).  Since we draw
a lot of rects, and rects have 1-pixel wide spans for the vertical segments,
that's a lot of CPUID.

Fixed by cacheing the result of PlatformColorProc(), as is done for the other
platform-specific blitters.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@636 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-16 19:07:45 +00:00
senorblanco@chromium.org
c3856384e4 SSE2 optimizations for 32bit Color operation.
[Patch from weiwei.li@intel.com]

SSE2 optimization has been added by Stephen White before, this improves the skia
performance on SSE2-supporting platform. (please refer to below issues)

Issue 171055: More SSE2ification
Issue 157141: More SSE2ification
Issue 150060: minor tweaks to SSE2 code for -fPIC
Issue 144072: SSE2 optimizations for 32bit blending blitters

This CL implements SSE2 optimizations for the 32bit Color operation. Like above
issues, it uses CPUID to detect for SSE2 and changes the platform procs at
runtime as well. The 32bit Color operation is heavily used on Chrome HTML5
canvas operations. Take Microsoft IE test drives Pulsating Bubbles as example
(http://ie.microsoft.com/testdrive/Performance/PulsatingBubbles/Default.xhtml),
if running this cases on Chrome, the overhead of 32bit Color operation is about
40~50%. So this CL will make skia performance more better, and also make Chrome
HTML5 canvas performance more better.

Additional, this CL has passed the skia bench & tests validation, the result is
pretty good. We also apply this CL to the latest chromium, and re-run Microsoft
IE test drives Pulsating Bubbles, the performance is improved by almost 9~10%.


git-svn-id: http://skia.googlecode.com/svn/trunk@633 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-13 15:27:20 +00:00
senorblanco@chromium.org
ec7a30cc86 Upstream mulDiv255Ceil() from WebKit to the skia repository.
(Patch by Noel Gordon (noel.gordon@gmail.com))

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



git-svn-id: http://skia.googlecode.com/svn/trunk@632 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-07 21:07:56 +00:00
senorblanco@chromium.org
038aff623d Patch by Mike Lawther (mikelawther@chromium.org).
The HTML5 canvas client of BlurDrawLooper needs the option to not apply the
canvas transform to the blur offset.

see
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-elemen...
- "The shadowOffsetX and shadowOffsetY attributes specify the distance that the
shadow will be offset in the positive horizontal and positive vertical distance
respectively. Their values are in coordinate space units. They are not affected
by the current transformation matrix."

This patch is part of fixing
http://code.google.com/p/chromium/issues/detail?id=64647.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@631 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-06 23:45:58 +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
wjmaclean@chromium.org
86bff1f008 Add safe size/copy functions to Skia.
This patch adds four methods to SkBitmap. There are two functions to return
    "safe size", defined as the number of pixels from the value returned by
    getPixels() to the end of the allocated buffer.

    There is one version of fillPixels() to copy the bitmap instance into an
    external buffer (with specified size, and using specified stride), and another
    fillPixels() to copy from an external buffer to the instance bitmap. In the
    latter case the specified height, width and pixel format must match that used by
    the bitmap instance, although the specified stride may be any value at least as
    large as the minimum stride for the specified geometry. It is assumed that the
    external buffer is of size at least (height - 1)*stride + width *
    bytesPerPixel.

    Both fillPixels() functions return false if the copy is not possible with the
    specified parameters.

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

git-svn-id: http://skia.googlecode.com/svn/trunk@625 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-11-16 20:22:41 +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
8c1d88dcfb Remove include of SkGLDevice.h from SkGLCanvas.h
The '#include "SkGLDevice.h"' from include/core/SkDevice.h requires internal
Skia code to be added to the include search paths when using the deprecated API.
This change adds back SkGLCanvas.cpp to avoid exposing SkGLDevice.h to the
public API.

The change also includes an explicit virtual destructor on SkDeviceFactory to
silence a -Wnon-virtual-dtor warning and allow for -Werror.

Original Issue: http://codereview.appspot.com/3009041/

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

git-svn-id: http://skia.googlecode.com/svn/trunk@623 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-11-11 00:49:41 +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
99a45d3b5a Fix SkDraw::validate to work with vector Devices.
Vector devices don't have a (valid) fBitmap, so pass in width and height.

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

git-svn-id: http://skia.googlecode.com/svn/trunk@616 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-26 19:44:10 +00:00