Commit Graph

75 Commits

Author SHA1 Message Date
reed@google.com
772813afa6 add code to test different premul techniques (disabled right now)
git-svn-id: http://skia.googlecode.com/svn/trunk@1030 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-30 22:34:45 +00:00
reed@google.com
e733071abe add refcnt helper to metadata
add unittests for metadata



git-svn-id: http://skia.googlecode.com/svn/trunk@1019 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-30 18:23:21 +00:00
reed@google.com
2ade0863c3 abort drawing if srcRect is outside of the bitmap bounds
git-svn-id: http://skia.googlecode.com/svn/trunk@951 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-17 17:48:04 +00:00
reed@google.com
ddbf4c85de remove unused methods from SkRefPtr, as a check-point for better understanding
what we want to do with this class.



git-svn-id: http://skia.googlecode.com/svn/trunk@903 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-08 16:06:06 +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
reed@google.com
8072e4fdc8 bump SkStrAppendScalar_MaxSize to 14 to accomodate the largest string now that
scalar->string uses %.8g. Floats have at most 8 significant digits, plus we add
more space for sign, decimal point and exponent.

add tests to check these limits.



git-svn-id: http://skia.googlecode.com/svn/trunk@872 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-01 15:44:08 +00:00
reed@google.com
fa06e52803 use sprintf to generate float->string for SkString routines, removing the
worry of first converting the scalar to a fixed.



git-svn-id: http://skia.googlecode.com/svn/trunk@865 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-28 21:29:58 +00:00
reed@google.com
f4888c4b45 add simple test for SkBitmap::getColor()
git-svn-id: http://skia.googlecode.com/svn/trunk@859 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-25 19:50:19 +00:00
reed@google.com
a67573e25f http://codereview.appspot.com/4233041/
Add templated version of SkAutoTUnref.
Add unittests for it.
Remove unused helper apis on SkAutoUnref.



