* 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
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
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
- 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
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
Fixed rendering of shadows under bitmaps.
Added an option to SkBlurMask to produce higher quality blurs.
The HQ blur option is propagated through SkBlurDrawLooper so that it can be invoked by WebKit for drawing shadows.
Added a shadow rendering test to gm.
Bugs fixed: 146, 150
Related Chromium bugs: 11153, 42654
Code review: http://codereview.appspot.com/4174049
git-svn-id: http://skia.googlecode.com/svn/trunk@818 2bbb7eff-a529-9590-31e7-b0007b416f81
- 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
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
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
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
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
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
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
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
[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
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
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
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
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
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
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
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
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
fix addArc to not wrap around if the sweepAngle is close to 360 but lost
precision when convert to radians (and then to unit vectors ala sin/cos)
git-svn-id: http://skia.googlecode.com/svn/trunk@495 2bbb7eff-a529-9590-31e7-b0007b416f81
the glyph's ID as well as its bounds. Made the universal
doIRect() non-abstract so that a child class can override
either the general flavor or the text flavor.
git-svn-id: http://skia.googlecode.com/svn/trunk@468 2bbb7eff-a529-9590-31e7-b0007b416f81
expose path.dump() all the time
UP arrow now toggles a grid of clip rects in sample app
git-svn-id: http://skia.googlecode.com/svn/trunk@443 2bbb7eff-a529-9590-31e7-b0007b416f81
This technique geometrically clips all segments against the clip bounds,
ensuring that we never send a value to the edgelist that might overflow in
fixedpoint.
Current disabled in SkScan_Path.cpp by a #define. There are a few minor pixel
differences between this and the old technique, as found by the gm tool, so
at the moment this new code is off by default.
git-svn-id: http://skia.googlecode.com/svn/trunk@432 2bbb7eff-a529-9590-31e7-b0007b416f81
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
This CL implements SSE2 optimizations for 3 of the 32bit blending blitters. It
uses CPUID to detect for SSE2 at runtime. In order to accomodate runtime
detection, it changes the platform procs from static arrays to static
functions.
It also includes an implementation of SkTime for Win32.
http://codereview.appspot.com/144072
git-svn-id: http://skia.googlecode.com/svn/trunk@418 2bbb7eff-a529-9590-31e7-b0007b416f81
call these new procs in (nearly) all the places we had inlined loops before.
In once instance (blitter_argb32::blitAntiH) we get different results by a
tiny bit. The new code is more accurate, and exactly inline with all of the
other like-minded blits, so I think the change is good going forward.
git-svn-id: http://skia.googlecode.com/svn/trunk@366 2bbb7eff-a529-9590-31e7-b0007b416f81
(like gradients) to support predithering. If they do, then they would suppress
kConstInY16, since they no longer are const.
The blitters now check for each flag separately, so we don't have to give up
const-in-Y in the 32bit case, since in that mode we don't care about dithering.
git-svn-id: http://skia.googlecode.com/svn/trunk@339 2bbb7eff-a529-9590-31e7-b0007b416f81
- 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
- smulbb is only on ARMv5TE and above (p316, ARM Architecture Reference Manual)
- an empty clobber list causes a compiler error with my compiler, gcc-4.3.2
Patch by Joel Stanley <joel@jms.id.au>
Review URL: http://codereview.appspot.com/96165
git-svn-id: http://skia.googlecode.com/svn/trunk@329 2bbb7eff-a529-9590-31e7-b0007b416f81
all slides
add beforeChild/afterChild methods for parents to wack the canvas before/after
it draws. These are called after the std child-view translate and clip, unlike
beforeChildren/afterChildren
git-svn-id: http://skia.googlecode.com/svn/trunk@324 2bbb7eff-a529-9590-31e7-b0007b416f81
Because the underlying mask extends a pixel to the left and right (or
top and bottom on vertical LCDs), the requested pixel can actaully be
one pixel outside the bounds, thus this assertion is incorrect.
http://codereview.appspot.com/105077
git-svn-id: http://skia.googlecode.com/svn/trunk@312 2bbb7eff-a529-9590-31e7-b0007b416f81
before we turn it into a font-cache entry, for the cases where the scaler will
ignore and/or collapse certain feature requests (e.g. doesn't support all levels
of hinting)
git-svn-id: http://skia.googlecode.com/svn/trunk@283 2bbb7eff-a529-9590-31e7-b0007b416f81
feature (since we already have subpixel text support)
fix some debug-compile problems
update Makefile for lcd files
git-svn-id: http://skia.googlecode.com/svn/trunk@282 2bbb7eff-a529-9590-31e7-b0007b416f81
This patch adds support for rendering subpixel glyphs (using
Freetype). In order to control this rendering see
SkPaint::setLCDRenderText in SkPaint.h.
To setup the LCD mode, see SkFontHost::SetSubpixelOrientation and
SkFontHost::SetSubpixelOrder in SkFontHost.h.
This patch also adds more fine grained control over hinting (again,
only for Freetype currently). One can now control the hinting with
SkPaint::setHinting.
git-svn-id: http://skia.googlecode.com/svn/trunk@275 2bbb7eff-a529-9590-31e7-b0007b416f81
use internal mutable version of drawPath when we've cons'd up a path on behalf
of a rect
git-svn-id: http://skia.googlecode.com/svn/trunk@258 2bbb7eff-a529-9590-31e7-b0007b416f81
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
rename setXfermode(Mode) to setXfermodeMode(Mode) for sanity
fix memory leak in setXfermode(Mode)
git-svn-id: http://skia.googlecode.com/svn/trunk@239 2bbb7eff-a529-9590-31e7-b0007b416f81
this signals blitters that the shader will return the same results for a given
x value, independent of y. Useful inside blitRect(), where it can cache the
first call to shadeSpan() and reuse it on all subsequent scans. Works with
(non-rotated) linear-gradients, and Nx1 bitmaps.
git-svn-id: http://skia.googlecode.com/svn/trunk@214 2bbb7eff-a529-9590-31e7-b0007b416f81
set linewidth in gldevice for hair rects
remove some cruft from samples
add more gl-unimpl messages
git-svn-id: http://skia.googlecode.com/svn/trunk@199 2bbb7eff-a529-9590-31e7-b0007b416f81
need to separate out SK_BUILD_FOR_MAC when we need to know where certain OS
headers are, and SK_BUILD_FOR_SDL when we are choosing an SkOSWindow variant...
git-svn-id: http://skia.googlecode.com/svn/trunk@190 2bbb7eff-a529-9590-31e7-b0007b416f81
existing obj->safeRef(), which is unsafe since it can its 'if (this)' can be
optimized away by some compilers.
fix some overflows in mimpmap generation
git-svn-id: http://skia.googlecode.com/svn/trunk@181 2bbb7eff-a529-9590-31e7-b0007b416f81
add SkShape baseclass, in the hopes of having SkPicture inherit from that, and
also using shapes as the extension mechanism for things like animated-gif
git-svn-id: http://skia.googlecode.com/svn/trunk@174 2bbb7eff-a529-9590-31e7-b0007b416f81
Index8.
Also, change the logic of SkBitmap.copyTo() to do memcpy() if srcConfig
and dstConfig are the same.
git-svn-id: http://skia.googlecode.com/svn/trunk@164 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add the following font metrics fields:
+ fAvgCharWidth
+ fXMin
+ fXMax
+ fXHeight
* Add \#if 0'ed includes for the Freetype headers for Xcode, scons and
other tools which chase headers.
* Correctly render 1bpp fonts (mostly Chinese fonts at small sizes)
git-svn-id: http://skia.googlecode.com/svn/trunk@157 2bbb7eff-a529-9590-31e7-b0007b416f81
add comments and cleanup to count_tables in SkFontHost_tables.cpp
fix transparency bug in gifs
use (alpha+1) for blending in srcover mode, to ensure opaque results
git-svn-id: http://skia.googlecode.com/svn/trunk@155 2bbb7eff-a529-9590-31e7-b0007b416f81
Call unalloc if a paint (or other cached object) is already in our list for picture recording
Use correct CompareType macro in SkCanvas::quickReject
git-svn-id: http://skia.googlecode.com/svn/trunk@138 2bbb7eff-a529-9590-31e7-b0007b416f81
logical fontID.
Extend ImageRef to accept an imagedecoder factory, to replace calling the std
one.
git-svn-id: http://skia.googlecode.com/svn/trunk@125 2bbb7eff-a529-9590-31e7-b0007b416f81
skia std. of receiver calls ref() if it needs to, but regardless, the caller
always manages/balances its own ownership.
git-svn-id: http://skia.googlecode.com/svn/trunk@121 2bbb7eff-a529-9590-31e7-b0007b416f81
- FindTypeface is now CreateTypeface, and what it returns is always considered
a new instance, even if it is from a cache (in which case it will have been
ref()'d. The caller must always balance its ownership by calling unref() on
the result when they are done.
- CloseStream is gone, since the caller can/must call stream->unref() when they
are done using it.
- ResolveTypeface is now ValidFontID, and just returns a bool.
git-svn-id: http://skia.googlecode.com/svn/trunk@109 2bbb7eff-a529-9590-31e7-b0007b416f81
see private headers. This also means the tests don't have to use ../.. to find
the private header they want.
git-svn-id: http://skia.googlecode.com/svn/trunk@107 2bbb7eff-a529-9590-31e7-b0007b416f81