Commit Graph

2783 Commits

Author SHA1 Message Date
reed
3ef71e343b guarded change to SkImageGenerator to make getInfo() const
BUG=skia:

Review URL: https://codereview.chromium.org/1017293002
2015-03-19 08:31:14 -07:00
reed
effcba4a4d Revert of replace SkFixedDiv impl with native 64bit math (patchset #2 id:20001 of https://codereview.chromium.org/1022543003/)
Reason for revert:
http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/53096

layouttests failures

Original issue's description:
> replace SkFixedDiv impl with native 64bit math
>
> BUG=skia:
> TBR=
>
> Committed: https://skia.googlesource.com/skia/+/7c44ca926bf42b3b2e56131f250c0fd58f87ac71

TBR=
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1018523008
2015-03-19 04:10:42 -07:00
reed
7c44ca926b replace SkFixedDiv impl with native 64bit math
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1022543003
2015-03-18 19:04:43 -07:00
senorblanco
4a22a433bf Bump picture version for uniqueID-less SkImageFilter.
Remove writing of the uniqueID, and put reading behind a version check.

BUG=skia:3559

Review URL: https://codereview.chromium.org/1010433003
2015-03-18 13:14:54 -07:00
senorblanco
24e06d5244 Remove uniqueID from all filter serialization.
(This is essentially a revert of https://codereview.chromium.org/503833002/.)

This was necessary back when SkPaint was flattened even for in-process use. Now that we only flatten SkPaint for cross-process use, there's no need to serialize UniqueIDs.

Note: SkDropShadowImageFilter is being constructed with a croprect and UniqueID (of 0) in Blink. I've made the uniqueID param default to 0 temporarily, until this rolls in and Blink can be changed. (Blink can't be changed first, since unlike the other filters, there's no constructor that takes a cropRect but not a uniqueID.)

BUG=skia:

Review URL: https://codereview.chromium.org/1019493002
2015-03-18 12:11:33 -07:00
scroggo
b267fd629b Add comment describing SkColorTable constructor.
Review URL: https://codereview.chromium.org/1011263002
2015-03-18 08:00:27 -07:00
reed
0c9b1a8d05 add kGray_8_SkColorType
patch from issue 1014783003 at patchset 60001 (http://crrev.com/1014783003#ps60001)

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1010343002
2015-03-17 17:44:07 -07:00
bungeman
d709ea8d14 Remove SkLONGLONG.
All users now define SkLONGLONG.
This fixes a long outstanding TODO now that int64_t is required.

BUG=skia:179

Review URL: https://codereview.chromium.org/1000933003
2015-03-17 07:23:39 -07:00
scroggo
9552662e9f Option for SkCodec to treat dst as all zeroes.
This recreates SkImageDecoder's feature to skip writing zeroes for
SkCodec.

Review URL: https://codereview.chromium.org/980903002
2015-03-17 05:02:17 -07:00
reed
e7903c7397 FilterLevel -> SkFilterQuality
BUG=skia:
TBR=
NOTREECHECKS=True
NOTRY=True

Review URL: https://codereview.chromium.org/1010023002
2015-03-16 10:26:13 -07:00
reed
93a1215fe0 SkPaint::FilterLevel -> SkFilterQuality
clone (+rebase) of https://codereview.chromium.org/1009183002/

BUG=skia:
TBR=scroggo@google.com

Review URL: https://codereview.chromium.org/1014533004
2015-03-16 10:08:34 -07:00
reed
3a224666df remove deprecated setFilterBitmap/isFilterBitmap
BUG=skia:

Review URL: https://codereview.chromium.org/1006213002
2015-03-16 07:24:05 -07:00
reed
19c25f18a3 move kTileModeCount out of TileMode enum
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1009193002
2015-03-15 14:01:21 -07:00
reed
6af1b05b24 remove legacy onCreateCompatibleDevice
needs this to land in chrome first : https://codereview.chromium.org/1013453002/

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1006183002
2015-03-14 17:51:34 -07:00
reed
76033be81b Revert[6] of Change device creation to see the (optional) layer-paint
This reverts commit 173e5fe5f4.

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1010503002
2015-03-14 10:54:31 -07:00
reed
57a48a73a4 add onCreateDevice to eventually replace onCreateCompatibleDevice
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/1006923004
2015-03-14 04:30:21 -07:00
reed
173e5fe5f4 Revert of Revert of Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1005173004/)
Reason for revert:
arrrg. this is a staging nightmare. override required on the chrome side. must revert (again)

Original issue's description:
> Revert of Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1001423002/)
>
> Reason for revert:
> chrome now has the new virtual, so trying again
>
> Original issue's description:
> > Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1006923002/)
> >
> > Reason for revert:
> > platform_canvas tests failures
> >
> > skia_unittests (with patch) skia_unittests (with patch) PlatformCanvas.TranslateLayer failed 2
> > Flakiness dashboard
> >
> > failures:
> > PlatformCanvas.TranslateLayer
> > PlatformCanvas.FillLayer
> >
> > Original issue's description:
> > > Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1008863002/)
> > >
> > > Reason for revert:
> > > guard in chrome has landed
> > >
> > > Original issue's description:
> > > > Revert of Change device creation to see the (optional) layer-paint (patchset #9 id:160001 of https://codereview.chromium.org/988413003/)
> > > >
> > > > Reason for revert:
> > > > need to have chrome opt-in for the older API before this can land (in chrome)
> > > >
> > > > Original issue's description:
> > > > > Change device creation to see the (optional) layer-paint
> > > > >
> > > > > Motivation:
> > > > >
> > > > > PDFDevice currently relies on 1) being told that the layer's paint has an imagefilter, and in the case, it creates a rasterdevice. It then relies on (2) canvas itself sniffing the layer's paint and offering to apply-the-imagefilter to call drawSprite instead of drawDevice.
> > > > >
> > > > > This subtle interchange is fragile, and also does not support other unsupported PDF features like colorfilters. This CL is a step toward making this use-raster-instead-of-native approach to layers more completely in the subclass' hands.
> > > > >
> > > > > Committed: https://skia.googlesource.com/skia/+/1182d9a96b80bd12183ee7c81325a979a51ee0c0
> > > >
> > > > TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> > > > NOPRESUBMIT=true
> > > > NOTREECHECKS=true
> > > > NOTRY=true
> > > >
> > > > Committed: https://skia.googlesource.com/skia/+/0e040f7da2fdfeb49aa60d24117306e3b1e6ea90
> > >
> > > TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > >
> > > Committed: https://skia.googlesource.com/skia/+/f7076a13e2d4269903b34ef2780e1c84723e4477
> >
> > TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> >
> > Committed: https://skia.googlesource.com/skia/+/8e14d660b2a434bc708a70180c84210883611683
>
> TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com,reed@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://skia.googlesource.com/skia/+/307d1ed129ff75eb64137dea75df858f9e250b69

TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1005183003
2015-03-13 20:05:18 -07:00
reed
307d1ed129 Revert of Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1001423002/)
Reason for revert:
chrome now has the new virtual, so trying again

