Commit Graph

18 Commits

Author SHA1 Message Date
Cary Clark
2a475eae62 add drawString helper to canvas
Many tests and examples use drawText with
a guess of how long the text is in bytes,
or a call to strlen(). Add a helper to
SkCanvas to simplify these examples.

Add another helper for SkString.

R=reed@google.com

Change-Id: I0204a31e938f065606f08ee7cd9a6b36db791ee2
Reviewed-on: https://skia-review.googlesource.com/13642
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Cary Clark <caryclark@skia.org>
2017-04-28 20:41:04 +00:00
Mike Reed
887cdf1128 move vertex-mode enum into SkVertices
BUG=skia:6366

Change-Id: I3c0bf96cce6d32c9b8d12d16a772aaa6f18981aa
Reviewed-on: https://skia-review.googlesource.com/11062
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-04-03 15:50:16 +00:00
Mike Klein
33d2055e59 GM: some header cleanup
gm.h includes sk_tool_utils.h but does not use it.

The bulk of this CL makes each gm that uses sk_tool_utils include it.

sk_tool_utils.h also provided SkRandom and SkTDArray,
so a couple GMs add those headers too.

Change-Id: Ieb2a7c542f0ca89c3223f744fc11b0ff37af36c1
Reviewed-on: https://skia-review.googlesource.com/10014
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
2017-03-22 18:11:49 +00:00
Matt Sarett
77a7a1b57c SkColorSpace: remove named API, add gamut API
Reland from: https://skia-review.googlesource.com/c/8021/

BUG=skia:

Change-Id: I18985f130587b15fccbc86b76b2bb5c49ba5ba8a
Reviewed-on: https://skia-review.googlesource.com/8136
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-02-07 19:33:37 +00:00
Matt Sarett
1f2fff2544 Revert "SkColorSpace: remove named API, add gamut API"
This reverts commit ecaaf6f1c1.

Reason for revert: Breaks everything

Original change's description:
> SkColorSpace: remove named API, add gamut API
> 
> BUG=skia:
> 
> Change-Id: I01c5e1874c9a034febc64e25b3aaafb5050393a6
> Reviewed-on: https://skia-review.googlesource.com/8021
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Matt Sarett <msarett@google.com>
> 

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

Change-Id: Ief5a0a4eeabe75a21f7512e23fc15309151066c4
Reviewed-on: https://skia-review.googlesource.com/8127
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-02-07 17:06:24 +00:00
Matt Sarett
ecaaf6f1c1 SkColorSpace: remove named API, add gamut API
BUG=skia:

Change-Id: I01c5e1874c9a034febc64e25b3aaafb5050393a6
Reviewed-on: https://skia-review.googlesource.com/8021
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-02-07 17:00:58 +00:00
Brian Osman
0d4ff6c601 Fix code that relied on readPixels not doing color space conversion
SampleApp doesn't have (can't easily get) an image, so I couldn't use
the new helper function there. It's probably still worth having?

BUG=skia:

Change-Id: I60c208ff958076015a9539359921b9aff68f25c8
Reviewed-on: https://skia-review.googlesource.com/7129
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-01-17 21:53:57 +00:00
Ben Wagner
145dbcd165 Remove SkAutoTDelete.
Replace with std::unique_ptr.

Change-Id: I5806cfbb30515fcb20e5e66ce13fb5f3b8728176
Reviewed-on: https://skia-review.googlesource.com/4381
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2016-11-03 19:03:40 +00:00
Mike Reed
7d954ad797 remove xfermode from public api
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4020

CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Change-Id: I19cd056f2af778f10e8c6c2b7b2735593b43dbac
Reviewed-on: https://skia-review.googlesource.com/4020
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2016-10-28 20:06:17 +00:00
Brian Osman
526972ecb5 Rename all color space factories from New* to Make*
Matches our naming convention for all other types - factories that
return sk_sp (or any type that intelligently manages its own
lifetime) are named Make.

Previous factories are still around, assuming
SK_SUPPORT_LEGACY_COLOR_SPACE_FACTORIES is defined. Enable that
define for Android, etc.

See also: https://codereview.chromium.org/2442053002/

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3822

Change-Id: Iaea9376490736b494e8ffc820831f052bbe1478d
Reviewed-on: https://skia-review.googlesource.com/3822
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2016-10-24 14:02:27 +00:00
raftias
9488833428 Refactored SkColorSpace and added in a Lab PCS GM
The refactoring breaks off A2B0 tag support into a separate
subclass of SkColorSpace_Base, while keeping the current
(besides CLUT) functionality in a XYZTRC subclass.

ICC profile loading is now aware of this and creates the A2B0
subclass when SkColorSpace::NewICC() is called on a profile
in need of the A2B0 functionality.

