Commit Graph

9 Commits

Author SHA1 Message Date
Florin Malita
b00a36050a Purge cached SkPictureShader entries on shader deletion
We're currently adding picture shader cache entries to the resource
cache, but we don't ever purge.  To avoid exhausting the budget, add
logic to associate cached entries with their owning picture shader, and
purge when the shader is deleted.

-- Side note --

The current cache key is

 K(pictureID, ...)

so technically the cache entries are associated with the picture, not the
shader.  One could resonably argue we should only purge when the
*picture* is deleted.  Unfortunately, this doesn't work: the cache entries
contain indirect refs to the picture (SkImageShader -> SkImage_Generated
-> SkPictureImageGenerator -> SkPicture), so the picture is always kept
alive.

Associating the cache entries with the shader itself seems like a
reasonable alternative, even if we give up some cache persistence in the
process.

Change-Id: Ia115dbb5ae627e5ee171da7c4430fecfd42f4292
Reviewed-on: https://skia-review.googlesource.com/23380
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-07-14 14:19:34 +00:00
reed
ca2622ba05 return pictures as sk_sp
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811703002

Review URL: https://codereview.chromium.org/1811703002
2016-03-18 07:25:55 -07:00
reed
1a9b964084 Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium.org/1789633002/ )"
This reverts commit 9283d20afc.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1793303002

Review URL: https://codereview.chromium.org/1793303002
2016-03-13 14:13:58 -07:00
reed
9283d20afc Revert of more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium.org/1789633002/ )
Reason for revert:
seems to have changed pictureshadertile

Original issue's description:
> more shader-->sp conversions
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1789633002
>
> Committed: https://skia.googlesource.com/skia/+/ce563cdd48ec7ce4e0420dd88760df9be9dba50c

TBR=fmalita@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1790353002
2016-03-13 13:01:57 -07:00
reed
ce563cdd48 more shader-->sp conversions
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1789633002

Review URL: https://codereview.chromium.org/1789633002
2016-03-13 12:32:36 -07:00
halcanary
96fcdcc219 Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002

Review URL: https://codereview.chromium.org/1316233002
2015-08-27 07:41:16 -07:00
mtklein
cfa90a1aaf Empty picture shaders should draw nothing.
BUG=skia:

Review URL: https://codereview.chromium.org/1142053004
2015-05-18 13:44:35 -07:00
fmalita
b5f7826c51 Explicit tile bounds for SkPictureShader
The integer picture size is not granular enough to allow precise tiling
in arbitrary coordinate systems. This CL adds an optional tile bounds
float rect param to control the tile size and location.

(this also allows tile spacing emulation for picture
shaders).

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

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/437393003
2014-08-06 13:07:15 -07:00
commit-bot@chromium.org
855e88edfa Fixes for SkPictureShader.
Update comment in header to make it more clear that the picture
should be unaltered after creating the shader. We want our shaders
to be immutable, and this supports that.

Make the factory return NULL if the shader would have never drawn
anyway i.e. for a null picture or picture with no width/height.

Addresses comments I brought up in
https://codereview.chromium.org/221923007/#msg16.

BUG=skia:1976
R=reed@google.com, fmalita@chromium.org, robertphillips@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/238253005

git-svn-id: http://skia.googlecode.com/svn/trunk@14288 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-04-21 19:33:12 +00:00