Original issue's description:
> Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1006923002/)
>
> Reason for revert:
> platform_canvas tests failures
>
> skia_unittests (with patch) skia_unittests (with patch) PlatformCanvas.TranslateLayer failed 2
> Flakiness dashboard
>
> failures:
> PlatformCanvas.TranslateLayer
> PlatformCanvas.FillLayer
>
> Original issue's description:
> > Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1008863002/)
> >
> > Reason for revert:
> > guard in chrome has landed
> >
> > Original issue's description:
> > > Revert of Change device creation to see the (optional) layer-paint (patchset #9 id:160001 of https://codereview.chromium.org/988413003/)
> > >
> > > Reason for revert:
> > > need to have chrome opt-in for the older API before this can land (in chrome)
> > >
> > > Original issue's description:
> > > > Change device creation to see the (optional) layer-paint
> > > >
> > > > Motivation:
> > > >
> > > > PDFDevice currently relies on 1) being told that the layer's paint has an imagefilter, and in the case, it creates a rasterdevice. It then relies on (2) canvas itself sniffing the layer's paint and offering to apply-the-imagefilter to call drawSprite instead of drawDevice.
> > > >
> > > > This subtle interchange is fragile, and also does not support other unsupported PDF features like colorfilters. This CL is a step toward making this use-raster-instead-of-native approach to layers more completely in the subclass' hands.
> > > >
> > > > Committed: https://skia.googlesource.com/skia/+/1182d9a96b80bd12183ee7c81325a979a51ee0c0
> > >
> > > TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > >
> > > Committed: https://skia.googlesource.com/skia/+/0e040f7da2fdfeb49aa60d24117306e3b1e6ea90
> >
> > TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> >
> > Committed: https://skia.googlesource.com/skia/+/f7076a13e2d4269903b34ef2780e1c84723e4477
>
> TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://skia.googlesource.com/skia/+/8e14d660b2a434bc708a70180c84210883611683

TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1005173004
2015-03-13 19:52:59 -07:00
reed
8e14d660b2 Revert of Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1006923002/)
Reason for revert:
platform_canvas tests failures

skia_unittests (with patch) skia_unittests (with patch) PlatformCanvas.TranslateLayer failed 2
Flakiness dashboard

failures:
PlatformCanvas.TranslateLayer
PlatformCanvas.FillLayer

Original issue's description:
> Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1008863002/)
>
> Reason for revert:
> guard in chrome has landed
>
> Original issue's description:
> > Revert of Change device creation to see the (optional) layer-paint (patchset #9 id:160001 of https://codereview.chromium.org/988413003/)
> >
> > Reason for revert:
> > need to have chrome opt-in for the older API before this can land (in chrome)
> >
> > Original issue's description:
> > > Change device creation to see the (optional) layer-paint
> > >
> > > Motivation:
> > >
> > > PDFDevice currently relies on 1) being told that the layer's paint has an imagefilter, and in the case, it creates a rasterdevice. It then relies on (2) canvas itself sniffing the layer's paint and offering to apply-the-imagefilter to call drawSprite instead of drawDevice.
> > >
> > > This subtle interchange is fragile, and also does not support other unsupported PDF features like colorfilters. This CL is a step toward making this use-raster-instead-of-native approach to layers more completely in the subclass' hands.
> > >
> > > Committed: https://skia.googlesource.com/skia/+/1182d9a96b80bd12183ee7c81325a979a51ee0c0
> >
> > TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> >
> > Committed: https://skia.googlesource.com/skia/+/0e040f7da2fdfeb49aa60d24117306e3b1e6ea90
>
> TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://skia.googlesource.com/skia/+/f7076a13e2d4269903b34ef2780e1c84723e4477

TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1001423002
2015-03-13 12:34:32 -07:00
reed
f7076a13e2 Revert of Revert of Change device creation to see the (optional) layer-paint (patchset #1 id:1 of https://codereview.chromium.org/1008863002/)
Reason for revert:
guard in chrome has landed

Original issue's description:
> Revert of Change device creation to see the (optional) layer-paint (patchset #9 id:160001 of https://codereview.chromium.org/988413003/)
>
> Reason for revert:
> need to have chrome opt-in for the older API before this can land (in chrome)
>
> Original issue's description:
> > Change device creation to see the (optional) layer-paint
> >
> > Motivation:
> >
> > PDFDevice currently relies on 1) being told that the layer's paint has an imagefilter, and in the case, it creates a rasterdevice. It then relies on (2) canvas itself sniffing the layer's paint and offering to apply-the-imagefilter to call drawSprite instead of drawDevice.
> >
> > This subtle interchange is fragile, and also does not support other unsupported PDF features like colorfilters. This CL is a step toward making this use-raster-instead-of-native approach to layers more completely in the subclass' hands.
> >
> > Committed: https://skia.googlesource.com/skia/+/1182d9a96b80bd12183ee7c81325a979a51ee0c0
>
> TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://skia.googlesource.com/skia/+/0e040f7da2fdfeb49aa60d24117306e3b1e6ea90

TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1006923002
2015-03-13 08:46:12 -07:00
joshualitt
fd45079314 Call to retrieve SkDescriptor for SkScalarContext from SkPaint.
Review URL: https://codereview.chromium.org/1005103003
2015-03-13 08:38:43 -07:00
reed
0e040f7da2 Revert of Change device creation to see the (optional) layer-paint (patchset #9 id:160001 of https://codereview.chromium.org/988413003/)
Reason for revert:
need to have chrome opt-in for the older API before this can land (in chrome)

Original issue's description:
> Change device creation to see the (optional) layer-paint
>
> Motivation:
>
> PDFDevice currently relies on 1) being told that the layer's paint has an imagefilter, and in the case, it creates a rasterdevice. It then relies on (2) canvas itself sniffing the layer's paint and offering to apply-the-imagefilter to call drawSprite instead of drawDevice.
>
> This subtle interchange is fragile, and also does not support other unsupported PDF features like colorfilters. This CL is a step toward making this use-raster-instead-of-native approach to layers more completely in the subclass' hands.
>
> Committed: https://skia.googlesource.com/skia/+/1182d9a96b80bd12183ee7c81325a979a51ee0c0

TBR=halcanary@google.com,senorblanco@google.com,robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1008863002
2015-03-13 07:28:29 -07:00
reed
1182d9a96b Change device creation to see the (optional) layer-paint
Motivation:

PDFDevice currently relies on 1) being told that the layer's paint has an imagefilter, and in the case, it creates a rasterdevice. It then relies on (2) canvas itself sniffing the layer's paint and offering to apply-the-imagefilter to call drawSprite instead of drawDevice.

This subtle interchange is fragile, and also does not support other unsupported PDF features like colorfilters. This CL is a step toward making this use-raster-instead-of-native approach to layers more completely in the subclass' hands.

Review URL: https://codereview.chromium.org/988413003
2015-03-13 07:16:09 -07:00
reed
11fa2247b7 some utils for rect and matrix
BUG=skia:

Review URL: https://codereview.chromium.org/1003813003
2015-03-13 06:08:28 -07:00
mtklein
172b45518a Clean up SkDynamicAnnotations.
Unprotected reads -> relaxed reads.
    Unprotected write -> relaxed write.

The only unprotected write we had was in SkTraceEvent, which it looks like we nabbed from Chrome at some point and changed only to silence TSAN.  Chrome's version uses AtomicWord / NoBarrier_Load / NoBarrier_Store, which boils down to the same as here, intptr_t / relaxed load / relaxed store.

This leaves one place where we're lying a bit to TSAN, in include/core/SkLazyPtr.h where we're doing a data-dependent consume load.  We're telling TSAN it's consume, but telling any other compiler to compile it as relaxed, given how they all upgrade consume to acquire.  This eliminates a barrier for us on ARM.  How do you guys deal with this?  Just use a consume memory order, take the hit, and hope compilers get smarter one day?

BUG=chromium:465721

No public API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/996763002
2015-03-12 05:27:46 -07:00
bungeman
79738cc7bf Glyph positions maintain 32 bit integer part.
A glyph position when mapped from canvas space to device space may land
outside the bounds of the current 16 bit integer part of device space.
Device space is already limited to 32 bits for the integer part,
but for a short space in drawText and drawPosText it is currently
limited to 16 bits (SkFixed). Raise this limit by moving to 48.16.
This matches the current similar fix for measureText.

BUG=chromium:375322

Review URL: https://codereview.chromium.org/977623002
2015-03-11 14:05:29 -07:00
bungeman
167eb17cd6 Use SkTMin and SkTMax for clamp/pin.
This changes SkScalarClampMax and SkScalarPin to use SkTMin and SkTMax.
This change allows compilers to more easily transform these operations
into fast max/min operarations as opposed to conditional branches.

