Commit Graph

79 Commits

Author SHA1 Message Date
rmistry@google.com
fbfcd56021 Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part I of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6485054

git-svn-id: http://skia.googlecode.com/svn/trunk@5262 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-23 18:09:54 +00:00
senorblanco@chromium.org
1fb9525e50 warning fix (unreviewed).
git-svn-id: http://skia.googlecode.com/svn/trunk@5258 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-23 16:29:26 +00:00
senorblanco@chromium.org
84207c4278 Move the code for the GPU implementation of morphology effects from GrContext
and GrMorphologyEffect.* into SkMorphologyImageFilter.cpp.

Review URL:  https://codereview.appspot.com/6458065/



git-svn-id: http://skia.googlecode.com/svn/trunk@5241 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-22 20:51:19 +00:00
senorblanco@chromium.org
b2ee33c535 Implements the non-Porter-Duff compositing modes required for SVG's feBlend
element.  This filter has two inputs, since normal blending can't be used.  The
GPU side uses two filter stages to accomplish this:  one to sample the
background, and one to sample the foreground and blend it.

Review URL:  https://codereview.appspot.com/6463081/



git-svn-id: http://skia.googlecode.com/svn/trunk@5231 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-22 16:24:44 +00:00
senorblanco@chromium.org
44888c66d4 Move SkColorFilterImageFilter into its own file.
Review URL:  https://codereview.appspot.com/6463072/



git-svn-id: http://skia.googlecode.com/svn/trunk@5197 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-20 19:23:24 +00:00
senorblanco@chromium.org
bf2768bab9 Refactor SkImageFilter into its own .cpp file.
Review URL:  https://codereview.appspot.com/6465073/



git-svn-id: http://skia.googlecode.com/svn/trunk@5188 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-20 15:43:14 +00:00
senorblanco@chromium.org
f1369ce607 Implements a new class, SkSingleInputImageFilter, to handle DAG connectivity
for filters with a single image input.  This provides functionality to store,
flatten and unflatten a single SkImageFilter input, as well as to recursively
evaluate it on the CPU or GPU.  The following classes were re-parented to 
implement DAG connectivity:  SkBlurImageFilter, SkDilateImageFilter,
SkErodeImageFilter, SkColorFilterImageFilter.  The constructors for each
have been appended with a new parameter, representing the input filter
(default NULL).

This change also implements an arbitrary SkBitmap input source for filtering,
SkBitmapSource.

NOTE:  This CL will require gyp file changes when rolling past this revision.

Review URL:  https://codereview.appspot.com/6462071/



git-svn-id: http://skia.googlecode.com/svn/trunk@5170 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-20 14:53:21 +00:00
bsalomon@google.com
82aa7482cb Add a zoom filter to Skia. This will be used on ChromeOS to implement the screen magnifier.
Committed on behalf of zork@chromium.org

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


git-svn-id: http://skia.googlecode.com/svn/trunk@5056 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-13 14:22:17 +00:00
reed@google.com
d74e710c00 remove SkShape (unused)
Review URL: https://codereview.appspot.com/6461069

git-svn-id: http://skia.googlecode.com/svn/trunk@5033 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-09 18:05:33 +00:00
djsollen@google.com
c73dd5c688 Update SkFlattenable buffers to be more modular.
This CL is an effort to stage the conversion to named
parameters for all SkFlattenable commands. This particular
stage only does the following two things...

1. Move flattenable buffers from SkFlattenable.h into
   their own header.
2. Update and Add new read write methods for better clarity
   and convenience.

BUG=

Review URL: https://codereview.appspot.com/6448095

git-svn-id: http://skia.googlecode.com/svn/trunk@4980 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-07 15:54:32 +00:00
senorblanco@chromium.org
302cffba86 Replace the asAFoo() functions in SkImageFilter with canFilterImageGPU() and
onFilterImageGPU() virtuals.  This allows each filter to implement its own GPU
processing code, even for multi-pass filters.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@4900 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-01 20:16:34 +00:00
senorblanco@chromium.org
894790d77c This patch implements the diffuse and specular lighting filters in Ganesh.
There are three light types for each:  distant, point and spot, whose code
generation lives in a GrGLLight class hierarchy.  This similar to the CPU
implementation, where each light type provides a function to compute the vector
from the surface plane to the light (surfaceToLight) and to compute the light
colour (emitLightColour).  Instead of templated member functions, as in the CPU
implementation, these are virtual functions to emit the light-specific GLSL
code.

