Commit Graph

28 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 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
Brian Salomon
89cb821e9e Separate SkArithmeticImageFilter from SkXfermodeImageFilter.
Change-Id: I145eed7276456b546ca5c66bc1a0f0f74a84f138
Reviewed-on: https://skia-review.googlesource.com/6728
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-01-09 18:31:29 +00:00
fmalita
ad7cb810dc Reenable GM:arithmode
Convert to SkXfermodeImageFilter and reenable.

R=reed@google.com,robertphillips@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2379873003

Review-Url: https://codereview.chromium.org/2379873003
2016-09-29 12:25:26 -07:00
Mike Reed
403d154591 Revert "Revert "replace Arithmetic xfermode with imagefilter""
This reverts commit 10ff5bfa78.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2680
TBR=
Change-Id: Iac2f4d48d227ff426ccf02b7eae280f382ad3580
Reviewed-on: https://skia-review.googlesource.com/2680
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2016-09-27 10:33:06 +00:00
Mike Reed
10ff5bfa78 Revert "replace Arithmetic xfermode with imagefilter"
This reverts commit Ia3f3b721854c516f3b7f8c44f71f40a8a2eeb9b4.

Reason for revert: need to guard the no-gpu codepath

Original issue's description:
> replace Arithmetic xfermode with imagefilter
> 
> chrome pre-cl: https://codereview.chromium.org/2369023002/
> 
> BUG=skia:
> 
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2595
> 
> Change-Id: Ia3f3b721854c516f3b7f8c44f71f40a8a2eeb9b4
> Reviewed-on: https://skia-review.googlesource.com/2595
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> 

TBR=robertphillips@google.com,fmalita@chromium.org,fmalita@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I761799b594a0379c6bf356e6abc73552c3d19480
Reviewed-on: https://skia-review.googlesource.com/2661
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2016-09-26 20:53:19 +00:00
Mike Reed
0530c88067 replace Arithmetic xfermode with imagefilter
chrome pre-cl: https://codereview.chromium.org/2369023002/

BUG=skia:

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

Change-Id: Ia3f3b721854c516f3b7f8c44f71f40a8a2eeb9b4
Reviewed-on: https://skia-review.googlesource.com/2595
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2016-09-26 20:00:07 +00:00
mtklein
dbfd7ab108 Replace a lot of 'static const' with 'constexpr' or 'const'.
'static const' means, there must be at most one of these, and initialize it at
compile time if possible or runtime if necessary.  This leads to unexpected
code execution, and TSAN* will complain about races on the guard variables.

Generally 'constexpr' or 'const' are better choices.  Neither can cause races:
they're either intialized at compile time (constexpr) or intialized each time
independently (const).

This CL prefers constexpr where possible, and uses const where not.  It even
prefers constexpr over const where they don't make a difference... I want to have
lots of examples of constexpr for people to see and mimic.

The scoped-to-class static has nothing to do with any of this, and is not changed.

* Not yet on the bots, which use an older TSAN.

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

Review-Url: https://codereview.chromium.org/2300623005
2016-09-01 11:24:54 -07:00
reed
cfb6bdf767 switch xfermodes over to sk_sp
waiting on https://codereview.chromium.org/1835163002/

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

Review URL: https://codereview.chromium.org/1832223002
2016-03-29 11:32:50 -07:00
reed
8a21c9fe7f use Make instead of Create to return a shared shader
Partially updated call sites. Undefine the flag in SkSHader.h to convert the remaining sites.

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

Review URL: https://codereview.chromium.org/1772463002
2016-03-08 18:50:00 -08:00
scroggo
96f16e835e Use DEF_GM everywhere
BUG=skia:1902

Review URL: https://codereview.chromium.org/1518893002
2015-12-10 13:31:59 -08:00
ericrk
af96fce879 The SkArithmeticMode_gpu GL filters support clamping to valid
premultiplied colors, however the flag for whether or not to do this,
which is present in their parent filters, is dropped when creating the
GL implementations. This change adds logic to forward the value from
the parent filter to the GL implementation.

This makes GPU behavior match software and fixes a WebKit
LayoutTest. See referenced bug.

BUG=473186

Review URL: https://codereview.chromium.org/1410553002
2015-10-19 14:41:11 -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
caryclark
1818acb6a4 rename portable_typeface_always to portable_typeface
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1257773002
2015-07-24 12:09:25 -07:00
caryclark
dfcb7abc41 make arithmode bigtext colortype* degeneratesegments gm portable
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1235343004
2015-07-17 09:39:16 -07:00
caryclark
5fb6bd4b7e use platform-independent font for gm
Create a custom typeface and scaler to render simple paths the
same on all platforms.

