Commit Graph

2197 Commits

Author SHA1 Message Date
dandov
ecfff21bde SkCanvas interface for drawing a patch.
Added function SkCanvas::drawPatch to the API. This function
receives the patch to draw and the paint.

Added function SkBaseDevice::drawPatch to the API. This function also receives the patch to draw and the paint.

Currently SkGpuDevice and SkBitmapDevice generate the mesh taking into
account the scale factor and call the corresponding device's drawVertices.

BUG=skia:
R=jvanverth@google.com, egdaniel@google.com, bsalomon@google.com

Author: dandov@google.com

Review URL: https://codereview.chromium.org/424663006
2014-08-04 10:02:00 -07:00
george
c4ade57cd4 Ensure that SkDebugf is exported from the library.
This was caused by the change to always call SkDebugf() in SkASSERT(). There are many headers in Skia that call SkASSERT and so we were seeing linking issues in Gecko where we were using Skia across DLL boundaries.

R=reed@google.com, bsalomon@google.com, reed1
BUG=skia:

Author: george@mozilla.com

Review URL: https://codereview.chromium.org/438783002
2014-08-01 12:02:07 -07:00
Derek Sollenberger
3836dc80a6 Remove copile time enabling of SK_ARM_HAS_NEON.
We need to know this in our build system so that we can include
the necessary neon CPP files.

R=mtklein@google.com

Review URL: https://codereview.chromium.org/432453003
2014-08-01 09:21:19 -04:00
djsollen
21769c5249 Update NEON compiler defines to use SK_ prefix
BUG=skia:2785
R=mtklein@google.com

Author: djsollen@google.com

Review URL: https://codereview.chromium.org/433513004
2014-08-01 05:32:32 -07:00
senorblanco
55b6d8be99 Implement a persistent uniqueID-based cache for SkImageFilter.
Add a unique ID to SkImageFilter, and use it as part
of a persistent cache of image-filtered results. This is used for
caching frame-to-frame coherent filters.

We also keep track of which filter subtrees do not reference the
src input, and use a GenID of zero for the src input in that case.
That way, subtrees which are not dependent on the filter input can be
cached independently of it.

This gives approximately a 4X speedup on
letmespellitoutforyou.com/samples/svg/filter_terrain.svg on Z620
and Nexus10. The cache key consists of the uniqueID of the filter, the
clip bounds, the CTM and the genID of the input bitmap.

Since this does not yet handle the case where the input primitives
(and part of the resulting filter tree) are unchanged, we have
to keep around the external cache for that painting case.
When the work to cache unchanging input primitives is done, the
old cache can be removed, and the new UniqueIDCache will be renamed
to Cache.

R=bsalomon@google.com, mtklein@google.com

Author: senorblanco@chromium.org

Review URL: https://codereview.chromium.org/414483003
2014-07-30 11:26:46 -07:00
kkinnunen
4509517e03 Use if instead of ifdef SK_SUPPORT_GPU
The SK_SUPPORT_GPU is always defined.

R=reed@google.com, bsalomon@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/331353003
2014-07-29 06:12:49 -07:00
tfarina
a8e2e1504b Cleanup: Rename SkOSPath functions.
Mostly for brevity and matches better with Python:

Python           | Old C++                 | New C++
os.path.join     | SkOSPath::SkPathJoin    | SkOSPath::Join
os.path.basename | SkOSPath::SkBasename    | SkOSPath::Basename

BUG=None
TEST=make all
R=mtklein@google.com, bsalomon@google.com

Author: tfarina@chromium.org