All of the code for the GPU path lives in the same file as that for the CPU
path, SkLightingImageFilter.cpp.  In order to provide Ganesh a hook to access
it, SkImageFilter now has a asNewCustomStage() virtual, which allows an image
filter to return a GrCustomStage representing that filter.

Note that this patch does not handle the border conditions correctly (the
[top|bottom][Left|Right]Normal() functions in the CPU implementation).  That
will come in a future patch.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@4535 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-07-11 16:01:22 +00:00
senorblanco@chromium.org
bdb1ec453a Minor cleanup in lighting image filters: Made the light color a member of the
light, rather than the filter, so computation is localized.  Changed a couple
of non-const refs in the image filter creation API const refs.  Changed "const
SkColor&" to "SkColor", since it's just a uint32_t anyway.

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


git-svn-id: http://skia.googlecode.com/svn/trunk@4466 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-07-09 14:29:51 +00:00
robertphillips@google.com
0456e0b7b8 Added Inst counting to SkFlattenable-derived classes
http://codereview.appspot.com/6355043/



git-svn-id: http://skia.googlecode.com/svn/trunk@4359 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-27 14:03:26 +00:00
djsollen@google.com
0833777df1 Cleanup flattening code to properly serialize lighting image filters.
Review URL: https://codereview.appspot.com/6333070

git-svn-id: http://skia.googlecode.com/svn/trunk@4340 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-26 14:33:13 +00:00
senorblanco@chromium.org
f49b429cef Raster implementation of diffuse and specular lighting filters. Externally,
the caller instantiates a light (distant, point or spot), and an
SkDiffuseLightingFilter or SkSpecularLightingImageFilter with that light.  A
Sobel edge detection filter is applied to the alpha of the incoming bitmap, and
the result is used as a height map for lighting calculations.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@4314 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-22 21:01:23 +00:00
reed@google.com
cb7be694c3 Add new gradient to support HTML Canvas2D two-point-radial-gradient. Ours is
called (for now at least) TwoPointConical, to distinguish it from the
existing one (TwoPointRadial), and to reflect its odd behavior where it draws
transparent outside the boundary of the "cone" between the two circles.

This impl is unsupported by GPU and Printing at the moment, and Chrome does not
yet invoke it.
Review URL: https://codereview.appspot.com/6299051

git-svn-id: http://skia.googlecode.com/svn/trunk@4197 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-06 20:31:56 +00:00
robertphillips@google.com
0090ec7cb0 Fix for compiler error in r4154
git-svn-id: http://skia.googlecode.com/svn/trunk@4155 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-05 13:12:53 +00:00
robertphillips@google.com
941ee9303b Fixed flattening of SkStippleMaskFilter
http://codereview.appspot.com/6279052/



git-svn-id: http://skia.googlecode.com/svn/trunk@4154 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-05 12:55:05 +00:00
reed@google.com
7b6c19392c remove mutable apis on SkColorMatrixFilter, must use constructor.
fix flattening to not write function-ptrs (no go for serialization), so we
store the raw float values now.

Slight change to GM/DRT images for GPU possible. Just rebaseline.
Review URL: https://codereview.appspot.com/6273052

git-svn-id: http://skia.googlecode.com/svn/trunk@4143 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-04 19:07:41 +00:00
tomhudson@google.com
1f90287df3 Punctuation cleanup to satisfy idiosyncracies of OpenBSD gcc 4.2.1.
Original patch by landry.breuil.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@4112 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-01 13:15:47 +00:00
reed@google.com
fd4be26c42 Change patheffect to take a (new) StrokeRec object, which encapsulates the fill
or stroke parameters for a path.

Today, the patheffect only sees if the caller was going to stroke or fill, and
if stroke, it just sees the width. With this change, the effect can see all of the
related parameters (e.g. cap/join/miter). No other change is intended at this
time.

After this change, I hope to use this additional data to allow SkDashPathEffect
to, at times, apply the stroke as part of its effect, which may be much more
efficient than first dashing, and then reading that and stroking it.

