Commit Graph

191 Commits

Author SHA1 Message Date
reed@google.com
e280f1d164 bump SkStrAppendScalar_MaxSize to 15 to handle 3-digit exponents on some
platforms (like windows)



git-svn-id: http://skia.googlecode.com/svn/trunk@881 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-03 18:43:14 +00:00
vandebo@chromium.org
677cbedda7 Expose explicit functions to stringify float's and fixed's.
See http://codereview.appspot.com/4240050/

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

git-svn-id: http://skia.googlecode.com/svn/trunk@880 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-03 18:20:12 +00:00
bsalomon@google.com
d302f1401b Add support for clipstack to Gr. GrClip is now a list of rects and paths with set operations to combine them. The stencil buffer is used to perform the set operations to put the clip into the stencil buffer. Building Gr's clip from Skia's clipStack is currently disabled due to the fact that Skia's clipStack is relative to the root layer not the current layer. This will be fixed in a subsequent CL.
git-svn-id: http://skia.googlecode.com/svn/trunk@878 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-03 13:54:13 +00:00
reed@google.com
1d12b1fd66 add setXYWH to rects
new tests for circles



git-svn-id: http://skia.googlecode.com/svn/trunk@877 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-03-03 13:23:35 +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
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
vandebo@chromium.org
112706d4c5 Add SkBitmap::getColor(int x, int y) - return the color of a pixel in a bitmap.
Review URL: http://codereview.appspot.com/4230041

git-svn-id: http://skia.googlecode.com/svn/trunk@854 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-24 22:50:55 +00:00
reed@google.com
93c5f9e787 Guard globalRef() virtual with #ifdef ANDROID, as these are not implemented
nor called by Skia proper.



git-svn-id: http://skia.googlecode.com/svn/trunk@850 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-24 18:09:46 +00:00
reed@google.com
875b4ecef7 add isFixedWidth() to expose the newly added attribute
git-svn-id: http://skia.googlecode.com/svn/trunk@849 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-24 18:03:12 +00:00
vandebo@chromium.org
d3ae77965e Add asAGradient shader extraction API.
Store initial gradient parameters.
Add compile asserts in GPU code for BitmapType ordering.

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

git-svn-id: http://skia.googlecode.com/svn/trunk@845 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-24 00:21:06 +00:00
reed@google.com
7d7ca79c3e add fClipStack optional field to SkDraw (it is always set by canvas)
git-svn-id: http://skia.googlecode.com/svn/trunk@844 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-23 22:39:18 +00:00
djsollen@google.com
57f4969724 merge from android tree:
- optional parameters added to descriptorProc and allocPixels
- clip options to image decoders
- check for xfermode in blitter_a8
- UNROLL loops in blitrow

reviewed by reed@google.com



git-svn-id: http://skia.googlecode.com/svn/trunk@841 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-23 20:46:31 +00:00
reed@google.com
5b31b0f1ea add fixed-width attribute to typeface
(patch from russellbrenner)



git-svn-id: http://skia.googlecode.com/svn/trunk@837 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-23 14:41:42 +00:00
bsalomon@google.com
57788b5ada Fix warnings about struct being forward declared as a class
git-svn-id: http://skia.googlecode.com/svn/trunk@833 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-22 21:00:31 +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
reed@google.com
5c3d1471e4 add clipstack to canvas. not used yet, but will be for devices (e.g. gpu) that
want to see how the clip was built



git-svn-id: http://skia.googlecode.com/svn/trunk@824 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-22 19:12:23 +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@google.com
40981ba42a remove dead conditional code
git-svn-id: http://skia.googlecode.com/svn/trunk@811 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-18 12:57:26 +00:00
reed@google.com
e686322eba add no-check version of SkPackARGB32, for callers that want to deliberately
build a SkPMColor that may not be valid premultiplied (e.g. compatibility
with webgl)

see https://bugs.webkit.org/show_bug.cgi?id=54023



git-svn-id: http://skia.googlecode.com/svn/trunk@796 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-15 14:22:19 +00:00
vandebo@chromium.org
6f72d1eacd Provide windows font host implementation needed to support TrueType text in pdf backend.
- Move AdvanceMetric template functions into new file SkAdvancedTypefaceMetrics.cpp

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

git-svn-id: http://skia.googlecode.com/svn/trunk@789 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-14 23:19:59 +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
3dd42b3c87 update dox for readPixels()
git-svn-id: http://skia.googlecode.com/svn/trunk@772 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-07 22:44:43 +00:00
reed@google.com
88daf2803a check for SK_BUILD_FOR_BREW
git-svn-id: http://skia.googlecode.com/svn/trunk@771 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-02-07 20:05:49 +00:00
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
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
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
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
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
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
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
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
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@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@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
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
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