Review URL: https://codereview.chromium.org/428443002
2014-07-28 19:26:58 -07:00
bsalomon
4beef91ec0 Revert of Remove relative path to GrColor.h in SkShader.h (https://codereview.chromium.org/422023005/)
Reason for revert:
As Ben suspected, this breaks the chrome build.

Original issue's description:
> Remove relative path to GrColor.h in SkShader.h
>
> Committed: https://skia.googlesource.com/skia/+/939f430f660d26e46116a38d2a8436afbd55dfb9

R=bungeman@google.com, george@mozilla.com
TBR=bungeman@google.com, george@mozilla.com
NOTREECHECKS=true
NOTRY=true

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/423943005
2014-07-28 13:43:04 -07:00
bsalomon
939f430f66 Remove relative path to GrColor.h in SkShader.h
R=bungeman@google.com, george@mozilla.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/422023005
2014-07-28 13:27:35 -07:00
bungeman
d6aeb6dc8f Fix thread unsafe mutex initialization.
BUG=skia:2779
R=robertphillips@google.com, mtklein@google.com, reed@android.com, bsalomon@google.com

Author: bungeman@google.com

Review URL: https://codereview.chromium.org/419113002
2014-07-25 11:52:48 -07:00
dandov
50d715476b Added classes SkPatch and SkPatchMesh which help encapsulate and generalize this new primitive. The functionality and responsability of each class is better explained in the comments of the files.
Each patch defines a method genMesh that produces the geometry to draw. To do this they receive a SkPatchMesh object which they need to initialize in order to set up how the data is going to be formatted. Later they call function like setColor or pointAt to set the values at a specific index, the SkMeshPatch object handles the indices based on the format and makes it transparent to the client.

Added a slide to sample app to show how to set up this classes and how they interact.

BUG=skia:
R=jvanverth@google.com, egdaniel@google.com, bsalomon@google.com

Author: dandov@google.com

Review URL: https://codereview.chromium.org/405163003
2014-07-25 10:44:54 -07:00
piotaixr
76d5b477c9 Now able to set the localMatrix when creating a SkShader from a SkImage
BUG=skia:2771
R=junov@chromium.org, reed@chromium.org, bsalomon@chromium.org, bsalomon@google.com

Author: piotaixr@chromium.org

Review URL: https://codereview.chromium.org/409653003
2014-07-22 15:02:05 -07:00
bsalomon
1c63bf6e90 Revert "Revert of Use the GrCacheable ID to eliminate the need for notifications to GrGpuGL when textures and RTs are… (https://codereview.chromium.org/376703009/)"
This reverts commit 249171e7d2.

Uses 32 bit id instead of 64. Renamed instanceID to uniqueID to match existing code.

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/414493002
2014-07-22 13:09:46 -07:00
robertphillips
d771f6bc27 Add auto purging for SkPicture-related Ganesh resources (esp. layers)
This is intended to lower the bookkeeping burden for the Layer Caching feature. Cached layers are now automatically purged when a picture is deleted.

R=bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/408923002
2014-07-22 10:18:06 -07:00
cdalton
b85a0aab69 Add a GrPathRange class
Adds a GrPathRange object that represents a range of paths on the gpu.
Updates GrDrawTarget::drawPaths and supporting code to use GrPathRange
instead of an array of GrPath objects.

Change-Id: I67845f3893cd4d955db947d699aa3733cbb081e0

BUG=skia:
R=bsalomon@google.com, jvanverth@google.com, kkinnunen@nvidia.com

Author: cdalton@nvidia.com

Review URL: https://codereview.chromium.org/400713003
2014-07-21 15:32:44 -07:00
bsalomon
dcabb05113 Make GrCacheable implement its own ref counting.
R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/392333008
2014-07-21 14:24:01 -07:00
sugoi
518d83dbc1 Skia side RGB to YUV gpu conversion
This code is the one that's currently working in my local chromium build. A few things still need to be addressed and I'll highlight these directly in the code.

BUG=skia:
R=reed@google.com, bsalomon@google.com, senorblanco@google.com, senorblanco@chromium.org, robertphillips@google.com, scroggo@google.com, halcanary@google.com

Author: sugoi@chromium.org

Review URL: https://codereview.chromium.org/374743003
2014-07-21 11:37:39 -07:00
bungeman
733418f91e Remove SkRefPtr.
R=mtklein@google.com, reed@google.com, bsalomon@google.com

Author: bungeman@google.com

Review URL: https://codereview.chromium.org/393913002
2014-07-17 12:17:55 -07:00
reed
b959ec7815 factor out flattening/unflattening of common fields from SkImageFilter
This is a precursor to changing SkImageFilters (and all effects) to unflatten via a factory instead of a constructor. In that world, each subclass of ImageFilter will need to control/initiate the unflattening of the common fields, so they can be extract and passed to their Factory.

R=senorblanco@google.com, robertphillips@google.com, mtklein@google.com, senorblanco@chromium.org

Author: reed@google.com

Review URL: https://codereview.chromium.org/395273002
2014-07-17 07:03:09 -07:00
halcanary
805ef159d1 Set maximum output size for scaled-image-cache images
Accessable via:
  SkScaledImageCache::{G,S}etMaximumOutputSizeForHighQualityFilter

Also, a unit test.

BUG=389439
R=humper@google.com, tomhudson@google.com, reveman@chromium.org, vangelis@chromium.org, reed@google.com

Author: halcanary@google.com

Review URL: https://codereview.chromium.org/394003003
2014-07-17 06:58:01 -07:00
Mike Klein
0b4cc892cb Disable assertion of fBoundsIsDirty.
We allow this to be raced on, and it may have already become not-dirty by the
time we get to this function if computed by another thread.

BUG=skia:

Review URL: https://codereview.chromium.org/398913002
2014-07-16 17:18:20 -04:00
Mike Klein
e7fd6db41a Remove yet-unused 64-bit atomic hooks.
For now, I think we'll just be using sk_atomic_inc on 64-bit values, so
let's cut out the dead code for now.

NOTREECHECKS=true

BUG=skia:
R=bsalomon@google.com

Review URL: https://codereview.chromium.org/398003004
2014-07-16 15:20:58 -04:00
scroggo
0847059fcf Remove kImageIsImmutable_Flag.
This flag was only used when setting or checking SkBitmap's
immutability when it did not have an SkPixelRef. Now that an
SkBitmap *must* have one in order to draw (e.g. you can no
longer have an SkBitmap that owns its pixels directly), its
immutabity without an SkPixelRef makes no sense.

Also, now that the flags are not contiguous starting from
0x01, use a more appropriate check to ensure only meaningful
flags are used.

R=reed@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/387083002
2014-07-15 19:56:48 -07:00
mtklein
a179a1ede9 SkAutoRef seems lonely. Might as well delete it.
(On the other hand, SkAutoUnref is well-used.)

NOTREECHECKS=true

BUG=skia:
R=bungeman@google.com, mtklein@google.com, reed@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/393953004
2014-07-15 13:29:34 -07:00
reed
f59eab2693 patch from issue 383923002
TBR=

Author: reed@google.com

Review URL: https://codereview.chromium.org/394603003
2014-07-14 14:39:15 -07:00
reed
3b72f79289 remove unused SkPixelRef constructor
TBR=

Author: reed@google.com

Review URL: https://codereview.chromium.org/390893002
2014-07-14 10:13:57 -07:00
reed
ed458688e2 remove SK_SUPPORT_LEGACY_PIXELREF_UNFLATTENABLE code
TBR=

Author: reed@google.com

Review URL: https://codereview.chromium.org/387313004
2014-07-14 09:21:31 -07:00
scroggo
7e4b2b5027 Remove unused kImageIsOpaque_Flag.
This flag is never set or read. We now look at the alpha type to
determine opacity.

R=reed@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/385943003
2014-07-14 07:53:18 -07:00
piotaixr
cef04f8188 Deleted SkImage::newShaderClamp: not used, not implemented.
Implemented SkImage::newShader.

BUG=skia:2701, 344804
R=junov@chromium.org, reed@chromium.org, bsalomon@chromium.org, reed@google.com

Author: piotaixr@chromium.org

Review URL: https://codereview.chromium.org/345463009
2014-07-14 07:48:04 -07:00
Robert Phillips
cfaeec446d Remove Skia's use of the default SkPicture constructor and multi-clone
This cannot be landed until (Chrome: Switch to one-at-a-time SkPicture::clone interface - https://codereview.chromium.org/380323002/) has landed.

R=mtklein@google.com
TBR=reed@google.com

Review URL: https://codereview.chromium.org/388833003
2014-07-13 12:00:50 -04:00
robertphillips
dd528967fc Remove SkPicture copy constructor
Given where we're heading with SkPicture why would you need to make a copy?

R=reed@google.com, mtklein@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/381133002
2014-07-13 07:55:53 -07:00
reed
b184f7f52b Add SkBitmap::readPixels() and reimplement copyTo and SkCanvas::readPixels
This reverts commit 651eaeadeb.

TBR=

Author: reed@chromium.org

Review URL: https://codereview.chromium.org/390693002
2014-07-13 04:32:32 -07:00
reed
651eaeadeb Revert of Add SkBitmap::readPixels() and reimplement copyTo and SkCanvas::readPixels (https://codereview.chromium.org/388803007/)
Reason for revert:
still failing (randomly?) bench sometimes. need stack dump to diagnose.

Original issue's description:
> Add SkBitmap::readPixels() and reimplement copyTo and SkCanvas::readPixels
> usning it.
>
> Revert "Revert of add readPixels() to SkBitmap (https://codereview.chromium.org/377303002/)"
>
> This reverts commit d08cb905a7.
>
> TBR=scroggo@google.com
>
> Committed: https://skia.googlesource.com/skia/+/debba5c3d091159149f8a88ab5dcd44dd72e0dc7

R=reed@google.com
TBR=reed@google.com
NOTREECHECKS=true
NOTRY=true

Author: reed@chromium.org

Review URL: https://codereview.chromium.org/382543005
2014-07-12 13:16:10 -07:00
reed
debba5c3d0 Add SkBitmap::readPixels() and reimplement copyTo and SkCanvas::readPixels
usning it.

Revert "Revert of add readPixels() to SkBitmap (https://codereview.chromium.org/377303002/)"

This reverts commit d08cb905a7.

R=reed@chromium.org
TBR=scroggo@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/388803007
2014-07-12 12:26:36 -07:00
caryclark
936b73424f ios fixes
skia_ios.mm
Get the app's Documents directory and pass use it to set the resource path.
This is a quick hack which will be replaced by a new application that is
a tiny shim around a command line tool.

SkImageEncoder.h
SkForceLinking.cpp
SkImageDecoder_CG.cpp
Add support for FORCE_LINKING so iOS sees the PNG encoder and others.

SkFloatBits.cpp
SkPoint.cpp
Handle denormalized numbers that are floored by the iOS ARM processor.

SkImageDecoder_iOS.mm
Remove empty encoder factory.

SkTouchGesture.cpp
Return early on empty state on touch rather than aborting (crashing)

JpegTest.cpp
Hal via stackoverflow.com says partial jpegs can be gray as well.

skia_test.cpp
Remove crash handler call for now to avoid link failure.

OverwriteLine.h
Remove fancy line overwrite for iOS.

Resources.cpp
Add interface to set resource directory based on runtime query.

BUG=skia:2736 skia:2737 skia:2738
R=reed@google.com, halcanary@google.com, mtklein@google.com, tfarina@chromium.org

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/373383003
2014-07-11 12:14:51 -07:00
scroggo
ef0fd61dc2 Remove SK_SUPPORT_LEGACY_SHADER_LOCALMATRIX.
This is no longer needed by Android.

BUG=skia:1976
R=reed@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/379323002
2014-07-11 11:33:52 -07:00
scroggo
c870d494dd Use SkShader's localMat for SkLocalMatrixShader.
Instead of setting SkShader::fLocalMatrix to Identity and storing
a separate SkMatrix inside SkLocalMatrixShader, reuse
SkShader::fLocalMatrix.

R=reed@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/386693003
2014-07-11 10:42:12 -07:00
bsalomon
00a8fae0ce Add support for 64bit atomic inc/dec/cas
R=mtklein@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/377073002
2014-07-11 08:42:11 -07:00
jcgregorio
d08cb905a7 Revert of add readPixels() to SkBitmap (https://codereview.chromium.org/377303002/)
Reason for revert:
Maybe causing crashes in bench.

http://108.170.220.120:10117/builders/Test-ChromeOS-Daisy-MaliT604-Arm7-Debug/builds/2608/steps/RunBench/logs/stdio

Original issue's description:
> add readPixels() to SkBitmap
>
> BUG=chromium:390782
>
> Committed: https://skia.googlesource.com/skia/+/c4f216151b6ade70c35fade09a353052f40236b1

R=scroggo@google.com, bsalomon@google.com, reed@google.com
TBR=bsalomon@google.com, reed@google.com, scroggo@google.com
NOTREECHECKS=true
NOTRY=true
BUG=chromium:390782

Author: jcgregorio@google.com

Review URL: https://codereview.chromium.org/382243003
2014-07-11 07:48:20 -07:00
robertphillips
ffc75efc1a Revert of Add alternate SkPicture::clone (https://codereview.chromium.org/381193002/)
Reason for revert:
Going to try to just remove the many-at-once clone interface

Original issue's description:
> Add alternate SkPicture::clone
>
> This adds an alternate version of SkPicture::clone for two reasons:
>
> 1) Chromium uses the SkPicture copy constructor to unpack the pictures from the old-style clone interface (and I would like to remove the copy ctor)
>
> 2) This is part of the long term plan to wean Chrome off of cloning. Once pictures are thread safe we will switch the new SkPicture::clone call to just return 'this'. From there it is a small step to removing clone entirely.
>
> Note that the two versions of clone() is temporary. Once this is landed (and rolled) I will land a Chrome-side patch to remove their use of the old interface (Use new SkPicture::clone interface - https://codereview.chromium.org/380323002/)
>
> Committed: https://skia.googlesource.com/skia/+/e372e78223a8ce916d276d6e0420d552fb0267e9

R=mtklein@google.com, reed@google.com
TBR=mtklein@google.com, reed@google.com
NOTREECHECKS=true
NOTRY=true

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/386933004
2014-07-11 06:45:58 -07:00
bungeman
bf0b9ced0b Add file access modes to sk_exists.
Both Windows and Posix 'access' calls take a mode parameter which,
in addition to checking existence, checks access modes.
This change exposes this functionality.

R=mtklein@google.com, reed@google.com

Author: bungeman@google.com

Review URL: https://codereview.chromium.org/384903002
2014-07-10 15:18:23 -07:00
reed
c4f216151b add readPixels() to SkBitmap
BUG=chromium:390782
R=scroggo@google.com, bsalomon@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/377303002
2014-07-10 14:15:57 -07:00
robertphillips
e372e78223 Add alternate SkPicture::clone
This adds an alternate version of SkPicture::clone for two reasons:

1) Chromium uses the SkPicture copy constructor to unpack the pictures from the old-style clone interface (and I would like to remove the copy ctor)

2) This is part of the long term plan to wean Chrome off of cloning. Once pictures are thread safe we will switch the new SkPicture::clone call to just return 'this'. From there it is a small step to removing clone entirely.

Note that the two versions of clone() is temporary. Once this is landed (and rolled) I will land a Chrome-side patch to remove their use of the old interface (Use new SkPicture::clone interface - https://codereview.chromium.org/380323002/)

R=mtklein@google.com, reed@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/381193002
2014-07-10 14:10:58 -07:00
mtklein
42483d9026 Split SkTRacy into SkTRacy and SkTRacyReffable.
Looks like TSAN can't always suppress our existing implementation of SkTRacy
(what is turning here into SkTRacyReffable).  To minimize flakiness, use
SkTRacy where possible and SkTRacyReffable where necessary.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/497cda3a6b72b9cb390334e8756d38b4ffac044f

NOTRY=true
R=robertphillips@google.com, mtklein@google.com, reed@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/388503002
2014-07-10 11:11:50 -07:00
mtklein
497cda3a6b Split SkTRacy into SkTRacy and SkTRacyReffable.
Looks like TSAN can't always suppress our existing implementation of SkTRacy
(what is turning here into SkTRacyReffable).  To minimize flakiness, use
SkTRacy where possible and SkTRacyReffable where necessary.

BUG=skia:
R=robertphillips@google.com, mtklein@google.com, reed@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/388503002
2014-07-10 10:38:22 -07:00
robertphillips
6142609b22 Cleanup SkPicture* classes a bit
This is an attempt to reduce the number of friends the various SkPicture* classes have.
Probably the only controversial part is making getBitmap, getPath, getPicture and getPaint
public on SkPictureData (and adding a new initIterator entry point).

R=mtklein@google.com, reed@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/384753004
2014-07-10 09:35:12 -07:00
robertphillips
c26d991bf2 Split SkPictureReplacementPlayback out of SkPicturePlayback
R=mtklein@google.com, reed@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/383733002
2014-07-10 07:21:27 -07:00
reed
da03653f34 fix typo, had two RGBA instead of RGBA and BGRA
TBR=caryclark@google.com
BUG=skia:

Author: reed@chromium.org

Review URL: https://codereview.chromium.org/382633004
2014-07-09 17:28:19 -07:00
ehsan.akhgari
db5f7bf0a4 Do not export SkTDArray when building Skia as a DLL
This class has four members (deleteAll, freeAll, unrefAll and
safeUnrefAll) which will only compile for certain instantiations of
SkTDArray depending on the template argument type.  Marking this class
as dllexport breaks the build with clang-cl because of
http://llvm.org/PR20163.  Since this class is header-only, we can just
make it non-exported to enable building Skia as a DLL with clang-cl.

BUG=skia:
R=ctguil@chromium.org, mtklein@google.com, reed@google.com

Author: ehsan.akhgari@gmail.com

Review URL: https://codereview.chromium.org/368253002
2014-07-09 11:13:55 -07:00
tfarina
e53363fa7c Cleanup: Remove SkUTF16_Str API.
It does not have any users in Skia, Blink and Chromium.

BUG=None
TEST=make all
R=mtklein@google.com, reed@google.com

Author: tfarina@chromium.org

Review URL: https://codereview.chromium.org/366243004
2014-07-09 09:18:05 -07:00