Most of these files changed just because of the new parameter to filterPath. The
key changes are in SkPathEffect.[h,cpp], SkPaint.cpp and SkScalerContext.cpp
Review URL: https://codereview.appspot.com/6250051

git-svn-id: http://skia.googlecode.com/svn/trunk@4048 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-25 01:04:12 +00:00
reed@google.com
d3521f1a8d revert 4046 -- GM:pathfill failed on one bot, maybe uninitialized memory somewhere?
git-svn-id: http://skia.googlecode.com/svn/trunk@4047 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-24 20:32:22 +00:00
reed@google.com
9797272edf Change patheffect to take a (new) StrokeRec object, which encapsulates the fill
or stroke parameters for a path.

Today, the patheffect only sees if the caller was going to stroke or fill, and if
stroke, it just sees the width. With this change, the effect can see all of the
related parameters (e.g. cap/join/miter). No other change is intended at this
time.

After this change, I hope to use this additional data to allow SkDashPathEffect
to, at times, apply the stroke as part of its effect, which may be much more
efficient than first dashing, and then reading that and stroking it.

Most of these files changed just because of the new parameter to filterPath. The
key changes are in SkPathEffect.[h,cpp], SkPaint.cpp and SkScalerContext.cpp
Review URL: https://codereview.appspot.com/6249050

git-svn-id: http://skia.googlecode.com/svn/trunk@4046 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-24 20:13:57 +00:00
epoger@google.com
20bf4ca8f5 Clean up DashPathEffect modulo math from r3761
Review URL: https://codereview.appspot.com/6124048

git-svn-id: http://skia.googlecode.com/svn/trunk@3773 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-04-27 13:34:52 +00:00
mike@reedtribe.org
90bf427001 proper handling if SkMatrix::invert failes, addresses hack fix in rev. 3657
git-svn-id: http://skia.googlecode.com/svn/trunk@3679 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-04-14 19:06:16 +00:00
djsollen@google.com
54924243c1 Cleanup code related to SkFlattenable::flatten()
The following changes were made by this CL:

1. Make flatten() a protected method as callers should use
   SkFlattenableWriteBuffer to flatten an object
2. Make flatten a const method (including subclasses)
3. Mark subclass implementation of flatten with SK_OVERRIDE
4. Ensure overridden flatten impls call their parent
5. Remove no-op implementations of flatten from subclasses

Additionally, if necessary the unflattening constructor was
also moved to the protected section of the subclasses
header if it was not already there.

git-svn-id: http://skia.googlecode.com/svn/trunk@3540 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-03-29 15:18:04 +00:00
vandebo@chromium.org
a728e35edc Fix a bunch of Coverity defects - class members not initialized in the constructor.
CID=14533,14036,9275,9271,4156,4153,4151,1666,1665,1618,1617,1616,1615

Review URL: https://codereview.appspot.com/5940049

git-svn-id: http://skia.googlecode.com/svn/trunk@3532 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-03-28 20:29:38 +00:00
djsollen@google.com
ba28d03e94 Create macro for registering classes for deserialization
Review URL: https://codereview.appspot.com/5909063

git-svn-id: http://skia.googlecode.com/svn/trunk@3494 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-03-26 17:57:35 +00:00
djsollen@google.com
a2ca41e3af Cleanup Macros arround static initializers for SkFlattenable.
This CL also removes an unused debugging function from the class
Review URL: https://codereview.appspot.com/5890043

git-svn-id: http://skia.googlecode.com/svn/trunk@3483 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-03-23 19:00:34 +00:00
senorblanco@chromium.org
05054f1a78 Erode and dilate image filter effects, CPU and GPU implementations.
Review URL:  http://codereview.appspot.com/5656067/