The LabPCSDemo GM loads a .icc profile containing a LAB PCS and
then runs a Lab->XYZ conversion on an image using it so we can
display it and test out the A2B0 SkColorSpace functionality,
sans a/b/m-curves, as well as the Lab->XYZ conversion code.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2389983002

Review-Url: https://codereview.chromium.org/2389983002
2016-10-18 10:02:52 -07:00
raftias
7c602de058 Removed makeLinearGamma() from the public API for SkColorSpace
It will now reside in SkColorSpace_Base. Future work for SkColorSpace
will cause this function to not be desirable or sensible to call on
all SkColorSpaces. Call sites were changed to make a kSRGBLinear_Named
instead of kSRGB_Named -> makeLinearGamma() (the majority of cases),
and if that was not possible, SkColorSpace_Base::makeLinearGamma()
was called instead.

TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2412613005

Review-Url: https://codereview.chromium.org/2412613005
2016-10-13 10:45:44 -07:00
fmalita
ed38772630 Revert of Fix gamut GM to work w/serialization configs. Remove it from blacklist. (patchset #2 id:20001 of https://codereview.chromium.org/2383513002/ )
Reason for revert:
Valgrind errors:

==2603== Invalid read of size 8
==2603==    at 0xA284E0: SkSurface::getCanvas() (SkSurface_Base.h:108)
==2603==    by 0x4F0B0F: gamut_GM(SkCanvas*) (gamut.cpp:163)
==2603==    by 0x483B77: DM::GMSrc::draw(SkCanvas*) const (DMSrcSink.cpp:69)
==2603==    by 0x485F04: DM::GPUSink::draw(DM::Src const&, SkBitmap*, SkWStream*, SkString*) const (DMSrcSink.cpp:1226)
==2603==    by 0x47E974: dm_main() (DM.cpp:1035)
==2603==    by 0x6652EC4: (below main) (libc-start.c:287)
==2603==  Address 0x20 is not stack'd, malloc'd or (recently) free'd
==2603==

https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind/builds/1410/steps/test_skia%20on%20Ubuntu/logs/stdio

Original issue's description:
> Fix gamut GM to work w/serialization configs. Remove it from blacklist.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2383513002
>
> Committed: https://skia.googlesource.com/skia/+/e4a17372a188f1dffc3f9c9bcdfbb9860728630b

TBR=reed@google.com,borenet@google.com,brianosman@google.com
# 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/2380313002
2016-09-30 06:14:49 -07:00
brianosman
e4a17372a1 Fix gamut GM to work w/serialization configs. Remove it from blacklist.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2383513002

Review-Url: https://codereview.chromium.org/2383513002
2016-09-29 07:25:45 -07:00
brianosman
d454609f62 Support for color-spaces with multi-stop (texture) gradients
Texture is F16 linear, unless that's not supported. In that
case, we pack down to sRGB.

Added more test patches to the gamut GM with many stops,
to test this case. Now they render correctly.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2343253002

Review-Url: https://codereview.chromium.org/2343253002
2016-09-22 12:31:59 -07:00
brianosman
de68d6c461 Fix storage of gamut transform matrices in SkColorSpace
We were effectively storing the transpose, which made all of our
operations on individual colors, and our concatenation of matrices
awkward and backwards.

I'm planning to push this further into Ganesh, where I had incorrectly
adjusted to the previous layout, treating colors as row vectors in the
shaders.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2324843003

Review-Url: https://codereview.chromium.org/2324843003
2016-09-09 10:36:17 -07:00
msarett
48ba2b8550 Rename SkColorSpace::GammaNamed to SkColorSpace::RenderTargetGamma
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2319293002

Review-Url: https://codereview.chromium.org/2319293002
2016-09-07 18:55:49 -07:00
brianosman
2c4b64e92a New gamut GM, to test gamut conversion in various code-paths
After several different strategies, this one appears to work
well. The basic test:

1) For a variety of drawing techniques, we render fixed size
   rectangles. (Solid colors via paint color, bitmap, etc...)
2) For each method in #1, we render to both an sRGB and
   WideGamutRGB offscreen surface. (AdobeRGB isn't wide enough
   to clearly demonstrate if things are working or not).
3) Use readPixels to fetch the raw (still in wide gamut) pixel
   data, then draw that directly to the final canvas.

So, for each pair of squares, they should look clearly
different. Currently, with the GPU backend, only the bicubic
bitmap paths have that behavior. Adding more test cases (and
fixing the ones that are already incorrect) will be the long
tail of gamut transformation.

Current output (with my other patchset, which fixes all
bitmap draws): https://screenshot.googleplex.com/wsL3x7eCtWE.png

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2293173002

Review-Url: https://codereview.chromium.org/2293173002
2016-09-07 07:04:45 -07:00