Commit Graph

693 Commits

Author SHA1 Message Date
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
7d71f7f655 Implement SkPDFDevice::drawPath(...)
This depends on http://codereview.appspot.com/2721041

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

git-svn-id: http://skia.googlecode.com/svn/trunk@620 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-26 19:51:44 +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
vandebo@chromium.org
ad11495e3d Bug fix in SkPDFImage.
Need to lock the pixels to make sure they are there.

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

git-svn-id: http://skia.googlecode.com/svn/trunk@615 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-26 19:43:14 +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
scarybeasts@gmail.com
17f694b038 Clamp the maximum size of glyph width we will attempt to render.
Review URL: http://codereview.appspot.com/2519045



git-svn-id: http://skia.googlecode.com/svn/trunk@607 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-18 23:29:36 +00:00
scarybeasts@gmail.com
6b9de8cb93 Fix a signedness issue with massive allocations, and also a truncation issue on
64-bit.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@606 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-18 22:56:49 +00:00
vandebo@chromium.org
b70ae310bb Fix a memory leak in the new Canvas/Device workflow.
The previous change made it difficult to inherit from SkCanvas without leaking memory.  By making SkDeviceFactory not reference counted, the right thing happens more naturally, just NewCanvas : public SkCanvas(new NewDeviceFactory()) {...}

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

git-svn-id: http://skia.googlecode.com/svn/trunk@605 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-15 18:58:19 +00:00
vandebo@chromium.org
8d84fac294 Refactor SkCanvas so that backends don't need to override it.
Methods or classes that should go away are marked deprecated. The only thing I know of that breaks backward compatibility is SkCanvas((SkDevice*)NULL), but that is fairly unlikely to occur in the wild because that constructor had a default value of NULL.

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

git-svn-id: http://skia.googlecode.com/svn/trunk@604 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-13 22:13:05 +00:00
senorblanco@chromium.org
60eaa398eb SkPath::arcTo() will cause uninitialized memory reads in the following cases:
- when the previous point in the path and (x1, y1) are coincident
- when (x1, y1) and (x2, y2) are coincident

These cause the setNormalize() calls to leave the "before" and "after" vectors
uninitialized, respectively, which are then used to compute cosh and sinh.

I chose to implement HTML5 canvas behaviour for these cases (as well as for the
case where all three points are collinear):  add a line to the first point, and
bail.  I think this is ok, since skia is mostly used for HTML5 browsers, and
this case is degenerate anyway.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@603 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-10-13 18:47:00 +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
3ce77e4d13 call readyToDraw() instead of just checking for null pixels, since we could
have a bitmap with pixels, but no (required) colortable. readyToDraw() knows
to check for this.



git-svn-id: http://skia.googlecode.com/svn/trunk@599 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-09-10 17:26:24 +00:00
agl@chromium.org
8b17ac3a43 S32A_Blend_BlitRow32: for ARM without NEON
The S32A_Blend_BlitRow32 function was written and unrolled in ARM
assembly to improve the rendering performance on ARM cores lacking
NEON.

Added in SkBlitRow_opts_arm.cpp.

Performance improvement about ~18% on micro benchmarking.

Patch-by: Vassillis

git-svn-id: http://skia.googlecode.com/svn/trunk@598 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-09-10 15:09:42 +00:00
reed@android.com
49099b2536 move SkMallocPixelRef into its own .cpp file, rather than embedding it
inside SkBitmap.cpp.

core_files.mk updated, but if your build does not reference that, you will
need to add SkMallocPixelRef.cpp to your list



git-svn-id: http://skia.googlecode.com/svn/trunk@597 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-09-09 16:07:53 +00:00
reed@android.com
ce4e53a234 add abstract wrapper for platform-specific bitmap backends
git-svn-id: http://skia.googlecode.com/svn/trunk@596 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-09-09 16:01:26 +00:00
agl@chromium.org
94d1464cca Write S32A_Opaque_BlitRow32 function in ARM assembly.
(Improves the rendering performance on ARM cores lacking NEON.)

Performance improvement about ~9% on Peacekeeper rendering benchmarks.

Patch by: Vasileios Laganakos (ARM)

http://codereview.appspot.com/1873044/

git-svn-id: http://skia.googlecode.com/svn/trunk@595 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-08-17 16:24:15 +00:00
agl@chromium.org
21417a7b4b Add versions of memset16() and memset32() in ARM assembly.
In benchmarks here on Cortex A9 processors, this code runs 25-30% faster
than the C equivalent.

Patch by: Steve McIntyre (ARM)

http://codereview.appspot.com/1973042