Review URL: https://codereview.chromium.org/993593002
2015-03-09 13:40:15 -07:00
reed
cedc36f18b Use ComposColorFilter to collaps hierarchy (when possible).
Clarify asColorFilter ...
1. Rename to isColorFilterNode for DAG reduction
2. Add asAColorFilter for removing the imagefilter entirely (future use-case)

Need layouttest rebaseline suppression before this can land in chrome...
https://codereview.chromium.org/984023004/

BUG=skia:

Review URL: https://codereview.chromium.org/982933002
2015-03-08 04:42:52 -07:00
tomhudson
64de1e1790 ViaAndroidSDK for DM
Make a Via for DM which transforms a set of draws to be more like what
we'd see through the Android Framework's HWUI API. Only built inside
Android's framework because we depend on HWUI classes for half of
those transformations.

Tested with --config androidsdk-8888 and --config androidsdk-hwui.

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

Review URL: https://codereview.chromium.org/974913002
2015-03-05 08:01:07 -08:00
reed
dc812222a7 add impl limit for number of leaf-nodes in composecolorfilter
BUG=skia:

Review URL: https://codereview.chromium.org/972153010
2015-03-05 07:21:02 -08:00
kkinnunen
a9baa652bb Revert of Add image as a draw type that can be filtered (patchset #4 id:60001 of https://codereview.chromium.org/960783003/)
Reason for revert:
Fails on mac for some reason.
Also is a bit wrong, but this should not be reason for the failure..

Original issue's description:
> Add image as a draw type that can be filtered
>
> Add image as a draw type that can be filtered.
>
> This is needed when SkImage is added as an object to be drawn so that
> the draw is forwarded to SkBaseDevice. This would be used in making
> filters use SkImages.
>
> BUG=skia:3388
>
> Committed: https://skia.googlesource.com/skia/+/fa77eb1e51b9317ff993d1be504ada173b561e5f

TBR=reed@google.com,bsalomon@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:3388

Review URL: https://codereview.chromium.org/980273002
2015-03-05 06:33:54 -08:00
kkinnunen
fa77eb1e51 Add image as a draw type that can be filtered
Add image as a draw type that can be filtered.

This is needed when SkImage is added as an object to be drawn so that
the draw is forwarded to SkBaseDevice. This would be used in making
filters use SkImages.

BUG=skia:3388

Review URL: https://codereview.chromium.org/960783003
2015-03-05 00:39:45 -08:00
reed
b7affb56bb udpate dox for colorfilter fragment processor requirements
BUG=skia:
NOTRY=True

Review URL: https://codereview.chromium.org/961933003
2015-03-04 13:30:50 -08:00
fmalita
024f996c1d Text blob run paints should be filtered.
We're constructing blob run paints after the canvas draw filter has been
applied.

Instead, we need do defer text blob draw filters until we have access
to the full run paints.

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

Review URL: https://codereview.chromium.org/973973003
2015-03-03 19:08:17 -08:00
halcanary
47ef4d5d93 XPS, DM: add SkDocument::CreateXPS
-   SkDocument::CreateXPS() function added, returns NULL on non-Windows OS.

-   DM: (Windows only) an XPSSink is added, fails on non-Windows OS

-   DM: Common code for PDFSink::draw and XPSSink::draw are factored into
    draw_skdocument static function.

-   SkDocument_XPS (Windows only) implementation of SkDocument via
    SkXPSDevice.

-   SkDocument_XPS_None (non-Windows) returns NULL for
    SkDocument::CreateXPS().

-   gyp/xps.gyp refactored.

-   SkXPSDevice::drawTextOnPath removed (see http://crrev.com/925343003 )

-   SkXPSDevice::drawPath supports conics via SkAutoConicToQuads.

Review URL: https://codereview.chromium.org/963953002
2015-03-03 09:13:09 -08:00
halcanary
c2574f3657 Revert of XPS, DM: add SkDocument::CreateXPS (patchset #8 id:310001 of https://codereview.chromium.org/963953002/)
Reason for revert:
breaking iOS build.

Original issue's description:
> XPS, DM: add SkDocument::CreateXPS
>
> -   SkDocument::CreateXPS() function added, returns NULL on non-Windows OS.
>
> -   DM: (Windows only) an XPSSink is added, fails on non-Windows OS
>
> -   DM: Common code for PDFSink::draw and XPSSink::draw are factored into
>     draw_skdocument static function.
>
> -   SkDocument_XPS (Windows only) implementation of SkDocument via
>     SkXPSDevice.
>
> -   SkDocument_XPS_None (non-Windows) returns NULL for
>     SkDocument::CreateXPS().
>
> -   gyp/xps.gyp refactored.
>
> -   SkXPSDevice::drawTextOnPath removed (see http://crrev.com/925343003 )
>
> -   SkXPSDevice::drawPath supports conics via SkAutoConicToQuads.
>
> NOPRESUBMIT=true
>
> Committed: https://skia.googlesource.com/skia/+/00d39bcbfc8394a9b48b86b04ab06ec19091fa43

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

Review URL: https://codereview.chromium.org/978443002
2015-03-03 08:34:14 -08:00
halcanary
00d39bcbfc XPS, DM: add SkDocument::CreateXPS
-   SkDocument::CreateXPS() function added, returns NULL on non-Windows OS.

-   DM: (Windows only) an XPSSink is added, fails on non-Windows OS

-   DM: Common code for PDFSink::draw and XPSSink::draw are factored into
    draw_skdocument static function.

-   SkDocument_XPS (Windows only) implementation of SkDocument via
    SkXPSDevice.

-   SkDocument_XPS_None (non-Windows) returns NULL for
    SkDocument::CreateXPS().

-   gyp/xps.gyp refactored.

-   SkXPSDevice::drawTextOnPath removed (see http://crrev.com/925343003 )

-   SkXPSDevice::drawPath supports conics via SkAutoConicToQuads.

NOPRESUBMIT=true

Review URL: https://codereview.chromium.org/963953002
2015-03-03 08:26:00 -08:00
reed
cff10b21a9 change colorfilter to return an array of frag processors
BUG=skia:

Review URL: https://codereview.chromium.org/973593002
2015-03-03 06:41:45 -08:00
reed
8a8d841d48 add virtuals to optimize composing colorfilters
BUG=skia:

Review URL: https://codereview.chromium.org/968993004
2015-03-02 13:46:03 -08:00
reed
db873d8677 add compose-colorfilter
now with serialization registration

This reverts commit 5bd055c038.

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/970753002
2015-03-01 19:53:47 -08:00
reed
5bd055c038 Revert of add compose-colorfilter (patchset #2 id:20001 of https://codereview.chromium.org/969673002/)
Reason for revert:
need to register subclass for serialization

Original issue's description:
> add compose-colorfilter
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/b675a73c1f3f4a433c4893199a0bd11126dfe130

TBR=fmalita@chromium.org,bsalomon@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/971653002
2015-03-01 19:16:38 -08:00
reed
b675a73c1f add compose-colorfilter
BUG=skia:

Review URL: https://codereview.chromium.org/969673002
2015-03-01 18:00:47 -08:00
reed
44977485bd Revert of Revert of replace kIgnore_SkAlphaType with kUnknown_SkAlphaType (patchset #1 id:1 of https://codereview.chromium.org/966753002/)
Reason for revert:
Android has been updated, so we can re-land this.

Original issue's description:
> Revert of replace kIgnore_SkAlphaType with kUnknown_SkAlphaType (patchset #3 id:40001 of https://codereview.chromium.org/964613002/)
>
> Reason for revert:
> This breaks Android framework build. See
>
> 7f0fcdbf3c/logs/build_error.log
>
> We need to stop them from using kIgnore before we can reland this.
>
> Original issue's description:
> > replace kIgnore_SkAlphaType with kUnknown_SkAlphaType
> >
> > BUG=skia:
> > TBR=
> >
> > Committed: https://skia.googlesource.com/skia/+/1c8aeeaebce9675197be31bd769e8ffa2531bf86
>
> TBR=reed@google.com,reed@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/574290f61a47bd1ce1f9e2d941533bda9c8f03fe

TBR=reed@chromium.org,scroggo@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/966853002
2015-02-27 10:23:00 -08:00
robertphillips
a9061de9ff Add rewind capability to SkChunkAlloc
Split off from https://codereview.chromium.org/940533003/ (Decrease GrInOrderDrawBuffer::Cmd's reliance on GrInOrderDrawBuffer)

Review URL: https://codereview.chromium.org/967553003
2015-02-27 08:31:57 -08:00
scroggo
574290f61a Revert of replace kIgnore_SkAlphaType with kUnknown_SkAlphaType (patchset #3 id:40001 of https://codereview.chromium.org/964613002/)
Reason for revert:
This breaks Android framework build. See

7f0fcdbf3c/logs/build_error.log

We need to stop them from using kIgnore before we can reland this.

Original issue's description:
> replace kIgnore_SkAlphaType with kUnknown_SkAlphaType
>
> BUG=skia:
> TBR=
>
> Committed: https://skia.googlesource.com/skia/+/1c8aeeaebce9675197be31bd769e8ffa2531bf86

TBR=reed@google.com,reed@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/966753002
2015-02-27 06:21:58 -08:00
reed
1c8aeeaebc replace kIgnore_SkAlphaType with kUnknown_SkAlphaType
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/964613002
2015-02-27 06:00:33 -08:00
mtklein
e76161458a Spin off some fixes to land right away.
BUG=skia:

Review URL: https://codereview.chromium.org/960023002
2015-02-26 10:14:15 -08:00
joshualitt
570d2f81a6 I'd really like to land this before the branch so speedy reviews are appreciated.
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/586d5d640b19860dfbbd903a5188da1bbbe87336

Review URL: https://codereview.chromium.org/936943002
2015-02-25 13:19:48 -08:00
joshualitt
2907059d0e Revert of Pass clip to context (patchset #8 id:180001 of https://codereview.chromium.org/936943002/)
Reason for revert:
Strange blur problems on nexus 5

Original issue's description:
> I'd really like to land this before the branch so speedy reviews are appreciated.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/586d5d640b19860dfbbd903a5188da1bbbe87336

TBR=jvanverth@google.com,senorblanco@google.com,bsalomon@google.com,senorblanco@chromium.org,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/956083002
2015-02-25 13:04:44 -08:00
mtklein
edeccc5860 Clean up ColorRectProc plumbing.
We've always been using the portable ColorRect32, so we don't need the
ColorRectProc plumbing.

Furthermore, ColorRect32 doesn't seem to be very important (we're only using
it in the opaque case, which our row-by-row procs already specialize for).
Remove that too.

If we find we want specialization for really narrow rects again, let's put it in
blitRect() directly.  It's pretty unlikely we're going to get platform-specific
speedup for blits to non-contiguous memory.

My local SKP comparison is +- 3%... most neutral I've ever seen.

BUG=skia:

Review URL: https://codereview.chromium.org/959873002
2015-02-25 12:52:57 -08:00
mtklein
59c9203321 Fix the race to set the new gen ID.
There's a small window where two threads can both see the gen ID is zero,
both go get new distinct genIDs, but race to write them.

This now uses compare_exchange to read and leave the winner's ID in place
when there's a race.

SkAtomics isn't public.
TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/956013002
2015-02-25 12:51:55 -08:00
joshualitt
586d5d640b I'd really like to land this before the branch so speedy reviews are appreciated.
BUG=skia:

Review URL: https://codereview.chromium.org/936943002
2015-02-25 11:21:21 -08:00
mtklein
63d0024cde Steal a bit from the gen ID instead of managing two atomic values.
This extra atomic bool is hard to think about, and I'm worried about how
updates to fGenerationID and fUniqueGenerationID interlace.  By storing
them in the same int, they can't ever race.

CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu13.10-GCE-NoGPU-x86_64-Release-TSAN-Trybot

BUG=skia:

Review URL: https://codereview.chromium.org/955043002
2015-02-25 09:10:57 -08:00
caryclark
63c684a8a6 fuzzer fixes
Fix path bugs exposed by the path fuzzer.

Changes to existing gm and samplecode files defer their calls to construct
SkPath objects until the first draw instead of at test initialization.

Add an experimental call to SkPath to validate the internal SkPathRef.

Fix SkPath::addPoly to set the last moveto after adding a close verb.

Fix stroke to handle failures when computing the unit normal.

Add a unit test for the unit normal failure.

R=reed@google.com

Review URL: https://codereview.chromium.org/953383002
2015-02-25 09:04:04 -08:00
mtklein
61010772e5 Revert of fAddedToCache doesn't need to be atomic. (patchset #1 id:1 of https://codereview.chromium.org/960573002/)
Reason for revert:
Yes it does.  notifyAddedToCache() must be thread-safe.

Original issue's description:
> fAddedToCache doesn't need to be atomic.
>
> It's only ever read or set from non-threadsafe methods.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/fbe0edfec4fed2a09e12b049d527d280f16e75b3

TBR=reed@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/959763002
2015-02-25 08:27:41 -08:00
mtklein
fbe0edfec4 fAddedToCache doesn't need to be atomic.
It's only ever read or set from non-threadsafe methods.

BUG=skia:

Review URL: https://codereview.chromium.org/960573002
2015-02-25 08:11:18 -08:00
reed
83787d0ff0 only notify bitmaps that have been added to the cache
old code:
- calls=2677 hit-rate=3.51139%

new code:
- calls=94 hit-rate=97.8723%

BUG=skia:

Review URL: https://codereview.chromium.org/960563002
2015-02-25 07:17:11 -08:00
herb
b69d0e0ac4 BUG=skia:
(mtklein from here on)
No public API changes.
TBR=reed@google.com

Committed: https://skia.googlesource.com/skia/+/f8d24e2c0c7b44b7ccf20e40890514db4cde7b15

Review URL: https://codereview.chromium.org/939123002
2015-02-25 06:47:06 -08:00
mtklein
86821b5670 SkTRacy<T> -> SkAtomic<T>
Like SkTRacy<T>, TSAN will not complain about these.  Unlike SkTRacy<T>, TSAN
should not complain about these: SkAtomic<T> are threadsafe.

This should fix the races now suppressed in TSAN.  As written, the memory
barriers we're using in SkPixelRef will be dumb but safe (really, dumbest
possible but safest possible).  If we see a perf hit, we can follow up by
putting Ben and I in a room for a while, thinking about it really hard, and
using the minimum-strength safe memory barriers.

A refactor that steals a bit from the genID would also still be possible with
this approach.

BUG=chromium:437511

CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu13.10-GCE-NoGPU-x86_64-Release-TSAN-Trybot

Review URL: https://codereview.chromium.org/955803002
2015-02-24 14:38:12 -08:00
scroggo
e59bbf1cd5 Revert of Make fID and MixedID calculations private (patchset #5 id:80001 of https://codereview.chromium.org/939123002/)
Reason for revert:
This actually *does* change the public API - fID is now private, and it was being used on Android. See 5242b865d3/logs/build.log :

In file included from frameworks/base/libs/hwui/tests/../font/Font.cpp:26:0:
external/skia/src/core/SkGlyph.h: In member function 'android::uirenderer::CachedGlyphInfo* android::uirenderer::Font::cacheGlyph(const SkPaint*, glyph_t, bool)':
external/skia/src/core/SkGlyph.h:157:17: error: 'uint32_t SkGlyph::fID' is private
     uint32_t    fID;
                 ^
frameworks/base/libs/hwui/tests/../font/Font.cpp:482:39: error: within this context
     newGlyph->mGlyphIndex = skiaGlyph.fID;

We need to update Android in order to hide fID.

Original issue's description:
> BUG=skia:
>
> (mtklein from here on)
> No public API changes.
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/f8d24e2c0c7b44b7ccf20e40890514db4cde7b15

TBR=mtklein@google.com,herb@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/951353002
2015-02-24 06:09:41 -08:00
herb
f8d24e2c0c BUG=skia:
(mtklein from here on)
No public API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/939123002
2015-02-24 05:12:05 -08:00
joshualitt
44701df5ce Move clip off of draw target
BUG=skia:

Review URL: https://codereview.chromium.org/947443003
2015-02-23 14:44:58 -08:00
halcanary
7af21501a6 SkStream: Add SkDynamicMemoryWStream::writeToStream(SkWStream*)
Review URL: https://codereview.chromium.org/943423002
2015-02-23 12:18:00 -08:00
bungeman
7be2eb89cc Remove SkFontHost includes and friends.
SkFontHost no longer exists as a class, so remove the includes and stop
making it a friend.

Review URL: https://codereview.chromium.org/943333004
2015-02-23 08:25:00 -08:00
scroggo
953df445ab Remove SK_SUPPORT_LEGACY_GET_PIXELS_ENUM.
SK_SUPPORT_LEGACY_GET_PIXELS_ENUM just set a \#define to convert
onGetPixelsEnum
to
onGetPixels

Now that Chrome has been updated to override onGetPixels, there is no
need for the define.

BUG=skia:3257

Review URL: https://codereview.chromium.org/933853004
2015-02-23 07:07:25 -08:00
kkinnunen
abcfab4d68 Swap render target instead of creating a new gpu device for surface copy-on-write
Swap render target of the gpu device instead of creating a new gpu
device when making a copy-on-write upon surface modification.

This removes the SkCanvas::setRootDevice which contains problematic code
when trying to increase the use of SkImages internally in Skia.

BUG=skia:3388

Review URL: https://codereview.chromium.org/925343002
2015-02-22 22:53:44 -08:00
mtklein
96d68b7046 Make SkPixelRef::isLocked() debug-only, remove related dead code.
DM's okay locally with no diffs, no failures.

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/8e65712486c66108677a9b0a55ad3e7ca94db555

Review URL: https://codereview.chromium.org/940083002
2015-02-20 12:40:40 -08:00
djsollen
7ff705023d Enable override keyword for GCC versions >= 4.7
Review URL: https://codereview.chromium.org/945803005
2015-02-20 12:35:37 -08:00
reed
b92b706dfd Revert of Make SkPixelRef::isLocked() debug-only, remove related dead code. (patchset #1 id:1 of https://codereview.chromium.org/940083002/)
Reason for revert:
Broke callers in chrome

../../skia/ext/platform_canvas_unittest.cc:421:56: error: no member named 'isLocked' in 'SkPixelRef'
  EXPECT_TRUE(platform_bitmap->GetBitmap().pixelRef()->isLocked());

Original issue's description:
> Make SkPixelRef::isLocked() debug-only, remove related dead code.
>
> DM's okay locally with no diffs, no failures.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/8e65712486c66108677a9b0a55ad3e7ca94db555

TBR=reed@google.com,mtklein@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/940323003
2015-02-19 20:00:33 -08:00
halcanary
8c92dc1dc2 Remove unused parameters to SkDocument::CreatePDF
All image compression currently uses (losseless) Deflate, not Jpeg.

All clients simply use SkDocument::CreatePDF(stream).

SampleApp and SkLua still use SkDocument::CreatePDF(path).

Review URL: https://codereview.chromium.org/935843007
2015-02-19 18:50:05 -08:00
mtklein
8e65712486 Make SkPixelRef::isLocked() debug-only, remove related dead code.
DM's okay locally with no diffs, no failures.

BUG=skia:

Review URL: https://codereview.chromium.org/940083002
2015-02-19 18:50:00 -08:00
scroggo
87fa631969 Rename onGetPixelsEnum back to onGetPixels.
Replace the old signature of onGetPixels (return bool) to return an
enum (Result). Remove onGetPixelsEnum.

Add a define for onGetPixelsEnum to onGetPixels. This is for staging
in Chromium, where some implementations override onGetPixelsEnum.

Add the define in skia_for_chromium_defines. Remove
SK_SUPPORT_LEGACY_IMAGE_GENERATOR_RETURN, which is no longer needed by
Chromium.

BUG=skia:3257

Review URL: https://codereview.chromium.org/939113002
2015-02-19 18:44:58 -08:00
joshualitt
25d9c15408 Pass Rendertarget into context.
Adding Jim for text context stuff, and Steven for image blur stuff.

BUG=skia:

Review URL: https://codereview.chromium.org/939623005
2015-02-18 12:29:52 -08:00
kkinnunen
cd6ca9e689 Make SkImage::getTexture() const
Make SkImage::getTexture() const. At the moment the function
does not mutate the state.

One use-case is that this makes it possible in the future to add draw
function to SkBaseDevice functions. The device draw functions take
const ref objects, but SkGpuDevice likely would benefit of using the
getTexture().

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

Review URL: https://codereview.chromium.org/925853002
2015-02-18 10:50:52 -08:00
mtklein
1e4e814c03 SK_NO_FLATE
Also remove skia_zlib_static.  We're not using it.  We don't even have zlib in DEPS.

No public API changes.
TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/936583002
2015-02-17 13:10:43 -08:00
reed
9e779d4951 add gm for path-arcs, and catch degenerate arc in conic-case
BUG=skia:3428

Review URL: https://codereview.chromium.org/931183002
2015-02-17 11:43:14 -08:00
reed
f87fe78bc3 use common impl for drawTextOnPath
BUG=skia:

Review URL: https://codereview.chromium.org/925343003
2015-02-17 10:33:54 -08:00
djsollen
523cda3943 Remove android specific srcPath from SkPath
Review URL: https://codereview.chromium.org/926693002
2015-02-17 08:06:33 -08:00
reed
9e447c08de remove unneeded preroll
BUG=skia:
TBR=robertphilips

Review URL: https://codereview.chromium.org/927443006
2015-02-15 11:08:40 -08:00
scroggo
0864908ca5 Make SkImageGenerator::getPixels() return an enum.
The new enum describes the nature of the failure. This is in
preparation for writing a replacement for SkImageDecoder, which will
use this interface.

Update the comments for getPixels() to specify what it means to pass
an SkImageInfo with a different size.

Make SkImageGenerator Noncopyable.

Leave onGetYUV8Planes alone, since we have separate discussions
regarding modifying that API.

Make callers of SkImageDecoder consistently handle kPartialSuccess.
Previously, some callers considered it a failure, and others considered
it a success.

BUG=skia:3257

Review URL: https://codereview.chromium.org/919693002
2015-02-13 11:13:34 -08:00
fmalita
f89f60f697 [SkSVGDevice] Full font family support
Use a family name iterator and list all names instead of just one
returned by SkTypeface::getFamilyName().

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

Review URL: https://codereview.chromium.org/923583002
2015-02-13 08:55:24 -08:00
mtklein
0a62ad734c Revert of I cannot remember what the race here actually was. (patchset #1 id:1 of https://codereview.chromium.org/922873002/)
Reason for revert:
http://build.chromium.org/p/client.skia/builders/Test-Ubuntu13.10-GCE-NoGPU-x86_64-Release-TSAN/builds/1557/steps/dm/logs/stdio

Original issue's description:
> I cannot remember what the race here actually was.
>
> Removing SkTRacy will show us, or perhaps show us we already fixed the race.
>
> BUG=chromium:437511
>
> No public API changes.
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/71409c83e69b387b3c5d567197d0421c36baf68d

TBR=bungeman@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:437511

Review URL: https://codereview.chromium.org/923543003
2015-02-12 15:32:07 -08:00
mtklein
71409c83e6 I cannot remember what the race here actually was.
Removing SkTRacy will show us, or perhaps show us we already fixed the race.

BUG=chromium:437511

No public API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/922873002
2015-02-12 15:24:51 -08:00
reed
05d9044de4 optional res-scale parameter to getFillPath
BUG=skia:
NOTREECHECKS=True
TBR=

Review URL: https://codereview.chromium.org/911053005
2015-02-12 13:35:52 -08:00
mtklein
979e0eacbd Spin off SkTHashTable, SkTHashMap, SkTHashSet
SkTHashTable is very similar to SkTDynamicHash, except it's generalized to support non-pointer value types.

It doesn't support remove(), just to keep things simple (it's not hard to add).
Instead of an iterator, it has foreach(), again, to keep things simple.

SkTHashMap<K,V> and SkTHashSet<T> build a friendlier experience on top of SkTHashTable.

BUG=skia:

Review URL: https://codereview.chromium.org/925613002
2015-02-12 13:20:08 -08:00
djsollen
90b5c0ced0 Expose SkPathRef::unique through SkPath.
This allows for the removal of SkPath::mSourcePath on Android
as they now have a better indicator of whether or not the path
can be used again via the Java API.

Review URL: https://codereview.chromium.org/913413004
2015-02-12 12:08:40 -08:00
bungeman
e998b7ff3a Move SkOSFile::Iter impls into ports.
This was one large ifdef in SkOSFile.cpp in utils.
This moves the code to existing ports files.

Review URL: https://codereview.chromium.org/920593002
2015-02-12 07:18:27 -08:00
bungeman
c3c694342a Fix append_fallback_font_families_for_locale.
The language was being set to garbage, now set to part of the file name.
Add a test to ensure we continue to parse fallback directories correctly.

BUG=chromium:422180

Review URL: https://codereview.chromium.org/912053003
2015-02-11 07:18:51 -08:00
bsalomon
3632f8473a Add tests for STArray swap
Review URL: https://codereview.chromium.org/909583003
2015-02-10 19:46:58 -08:00
reed
454fa71cc3 check for nonfinites in rrects
BUG=457128

Review URL: https://codereview.chromium.org/913743002
2015-02-10 08:46:22 -08:00
robertphillips
e85a32d4f8 Clean up clipping code a bit
Review URL: https://codereview.chromium.org/913693002
2015-02-10 08:16:55 -08:00
mtklein
1b9c8bb0a1 Only instance-count in SK_DEVELOPER builds (our debug builds, not Chrome's)
BUG=skia:

Review URL: https://codereview.chromium.org/910973003
2015-02-10 06:14:05 -08:00
mtklein
e72a80db3a Port SkLazyPtr to new SkAtomics.h
No algorithmic changes.  The new APIs let us avoid a few ugly trips through void*,
and I've made the consume/acquire/release decision explicitly conditioned on TSAN.

This should fix the attached bug, which is TSAN seeing us implementing the
sk_consume_load() with a relaxed load, where we used to pass __ATOMIC_CONSUME
to TSAN.  This restores us to the status quo of a couple weeks ago, where we
use relaxed loads (to avoid an extra dmb on ARM) for all setups except TSAN,
who gets the logically correct memory order, consume.

No public API changes.
TBR=reed@google.com

BUG=chromium:455606

Review URL: https://codereview.chromium.org/908943002
2015-02-09 14:47:06 -08:00
bsalomon
23e619cf46 Reimplement gpu message bus for invalidated bitmap gen IDs
Review URL: https://codereview.chromium.org/902873002
2015-02-06 11:54:28 -08:00
reed
3cb3840c9a Rename SkCanvasDrawable to SkDrawable, and make public
(patchset #2 id:20001 of https://codereview.chromium.org/903993002/)"

This reverts commit c4e8772492.

BUG=skia:
TBR=
NOTREECHECKS=True

Review URL: https://codereview.chromium.org/898343004
2015-02-06 08:36:15 -08:00
reed
c4e8772492 Revert of rename SkCanvasDrawable to SkDrawable, and make public (patchset #2 id:20001 of https://codereview.chromium.org/903993002/)
Reason for revert:
bug in gyp

Original issue's description:
> rename SkCanvasDrawable to SkDrawable, and make public
>
> BUG=skia:
> NOTRY=True
> ... winbuilder flake
>
> Committed: https://skia.googlesource.com/skia/+/4ae9eb7463cf2160723407359608f221c0d5e2a6

TBR=robertphillips@google.com,djsollen@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/882853006
2015-02-06 08:20:07 -08:00
reed
4ae9eb7463 rename SkCanvasDrawable to SkDrawable, and make public
BUG=skia:
NOTRY=True
... winbuilder flake

Review URL: https://codereview.chromium.org/903993002
2015-02-06 08:02:57 -08:00
joshualitt
de358a9946 BUG=skia:
Review URL: https://codereview.chromium.org/894693003
2015-02-05 08:19:35 -08:00
reed
b0df8be137 return reference to cache instead of copying the mask
BUG=437128

Review URL: https://codereview.chromium.org/889303005
2015-02-04 09:07:17 -08:00
fmalita
1a481fe4bf [SkSVGDevice] Initial clipping support
Implement SVG clips based on clip stack flattening -
which is now exposed in SkClipStack::asPath() and shared
with SkCanvas's simplify-clip code.

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

Review URL: https://codereview.chromium.org/876923003
2015-02-04 07:39:34 -08:00
mtklein
7b274c78fb Port SkRefCnt.h to new SkAtomics.h
This adds sk_memory_barrier(), implemented using sk_atomic_fetch_add() on an uninitialized variable.  If that becomes a problem we can drop this to the porting layer, using std::atomic_thread_fence() / __atomic_thread_fence() / __sync_synchronize().

The big win is that ref() doesn't generate a memory barrier any more on ARM.
This is an instance of SkSafeRef() in SkPaint(const SkPaint&) after this CL:
     4d0:       684a            ldr     r2, [r1, #4]
     4d2:       6018            str     r0, [r3, #0]
     4d4:       b13a            cbz     r2, 4e6 <_ZN7SkPaintC1ERKS_+0x2e>
     4d6:       1d10            adds    r0, r2, #4
     4d8:       e850 4f00       ldrex   r4, [r0]
     4dc:       3401            adds    r4, #1
     4de:       e840 4500       strex   r5, r4, [r0]
     4e2:       2d00            cmp     r5, #0
     4e4:       d1f8            bne.n   4d8 <_ZN7SkPaintC1ERKS_+0x20>

Here's the before,  pretty much the same with two memory barriers surrounding the ref():
     4d8:       684a            ldr     r2, [r1, #4]
     4da:       6018            str     r0, [r3, #0]
     4dc:       b15a            cbz     r2, 4f6 <_ZN7SkPaintC1ERKS_+0x3e>
     4de:       1d10            adds    r0, r2, #4
     4e0:       f3bf 8f5f       dmb     sy
     4e4:       e850 4f00       ldrex   r4, [r0]
     4e8:       3401            adds    r4, #1
     4ea:       e840 4500       strex   r5, r4, [r0]
     4ee:       2d00            cmp     r5, #0
     4f0:       d1f8            bne.n   4e4 <_ZN7SkPaintC1ERKS_+0x2c>
     4f2:       f3bf 8f5f       dmb     sy

The miscellaneous files in here are just fixups to explicitly include SkMutex.h,
instead of leeching it off SkRefCnt.h.

No public API changes.
TBR=reed@google.com

Build trybots seem hosed.
NOTRY=true

BUG=skia:

Review URL: https://codereview.chromium.org/896803002
2015-02-03 13:38:58 -08:00
mtklein
e67164d9b3 DM: wire up --leaks / -l again
No public API changes.
TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/893043002
2015-02-02 13:24:37 -08:00
mtklein
a669bc7a7a Atomics overhaul.
This merges and refactors SkAtomics.h and SkBarriers.h into SkAtomics.h and
some ports/ implementations. The major new feature is that we can express
memory orders explicitly rather than only through comments.

The porting layer is reduced to four template functions:
  - sk_atomic_load
  - sk_atomic_store
  - sk_atomic_fetch_add
  - sk_atomic_compare_exchange
From those four we can reconstruct all our previous sk_atomic_foo.

There are three ports:
  - SkAtomics_std:    uses C++11 <atomic>,             used with MSVC
  - SkAtomics_atomic: uses newer GCC/Clang intrinsics, used on not-MSVC where possible
  - SkAtomics_sync:   uses older GCC/Clang intrinsics, used where SkAtomics_atomic not supported

No public API changes.
TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/896553002
2015-02-02 12:22:07 -08:00
fmalita
3d91aad293 Disable LCD text when rasterizing SkPictureShader tiles.
BUG=chromium:453299
R=reed@google.com

Review URL: https://codereview.chromium.org/884163003
2015-02-02 05:25:04 -08:00
reed
418149250a export SkImageInfo
BUG=skia:

Review URL: https://codereview.chromium.org/893603005
2015-01-30 14:54:38 -08:00
brucedawson
aea85dc3d3 Disable the noisiest /analyze warning in Chrome. ~3,700/12,000
Decades ago Intel decided that the bsr (Bit Scan Reverse) instruction
should have undefined results if its argument is zero. This probably
makes the instruction harder to implement and it definitely makes it
more difficult to use.

In SkCLZ_portable it requires a check for a zero argument, but despite
that check /analyze still warns that _BitScanReverse might fail
(because it doesn't know what can cause failures). Because this warning
occurs in a frequently included header file it ends up being very noisy,
accounting for ~30% of all warnings (before deduplication).

Suppressing this useless warning will make the raw results easier to
look through.

Review URL: https://codereview.chromium.org/872673007
2015-01-30 12:57:50 -08:00
scroggo
1872ad0fe9 Remove unused globalRef/globalUnref.
BUG=skia:1482

Review URL: https://codereview.chromium.org/887993003
2015-01-30 07:34:48 -08:00
scroggo
5d2fd4465b Remove unused hasLocalMatrix.
This method is not called anywhere on Android or Chrome, and it
has a FIXME that it may not be correct.

A client can still getLocalMatrix().isIdentity() if they need this
information. (It has the same FIXME, and perhaps we should revisit
it. In the meantime, this convenience method is not needed.)

Review URL: https://codereview.chromium.org/882443007
2015-01-30 07:14:04 -08:00
scroggo
527b28732d Update comment for SkMallocPixelRef::NewWithProc.
Add a comment about using a NULL ReleaseProc.

BUG=skia:2185

Review URL: https://codereview.chromium.org/885573005
2015-01-29 13:52:13 -08:00
reed
c778904a5b share code between arcTo and addArc, update dox
BUG=skia:

Review URL: https://codereview.chromium.org/863123005
2015-01-29 12:59:11 -08:00
mtklein
4f358fc269 Make SkWriter32::snapshotAsData() a dumb copy.
SkWriter32::snapshotAsData() is no longer performance critical.
It's only used when we're serializing to disk.

BUG=skia:2289

Review URL: https://codereview.chromium.org/875403005
2015-01-29 12:03:53 -08:00
senorblanco
772604c214 Add a flag to flush the canvases during SkMultiPictureDraw::draw().
This is necessary for multisampling, so that each multisampled render
target resolves before Chrome's compositor attempts to draw the
texture.

BUG=skia:

Review URL: https://codereview.chromium.org/878653004
2015-01-28 11:01:06 -08:00
fmalita
3dc40ac9f9 Conservative SkTextBlob bounds.
Compute cheaper/more conservative text blob bounds based on the typeface
maximum glyph bbox.

BUG=chromium:451401
R=reed@google.com,bungeman@google.com

Review URL: https://codereview.chromium.org/886473002
2015-01-28 10:56:06 -08:00
bungeman
5f213d9627 SkTypeface to use SkStreamAsset.
SkTypeface already requires typeface streams to support SkStreamAsset
in practice, and in practice all users are already supplying them.

Review URL: https://codereview.chromium.org/869763002
2015-01-27 05:39:10 -08:00
robertphillips
0a482f4414 Fix Chrome build
Switch SkShader's toString method to not be pure virtual due to derived classes in Chromium

TBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/875043002
2015-01-26 07:00:05 -08:00
robertphillips
42dbfa8651 Add patheffects to debugger printout
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/872043002
2015-01-26 06:08:52 -08:00
reed
96a857ef5a initial preroll api
BUG=skia:

Review URL: https://codereview.chromium.org/855473002
2015-01-25 10:33:58 -08:00
bsalomon
a3ca15c314 Remove deprecated SkSurface::NewRenderTarget factories
Review URL: https://codereview.chromium.org/837723008
2015-01-23 11:02:50 -08:00
bsalomon
eaaaf0b16c Take budgeted param when snapping new image.
Review URL: https://codereview.chromium.org/872543002
2015-01-23 08:08:04 -08:00
reed
f803da12cf add newImage API
BUG=skia:3277
related bug: skbug.com/3276

Review URL: https://codereview.chromium.org/821083002
2015-01-23 05:58:07 -08:00
egdaniel
dcfb7cf336 Remove the need for asCoeff in SkXfermode.
BUG=skia:

Review URL: https://codereview.chromium.org/864833002
2015-01-22 06:52:29 -08:00
bungeman
2dca817edb Remove staging SkStream::unref().
SkStream::unref() was added to ease transitioning off of SkStream
deriving from SkRefCnt. It is no longer needed, remove it.

TBR=reed@google.com

Review URL: https://codereview.chromium.org/861413002
2015-01-22 06:08:31 -08:00
mtklein
a64c48f4f9 Move sync code to include/, switch from using platform define to a proxy header in core/
This fixes two problems:
  1)  #include SK_SOME_DEFINE doesn't work well for all our clients.
  2)  Things in include/ are #including things in src/, which we don't like.

TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/862983002
2015-01-21 13:13:31 -08:00
scroggo
a1193e4b0e Make SkStream *not* ref counted.
SkStream is a stateful object, so it does not make sense for it to have
multiple owners. Make SkStream inherit directly from SkNoncopyable.

Update methods which previously called SkStream::ref() (e.g.
SkImageDecoder::buildTileIndex() and SkFrontBufferedStream::Create(),
which required the existing owners to call SkStream::unref()) to take
ownership of their SkStream parameters and delete when done (including
on failure).

Switch all SkAutoTUnref<SkStream>s to SkAutoTDelete<SkStream>s. In some
cases this means heap allocating streams that were previously stack
allocated.

Respect ownership rules of SkTypeface::CreateFromStream() and
SkImageDecoder::buildTileIndex().

Update the comments for exceptional methods which do not affect the
ownership of their SkStream parameters (e.g.
SkPicture::CreateFromStream() and SkTypeface::Deserialize()) to be
explicit about ownership.

Remove test_stream_life, which tested that buildTileIndex() behaved
correctly when SkStream was a ref counted object. The test does not
make sense now that it is not.

In SkPDFStream, remove the SkMemoryStream member. Instead of using it,
create a new SkMemoryStream to pass to fDataStream (which is now an
SkAutoTDelete).

Make other pdf rasterizers behave like SkPDFDocumentToBitmap.

SkPDFDocumentToBitmap delete the SkStream, so do the same in the
following pdf rasterizers:

SkPopplerRasterizePDF
SkNativeRasterizePDF
SkNoRasterizePDF

Requires a change to Android, which currently treats SkStreams as ref
counted objects.

Review URL: https://codereview.chromium.org/849103004
2015-01-21 12:09:53 -08:00
reed
3f43f8ab9c remove dead SkPersp macros
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/864713002
2015-01-20 19:58:36 -08:00
egdaniel
58136167fc Do more cleanup from xp changes
BUG=skia:

Review URL: https://codereview.chromium.org/811903004
2015-01-20 10:19:22 -08:00
weiliangc
07f26976f7 Remove unused TileGridInfo
Chromium no longer uses TileGridInfo as of CL 856853003 and remove this
from skia.

BUG=chromium:447662

Review URL: https://codereview.chromium.org/828503004
2015-01-20 05:57:06 -08:00
reed
7729e56a29 use log2(scale) to compute mip level
now w/ expanded suppressions

This reverts commit b50ced7030.

BUG=skia:
TBR=
NOTRY=True
NOTREECHECKS=True

Review URL: https://codereview.chromium.org/856723003
2015-01-16 08:35:09 -08:00
bsalomon
afe3005be3 Require budget decision when creating a RenderTarget SkSurface.
Restructure SkGpuDevice creation:
*SkSurfaceProps are optional.
*Use SkSurfaceProps to communicate DF text rather than a flag.
*Tell SkGpuDevice::Create whether RT comes from cache or not.

Review URL: https://codereview.chromium.org/848903004
2015-01-16 07:32:33 -08:00
reed
b50ced7030 Revert of use log2(scale) to compute mip level (patchset #7 id:120001 of https://codereview.chromium.org/849333002/)
Reason for revert:
need more suppressions

Original issue's description:
> use log2(scale) to compute mip level
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/15fd47f8a07615a7f5d78581aee4c80ff9f17fd9

TBR=robertphillips@google.com,jvanverth@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/856783004
2015-01-16 07:27:46 -08:00
reed
15fd47f8a0 use log2(scale) to compute mip level
BUG=skia:

Review URL: https://codereview.chromium.org/849333002
2015-01-16 07:18:10 -08:00
egdaniel
38cd055215 Do some minor pre cleanup work before converting all xfermodes to XPs.
BUG=skia:

Review URL: https://codereview.chromium.org/853543003
2015-01-14 08:05:11 -08:00
reed
a7f11918d9 rename blitrow::proc and add (uncalled) hook for colorproc16
BUG=skia:3302

Review URL: https://codereview.chromium.org/847443003
2015-01-13 13:51:00 -08:00
mtklein
e55fb177e9 Allow -DGOOGLE3 to bypass our normal platform intrinsic dispatch.
The current code that pound-includes another define doesn't seem to be working there.

BUG=skia:

No API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/820643005
2015-01-13 13:27:26 -08:00
mtklein
199ba8e19b namespace {} trick for SK_DECLARE_STATIC_ONCE
Like all our other SK_DECLARE_STATIC_*, it's usually not a thread-safe
thing to put inside a function.  Adding namespace {} prevents that
syntactically.

Needs https://codereview.chromium.org/841263004/ to land first.

BUG=chromium:447890

No public API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/806473006
2015-01-13 08:40:23 -08:00
mtklein
6f07665768 Simplify SkInstCnt
This code requires fewer macros to use it (just one), has less code in macro
definitions, and has simpler synchronization code (just atomic ints, no SkOnce,
no SkMutex, etc.)

A minor downside, we lose indentation and reverse-ordering in the final report:
  Leaked SkRefCntBase: 7
     Leaked SkFontMgr: 1
     Leaked SkWeakRefCnt: 1
         Leaked SkTypeface: 1
     Leaked SkFlattenable: 3
         Leaked SkXfermode: 3
     Leaked SkPathRef: 1
     Leaked SkPixelRef: 1
         Leaked SkMallocPixelRef: 1
becomes
  Leaked SkXfermode: 3
  Leaked SkMallocPixelRef: 1
  Leaked SkPixelRef: 1
  Leaked SkPathRef: 1
  Leaked SkFlattenable: 3
  Leaked SkTypeface: 1
  Leaked SkWeakRefCnt: 1
  Leaked SkFontMgr: 1
  Leaked SkRefCntBase: 7

This is motivated by wanting to land https://codereview.chromium.org/806473006/,
which makes sure all static use of SkOnce are in global scope.  The current
implementation of SkInstCnt uses them in function scope, which isn't safe.
BUG=skia:

No public API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/841263004
2015-01-13 08:22:44 -08:00
reed
4ef0c8aea2 remove NewTexture?
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/831323005
2015-01-13 04:00:55 -08:00
reed
0846f1b1c4 remove (dead) SK_SUPPORT_LEGACY_DRAWDATA and SK_SUPPORT_LEGACY_CANVAS_VIRTUAL
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/844053002
2015-01-09 14:17:40 -08:00
mtklein
72c9faab45 Fix up all the easy virtual ... SK_OVERRIDE cases.
This fixes every case where virtual and SK_OVERRIDE were on the same line,
which should be the bulk of cases.  We'll have to manually clean up the rest
over time unless I level up in regexes.

for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end

BUG=skia:

Review URL: https://codereview.chromium.org/806653007
2015-01-09 10:06:40 -08:00
mtklein
703dd2ed18 Remove SkTileGrid (except for TileGridInfo).
TBR=reed@google.com

BUG=skia:3085

Review URL: https://codereview.chromium.org/845623002
2015-01-09 06:41:48 -08:00
reed
281ecc27ee need to rebaseline (changed) c_gms, update dox
BUG=skia:
TBR=
NOTRY=True

Review URL: https://codereview.chromium.org/844663002
2015-01-07 18:20:16 -08:00
reed
5965c8ae4e add ImageGenerator::NewFromData to porting layer
BUG=skia:3275

Review URL: https://codereview.chromium.org/834633006
2015-01-07 18:04:45 -08:00
sugoi
23d432080c Adding check on input count
An integer overflow is causing a memory allocation to succeed while it should fail for being too large.

BUG=445810

Review URL: https://codereview.chromium.org/831583004
2015-01-07 13:28:08 -08:00
robertphillips
f4e5995ac7 It is dangerous to ignore SkRect::intersect's return value
Committed: https://skia.googlesource.com/skia/+/152f524fd325b7776b01f84afbfe2fa071648a05

Review URL: https://codereview.chromium.org/833943002
2015-01-07 12:16:10 -08:00
robertphillips
690fc594f1 Revert of It is dangerous to ignore SkRect::intersect's return value (patchset #6 id:100001 of https://codereview.chromium.org/833943002/)
Reason for revert:
Still more Chromium clean up to do

Original issue's description:
> It is dangerous to ignore SkRect::intersect's return value
>
> Committed: https://skia.googlesource.com/skia/+/152f524fd325b7776b01f84afbfe2fa071648a05

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

Review URL: https://codereview.chromium.org/825983005
2015-01-07 09:12:43 -08:00
mtklein
7e44bb1916 Remove macros that make it look like it's a good idea to not be able to flatten.
There are only a handful of SkFlattenables that are not flattenable.  That
there are any seems highly illogical.  To make this look less like a normal
thing, this removes both macros that marked SkFlattenables as non-flattenable
(in slightly different ways).

The handful of SkFlattenables in our codebase that can't be flattened now
assert violently that they can't be flattened.  They're internal or
part of animator... places where we'll never actually flatten them.

TestLooper and DummyRasterizer were so trivial that I just made them flattenable.

BUG=skia:

Review URL: https://codereview.chromium.org/841753002
2015-01-07 09:06:08 -08:00
robertphillips
152f524fd3 It is dangerous to ignore SkRect::intersect's return value
Review URL: https://codereview.chromium.org/833943002
2015-01-07 09:01:13 -08:00
robertphillips
783fe16b8e Rename SkDrawPictureCallback to SkPicture::AbortCallback
Committed: https://skia.googlesource.com/skia/+/7ef197255deb4e2fa64c03c7130d56ddf164e83c

Review URL: https://codereview.chromium.org/829983003
2015-01-07 07:28:41 -08:00
reed
8ea6dabbb1 Revert of Rename SkDrawPictureCallback to SkPicture::AbortCallback (patchset #2 id:20001 of https://codereview.chromium.org/829983003/)
Reason for revert:
speculative revert to unblock DEPS roll

Original issue's description:
> Rename SkDrawPictureCallback to SkPicture::AbortCallback
>
> Committed: https://skia.googlesource.com/skia/+/7ef197255deb4e2fa64c03c7130d56ddf164e83c

TBR=reed@google.com,robertphillips@google.com
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/824013004
2015-01-06 16:15:25 -08:00
robertphillips
7ef197255d Rename SkDrawPictureCallback to SkPicture::AbortCallback
Review URL: https://codereview.chromium.org/829983003
2015-01-06 12:26:08 -08:00