git-svn-id: http://skia.googlecode.com/svn/trunk@858 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-25 18:10:29 +00:00
reed@google.com
bdee9fc778 add tests for SkClipStack
git-svn-id: http://skia.googlecode.com/svn/trunk@828 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-22 20:17:43 +00:00
reed@google.com
f9e7132075 add tests for pushing on back as well as front
git-svn-id: http://skia.googlecode.com/svn/trunk@827 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-22 19:56:18 +00:00
reed@google.com
4c09d5cd4b rename SkDeque::Iter to SkDeque::F2BIter, since it runs front-to-back (in preparation
for another iter that runs back-to-front (B2FIter).

add unittest for Deque



git-svn-id: http://skia.googlecode.com/svn/trunk@821 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-22 13:16:38 +00:00
reed@android.com
d413445531 update to work correctly for scalar == fixed or float
git-svn-id: http://skia.googlecode.com/svn/trunk@780 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-09 02:24:26 +00:00
reed@google.com
077910e20c add SkScalarIsFinite(), and use it for a more portable impl of SkRect::isValidCoords()
git-svn-id: http://skia.googlecode.com/svn/trunk@775 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-08 21:56:39 +00:00
vandebo@chromium.org
4854327772 [PDF] Add support for xfermodes / blend modes.
- Change SkGraphicState to track and set the blend mode (xfermode) for modes built in to PDF (non porter duff modes + src over).
- Add SkXfermode::asMode() to retrieve xfermode as an enum for non porter duff modes.
- Move SkXfermode.cpp around a bit to support asMode() -- Generally move utility functions toward the top of the file.
- Make SkPDFFormXObject an isolated transparency group, as it used for saveLayer, which draws on transparent, not the device background.
- Set the graphic state in drawDevice and drawBitmap in order to get the right xfermode and alpha.

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

git-svn-id: http://skia.googlecode.com/svn/trunk@774 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-08 19:28:07 +00:00
reed@google.com
62047cf198 clear the convex-hint in reset() and rewind(), to match its state in a newly
created path.

todo: convexity perhaps should be tristate: yes, no, unknown



git-svn-id: http://skia.googlecode.com/svn/trunk@768 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-07 19:39:09 +00:00
reed@google.com
534240f605 hide divide-by-zero from the compiler, to avoid the warning
git-svn-id: http://skia.googlecode.com/svn/trunk@766 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-07 19:08:59 +00:00
wjmaclean@chromium.org
ff1ec2f1a8 Add unit test for SkRect::hasValidCoordinates().
git-svn-id: http://skia.googlecode.com/svn/trunk@765 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-07 17:48:40 +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
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
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
9ce6e75248 init src either opaquely (e.g. white), or with a valid ctable index (e.g. 0)
git-svn-id: http://skia.googlecode.com/svn/trunk@680 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-01-10 14:04:07 +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
ea8509cd3b remove obsolete test
git-svn-id: http://skia.googlecode.com/svn/trunk@648 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-22 21:10:33 +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
agl@chromium.org
8cfdf01ff9 Correctly handle SkPath::kInverseWinding_FillType
Fix for http://code.google.com/p/skia/issues/detail?id=87

Even when SkPath::kInverseWinding_FillType is given, Skia left some
lines not filled(cleared) in one case.

Patch-by: morrita

http://codereview.appspot.com/3443041

git-svn-id: http://skia.googlecode.com/svn/trunk@630 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-06 18:52:40 +00:00
vandebo@chromium.org
ee34e35c8c Add flate compression test and fix bugs.
Review URL: http://codereview.appspot.com/3393041

git-svn-id: http://skia.googlecode.com/svn/trunk@628 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-12-02 22:55:33 +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
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
reed@android.com
097a351353 add SkRegion::setRects(), and its unit tests
git-svn-id: http://skia.googlecode.com/svn/trunk@588 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-13 18:35:14 +00:00
reed@android.com
f59799139b rename round, ceil, etc. to avoid some platform macros
git-svn-id: http://skia.googlecode.com/svn/trunk@577 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-15 00:57:50 +00:00
reed@android.com
b00cd7258c add SkRefPtr class (for testing at the moment)
git-svn-id: http://skia.googlecode.com/svn/trunk@555 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-04-16 20:35:47 +00:00
reed@android.com
c846ede6a0 fix build for SK_SCALAR_IS_FIXED
git-svn-id: http://skia.googlecode.com/svn/trunk@547 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-04-13 15:29:15 +00:00
reed@android.com
9f8f48e9e4 update blitrow test to exercise different widths for blitrow
git-svn-id: http://skia.googlecode.com/svn/trunk@530 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-03-15 20:48:02 +00:00
reed@android.com
8e4c93b04c disable 32A->565 + alpha for now, until it handles src-alpha==0 as a noop
git-svn-id: http://skia.googlecode.com/svn/trunk@525 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-03-09 15:21:28 +00:00
reed@android.com
1db89dc9a5 update tests for blitrow
git-svn-id: http://skia.googlecode.com/svn/trunk@524 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-03-08 22:00:55 +00:00
reed@android.com
78cd10529b add tests for blitting all opaque or all transparent (test opts)
git-svn-id: http://skia.googlecode.com/svn/trunk@523 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-03-08 20:23:57 +00:00
reed@android.com
60bc6d5cb0 add Make to SkTSize
git-svn-id: http://skia.googlecode.com/svn/trunk@497 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-02-11 11:09:39 +00:00
reed@android.com
f0ad0864af add unittest for copysign
git-svn-id: http://skia.googlecode.com/svn/trunk@496 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-02-09 19:18:38 +00:00
reed@android.com
d0a529d028 fix memory leak
git-svn-id: http://skia.googlecode.com/svn/trunk@471 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-01-08 14:01:41 +00:00
reed@android.com
a3d901099d add unittest for IntersectLine, used by hairlines
git-svn-id: http://skia.googlecode.com/svn/trunk@447 2bbb7eff-a529-9590-31e7-b0007b416f81
2009-11-30 12:48:33 +00:00
reed@android.com
e72fee513a add onSendClickToChildren to views, so a view can capture all clicks.
speedup some of the unittests that were too slow
minor cleanup in SkScan_Path, in prep for larger changes



git-svn-id: http://skia.googlecode.com/svn/trunk@426 2bbb7eff-a529-9590-31e7-b0007b416f81
2009-11-16 14:52:01 +00:00
reed@android.com
cafc9f9e80 fixes around isOpaque and dithering
- copyTo() now preserves isOpaqueness, and BitmapCopyTest tests it
- bitmap shader doesn't claim to have shadespan16 if dithering is on, since its
  sampler doesn't auto-dither (note that gradients do auto-dither in their
  16bit sampler)
- blitter setup just relies on the shader to report if its 16bit sampler can be
  called (allowing gradients to say yes regardless of dither, but bitmaps to say
  no if dithering is on)



git-svn-id: http://skia.googlecode.com/svn/trunk@331 2bbb7eff-a529-9590-31e7-b0007b416f81
2009-08-22 03:44:57 +00:00
reed@android.com
4516f4786f use sk_bzero instead of bzero, since it isn't always available.
git-svn-id: http://skia.googlecode.com/svn/trunk@244 2bbb7eff-a529-9590-31e7-b0007b416f81
2009-06-29 16:25:36 +00:00
reed@android.com
4b7577b042 add unittest for matrix::flatten
define constant for max value flatten/unflatten can return (so clients can put
the buffer on the stack)



git-svn-id: http://skia.googlecode.com/svn/trunk@243 2bbb7eff-a529-9590-31e7-b0007b416f81
2009-06-29 16:14:41 +00:00
reed@android.com
a0f5d1546d move xfermode modes from porterduff into xfermode itself
git-svn-id: http://skia.googlecode.com/svn/trunk@232 2bbb7eff-a529-9590-31e7-b0007b416f81
2009-06-22 17:38:10 +00:00