git-svn-id: http://skia.googlecode.com/svn/trunk@594 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-08-13 17:05:28 +00:00
agl@chromium.org
61a678a28d Add support for TTC font files in SkFontHost_Freetype.
This is a companion change to a Chrome CL (
http://codereview.chromium.org/2870073/show )

(Patch by: jshin (Chromium))

BUG=http://crbug.com/50389
TEST=See the Chromium CL mentioned above.

http://codereview.appspot.com/1847046

git-svn-id: http://skia.googlecode.com/svn/trunk@593 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-08-06 18:08:18 +00:00
agl@chromium.org
c9c9ebbc29 Make SKColorSetARGB() a macro when not building debug.
This allows GCC to avoid generating static initializers for code that
uses it.

Patch by: Dave Moore

http://codereview.appspot.com/1883043/show

git-svn-id: http://skia.googlecode.com/svn/trunk@592 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-28 17:10:30 +00:00
agl@chromium.org
0afaf9b563 Fix precedence error.
Flagged as a compiler warning. It appears that it was intended that the
conjuction not bind so tightly.

git-svn-id: http://skia.googlecode.com/svn/trunk@591 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-28 17:10:28 +00:00
reed@android.com
cb34235f46 fix matrix use in coretext fonthost
update gm images to new baseline



git-svn-id: http://skia.googlecode.com/svn/trunk@590 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-22 18:27:53 +00:00
senorblanco@chromium.org
0e21ec009a Fix for SkMatrix::invert() for large coordinate values.
See http://codereview.appspot.com/1731053



git-svn-id: http://skia.googlecode.com/svn/trunk@589 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-20 15:20:01 +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
930056ed27 fix reference bugs in font linklist
git-svn-id: http://skia.googlecode.com/svn/trunk@587 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-08 16:39:02 +00:00
kbr@chromium.org
2e086190e5 Added optional "ambiguous" outgoing argument to XRay queries so that
calling code may choose different y-coordinates for better robustness.
Tested and verified manually inside O3D.

BUG=none
TEST=none

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


git-svn-id: http://skia.googlecode.com/svn/trunk@586 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-07 22:20:35 +00:00
reed@android.com
4040861465 oops, also update dox for saveLayerAlpha
git-svn-id: http://skia.googlecode.com/svn/trunk@585 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-02 17:24:23 +00:00
reed@android.com
ad164b2025 update dox for saveLayer()
git-svn-id: http://skia.googlecode.com/svn/trunk@584 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-07-02 17:20:51 +00:00
reed@android.com
7925a1411f http://codereview.appspot.com/1706045/show
git-svn-id: http://skia.googlecode.com/svn/trunk@583 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-24 21:04:23 +00:00
agl@chromium.org
a40390c08b Revert "Implementing S32A_Opaque_BlitRow32 using v7 neon instructions."
Broke ARM build.

git-svn-id: http://skia.googlecode.com/svn/trunk@582 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-18 15:30:12 +00:00
agl@chromium.org
1960ff67bd Revert "We extract a sub-function from MAKENAME(_nofilter_DX), only dealing with reading"
Broke ARM build.

git-svn-id: http://skia.googlecode.com/svn/trunk@581 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-18 15:30:10 +00:00
agl@chromium.org
a2c71cbd51 Add support for forcing autohinting.
http://codereview.appspot.com/1651044/show

git-svn-id: http://skia.googlecode.com/svn/trunk@580 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-17 20:49:17 +00:00
agl@chromium.org
46e2ec5101 We extract a sub-function from MAKENAME(_nofilter_DX), only dealing with reading
one index array, indexing into src array and output to dst array.

Because of the scatter-gather nature, we can not do much burst/batch
reading/writing to improve the performance.

We tried Neon vector instructions.  We also tried the hand optimize the compiler
generated assembly (non-neon) code.  The latter seems to have better gain.
About 6% improvements, not much though...

Patch-by: Xin Qi of codeaurora.org

http://codereview.appspot.com/1127042/show

git-svn-id: http://skia.googlecode.com/svn/trunk@579 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-16 20:04:13 +00:00
agl@chromium.org
244929c1fc Implementing S32A_Opaque_BlitRow32 using v7 neon instructions.
Taking the advantage of 16 channels of each QualWord register.  Also using the
software pipelining to scatter the loads/stores among vector operations.

Got roughly 70% improvements on simulation environments.

http://codereview.appspot.com/1148042/show

Patch-by: XinQi of codeaurora.org

git-svn-id: http://skia.googlecode.com/svn/trunk@578 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-16 19:52:29 +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
agl@chromium.org
4f9cdcc810 Compile fix for shared library builds.
Patch by: Evan Martin.

git-svn-id: http://skia.googlecode.com/svn/trunk@576 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-10 21:32:00 +00:00
agl@chromium.org
36bb697683 Add include of FT_SYNTHESIS_H
In older versions of Freetype, the FT_GlyphSlot_Own_Bitmap function is
defined in FT_SYNTHESIS_H. Modern versions have it in FT_BITMAP_H.

git-svn-id: http://skia.googlecode.com/svn/trunk@575 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-04 20:57:16 +00:00
agl@chromium.org
e76073bfcd Add support for fake bold of bitmap fonts.
BUG=45874

http://codereview.appspot.com/1558041/show

git-svn-id: http://skia.googlecode.com/svn/trunk@574 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-04 20:31:17 +00:00
agl@chromium.org
aab4090b57 Add Neon versions of memset32 and memset16
Patch by pgalizia (of codeaurora.org)

(Note: I don't read ARM and I didn't manage to find a reviewer for the
ARM assembly code so this is landing somewhat unreviewed.)

http://codereview.appspot.com/1157045/show

git-svn-id: http://skia.googlecode.com/svn/trunk@573 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-04 14:47:38 +00:00
reed@android.com
268013bfa6 add carbon.h include
git-svn-id: http://skia.googlecode.com/svn/trunk@572 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-03 14:47:27 +00:00
reed@android.com
7bea2972bb remove duplicate LCD functions (these are portable, and live in SkFontHost.cpp)
git-svn-id: http://skia.googlecode.com/svn/trunk@571 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-06-01 21:01:35 +00:00
reed@android.com
feda2f90a4 separate mac fonthost into atsui (32bit, pre-10.6) and coretext (64bit, 10.6)
implementations.

code submitted by http://codereview.appspot.com/user/refnum



git-svn-id: http://skia.googlecode.com/svn/trunk@570 2bbb7eff-a529-9590-31e7-b0007b416f81
2010-05-19 13:47:05 +00:00