GM tests are modified to explicitly select the custom typeface.

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

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/348323003
2014-06-23 11:25:00 -07:00
reed@google.com
eb9a46cbbb add legacy/helper allocN32Pixels, and convert gm to use it
This is an intermediate api, but might help us quickly get to a point where
no one is creating bitmaps in a 2-step process (setConfig + alloc).

BUG=skia:
R=halcanary@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@13182 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-01-25 16:46:20 +00:00
senorblanco@chromium.org
9a6eb0e1e8 Provide a GPU implementation of SkArithmeticMode, using a custom GrEffect exposed via asNewEffectOrCoeff().
Doing it this way required modifying the arithmode GM to use saveLayer()/restore() rather than creating an offscreen SkBitmap, since otherwise the compositing is always done in raster mode. Fixing that in turn exposed that SkArithmeticMode did not work in Picture mode, since it wasn't flattenable. Made it so.

Note: this will require rebaselining the arithmode GM (again).

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

Originally committed: https://code.google.com/p/skia/source/detail?r=9324
Reverted: https://code.google.com/p/skia/source/detail?r=9325

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

git-svn-id: http://skia.googlecode.com/svn/trunk@9330 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-05-29 20:55:09 +00:00
senorblanco@chromium.org
06e7424c70 Revert "Provide a GPU implementation of SkArithmeticMode, using a custom GrEffect exposed via asNewEffectOrCoeff()."
This reverts commit b8ffe17b5c684f9cfff02285f27e6aa1f75c9b53.

TBR=robertphillips

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

git-svn-id: http://skia.googlecode.com/svn/trunk@9325 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-05-29 19:05:54 +00:00
senorblanco@chromium.org
6b6c1dc34c Provide a GPU implementation of SkArithmeticMode, using a custom GrEffect exposed via asNewEffectOrCoeff().
Doing it this way required modifying the arithmode GM to use saveLayer()/restore() rather than creating an offscreen SkBitmap, since otherwise the compositing is always done in raster mode. Fixing that in turn exposed that SkArithmeticMode did not work in Picture mode, since it wasn't flattenable. Made it so.

Note: this will require rebaselining the arithmode GM (again).

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

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

git-svn-id: http://skia.googlecode.com/svn/trunk@9324 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-05-29 18:50:46 +00:00
senorblanco@chromium.org
35c733cc9c Fix alpha computation in SkArithmeticMode.
Note: this will require new baselines for the arithmode GM.

R=reed@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@9302 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-05-28 19:43:05 +00:00
junov@google.com
dbfac8a723 Defining new color constat for transparent color
Review URL: https://codereview.appspot.com/6901044

git-svn-id: http://skia.googlecode.com/svn/trunk@6696 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-12-06 21:47:40 +00:00
rmistry@google.com
ae933ce0ea Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part III of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6475053

git-svn-id: http://skia.googlecode.com/svn/trunk@5264 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-23 18:19:56 +00:00
caryclark@google.com
1313086ef4 fix warnings on Mac in gm
Fix these class of warnings:
- unused functions
- unused locals
- sign mismatch
- missing function prototypes
- missing newline at end of file
- 64 to 32 bit truncation

The changes prefer to link in dead code in the debug build
with 'if (false)' than to comment it out, but trivial cases
are commented out or sometimes deleted if it appears to be
a copy/paste error.
Review URL: https://codereview.appspot.com/6305046

git-svn-id: http://skia.googlecode.com/svn/trunk@4185 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-06-06 12:10:45 +00:00
bsalomon@google.com
cadbcb8e53 Towards enabling -Werror in skia on Linux
Review URL: http://codereview.appspot.com/5516044/



git-svn-id: http://skia.googlecode.com/svn/trunk@2983 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-01-06 19:22:11 +00:00
reed@google.com
eb85630fd6 fix positioning for scalar=fixed, still need to fix actual mode
git-svn-id: http://skia.googlecode.com/svn/trunk@2862 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-12 22:15:18 +00:00
reed@google.com
eb0fa29fc4 try to make it draw correctly in fixed point
git-svn-id: http://skia.googlecode.com/svn/trunk@2860 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-12 22:01:06 +00:00
mike@reedtribe.org
e51755fc64 add first cut at arithmetic mode
git-svn-id: http://skia.googlecode.com/svn/trunk@2849 2bbb7eff-a529-9590-31e7-b0007b416f81
2011-12-10 19:36:56 +00:00