git-svn-id: http://skia.googlecode.com/svn/trunk@3310 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-03-02 21:05:45 +00:00
thakis@chromium.org
2857a784f7 Remove extra SK_API
(It's already on the class, not needed on the method too.)

Review URL: http://codereview.appspot.com/5649057/
Patch from Dominic Mazzoni <dmazzoni@chromium.org>!



git-svn-id: http://skia.googlecode.com/svn/trunk@3169 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-02-10 22:49:31 +00:00
thakis@chromium.org
368b419200 Mark SkColorFilter and SkCreateCGImageRefWithColorspace as SK_API.
Required for the chromium/mac components build.

BUG=chromium:90078
Review URL: https://codereview.appspot.com/5642073/



git-svn-id: http://skia.googlecode.com/svn/trunk@3160 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-02-09 22:09:41 +00:00
vandebo@chromium.org
f724c4df1c Add SK_API to SkTableColorFilter
Patch from dmazzoni@chromium.org original CL: http://codereview.appspot.com/5645055/

Review URL: https://codereview.appspot.com/5642060

git-svn-id: http://skia.googlecode.com/svn/trunk@3153 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-02-08 17:01:54 +00:00
reed@google.com
8bb3ba151e need to include SkColorFilter.h since we reference some methods on it
in our inline functions.



git-svn-id: http://skia.googlecode.com/svn/trunk@3089 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-01-26 04:13:31 +00:00
senorblanco@chromium.org
c79fd6ea3f Export SkColorMatrixFilter via SK_API.
Review URL:  http://codereview.appspot.com/5534064/



git-svn-id: http://skia.googlecode.com/svn/trunk@3006 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-01-10 21:56:40 +00:00
reed@google.com
76dd277b1f add filterImage() entry-point to SkDevice, to allow it to specialize on subclasses
of SkImageFilter. If that returns false, then the filter itself is invoked.



git-svn-id: http://skia.googlecode.com/svn/trunk@2977 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-01-05 21:15:07 +00:00
mike@reedtribe.org
a69b48c29d Add SkTableColorFilter, as a foundation for several SVG filters
git-svn-id: http://skia.googlecode.com/svn/trunk@2933 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-28 20:31:00 +00:00
mike@reedtribe.org
7012162d2f add SK_OVERRIDE
git-svn-id: http://skia.googlecode.com/svn/trunk@2932 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-28 20:17:42 +00:00
senorblanco@chromium.org
e5ff3cefe0 Implement SkColorFilter::asColorMatrix() virtual, and override in
SkColorMatrixFilter.  Implement missing SkColorMatrixFilter::setMatrix() and
setArray() functions (were in .h, just not implemented).  Add a gm for color
matrix filters.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@2909 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-20 20:58:18 +00:00
senorblanco@chromium.org
ae814c7476 A software implementation of the Gaussian blur filter, using 3 box blurs. Also
re-enable the imageblur GM test, since the SkPicture path now works.

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



git-svn-id: http://skia.googlecode.com/svn/trunk@2905 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-20 20:02:19 +00:00
reed@google.com
32d25b6f5f initial impl of SkImageFilters : virtual signature will change!
Do not invest too much in other subclasses until this API solidifies.



git-svn-id: http://skia.googlecode.com/svn/trunk@2903 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-20 16:19:00 +00:00
caryclark@google.com
d26147adbb add optional manual global initialization
M    include/effects/SkAvoidXfermode.h
M    include/effects/SkDiscretePathEffect.h
M    include/effects/Sk1DPathEffect.h
M    include/effects/Sk2DPathEffect.h
M    include/effects/SkBlurDrawLooper.h
M    include/effects/SkPixelXorXfermode.h
M    include/effects/SkDashPathEffect.h
M    include/effects/SkColorMatrixFilter.h
M    include/effects/SkEmbossMaskFilter.h
M    include/effects/SkLayerDrawLooper.h
M    include/effects/SkGroupShape.h
M    include/effects/SkBlurImageFilter.h
M    include/effects/SkRectShape.h
A    include/effects/SkEffects.h
M    include/effects/SkCornerPathEffect.h
M    include/effects/SkGradientShader.h
M    include/effects/SkBlurMaskFilter.h
M    include/effects/SkLayerRasterizer.h
M    include/core/SkMallocPixelRef.h
M    include/core/SkFlattenable.h
M    include/core/SkShape.h
M    include/core/SkPixelRef.h
M    include/core/SkGraphics.h
M    include/core/SkPathEffect.h
M    include/core/SkPostConfig.h
M    include/core/SkXfermode.h
M    include/core/SkColorFilter.h
M    include/images/SkFlipPixelRef.h
M    include/images/SkImageRef_GlobalPool.h
M    src/effects/SkDashPathEffect.cpp
M    src/effects/SkColorMatrixFilter.cpp
M    src/effects/SkBlurImageFilter.cpp
M    src/effects/SkGroupShape.cpp
M    src/effects/SkCornerPathEffect.cpp
M    src/effects/SkGradientShader.cpp
M    src/effects/SkBlurMaskFilter.cpp
M    src/effects/SkAvoidXfermode.cpp
M    src/effects/Sk2DPathEffect.cpp
M    src/effects/SkBlurDrawLooper.cpp
M    src/effects/SkPixelXorXfermode.cpp
M    src/effects/SkColorFilters.cpp
M    src/effects/SkLayerDrawLooper.cpp
M    src/effects/SkRectShape.cpp
A    src/effects/SkEffects.cpp
M    src/effects/SkLayerRasterizer.cpp
M    src/effects/SkDiscretePathEffect.cpp
M    src/effects/Sk1DPathEffect.cpp
A    src/effects/SkEffects_none.cpp
M    src/core/SkPixelRef.cpp
M    src/core/SkGraphics.cpp
M    src/core/SkFlattenable.cpp
M    src/core/SkBitmapProcShader.h
M    src/core/SkPathEffect.cpp
M    src/core/SkShape.cpp
M    src/core/SkXfermode.cpp
M    src/core/SkMallocPixelRef.cpp
M    src/core/SkBitmapProcShader.cpp
M    src/images/SkFlipPixelRef.cpp
M    src/images/SkImageRef_GlobalPool.cpp
A    src/ports/SkGlobalInitialization_chromium.cpp
M    src/ports/SkImageRef_ashmem.h
M    src/ports/SkImageRef_ashmem.cpp
A    src/ports/SkGlobalInitialization_default.cpp
M    gyp/effects.gyp
M    gyp/tools.gyp
M    gyp/ports.gyp



git-svn-id: http://skia.googlecode.com/svn/trunk@2876 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-15 14:16:43 +00:00
mike@reedtribe.org
e51755fc64 add first cut at arithmetic mode
git-svn-id: http://skia.googlecode.com/svn/trunk@2849 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-10 19:36:56 +00:00
reed@google.com
7716afbb97 add SK_OVERRIDEs
git-svn-id: http://skia.googlecode.com/svn/trunk@2820 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-07 15:17:50 +00:00
mike@reedtribe.org
259210c376 add SK_OVERRIDE
git-svn-id: http://skia.googlecode.com/svn/trunk@2738 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-11-23 02:08:50 +00:00
reed@google.com
8426058dee ensure we never change the text_encoding of the master paint, since it is used
to interpret the text/length parameters in draw[Pos]Text.



git-svn-id: http://skia.googlecode.com/svn/trunk@2724 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-11-21 16:42:10 +00:00
senorblanco@chromium.org
54e01b2ab9 This change makes SkImageFilter and SkBlurImageFilter flattenable/unflattenable.
The imageblur test also needed to stop calling getDeviceSize(), since it was
 returning 99999x99999 for the  SkPicture case.



git-svn-id: http://skia.googlecode.com/svn/trunk@2699 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-11-16 18:20:47 +00:00
senorblanco@chromium.org
60014ca387 Implement Gaussian blurs for images. The caller creates an an
SkBlurImageFilter, sets it on an SkPaint, passes that paint to saveLayer(),
draws the primitives which are to be blurred, then calls restore(), which
applies the blur.  The blurs have separate sizes in the horizontal and vertical
direction.  This feature is GPU-only for now.

NB:  Due to the clipping change, there are slight pixel differences on the
blurs_gpu and shadows_gpu tests, so those will require rebaselining on all
platforms, as will some of the WebKit layout tests (TBD).


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



git-svn-id: http://skia.googlecode.com/svn/trunk@2643 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-11-09 16:05:58 +00:00
djsollen@google.com
56c69773ae Update files to use SK_BUILD_FOR_ANDROID.
This CL also removes any unecessary references to
the ANDROID definition.
Review URL: http://codereview.appspot.com/5354049

git-svn-id: http://skia.googlecode.com/svn/trunk@2629 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-11-08 19:00:26 +00:00