aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
Commit message (Collapse)AuthorAge
* Use SkAndroidCodec in SkAnimatedImageGravatar Leon Scroggins III2018-01-16
| | | | | | | | | | | | | | | | | | | | | | | | | | Bug: b/63909536 Bug: b/63908092 SkAnimatedImage is designed around a specific Android use case, so move it into the android folders. Make SkAnimatedImage hold an SkAndroidCodec (instead of an SkCodec). Expose fCodec so that SkAnimatedImage can animate by using the internal SkCodec. Update the sample to use SkAndroidCodec. Allow webp to decode a scaled down animation. For RestoreBG frames, adjust the frameRect (which is erased) to account for the scaling. Add a test to verify that we decode a webp with a RestoreBG frame successfully. Disable scaling for later frames in other formats (GIF, for now), since the code for erasing a RestoreBG frame is currently unaware of the sampling. Change-Id: I5dd2b86138f2c7f6adcd08dce1bd49040f7dc224 Reviewed-on: https://skia-review.googlesource.com/94621 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
* Add an SkDrawable for animated images (e.g. GIF)Gravatar Leon Scroggins III2018-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: b/63909536 SkAnimatedImage is a simple drawable for animating a GIF. Thread-safety is left up to the client. At most two bitmaps are stored in the drawable; one for the current frame and one for a frame that may need to be restored. The backup frame prevents some cases where we would otherwise have to re-decode from the beginning of the image. The API lets the client set the time value, and decodes to match that time. TODO: - Callback for when the animation is complete - Ability to use SkAndroidCodec - Modify the loop count (or leave that up to client?) - Better and/or client-specific caching Other changes: - Add a sample which animates a GIF - Reenable SK_CODEC_PRINTF for debug builds and Android Change-Id: I945ffbccdb6008f2a05ed4d9b2af869a261fb300 Reviewed-on: https://skia-review.googlesource.com/93420 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
* CCPR: Rename GrCCPR* -> GrCC*Gravatar Chris Dalton2018-01-08
| | | | | | | | | | | Also runs clang-format on the files that don't have special shader builder styling. Bug: skia: Change-Id: I4a67569a7c8472acfb9200644c913844a92e3b2d Reviewed-on: https://skia-review.googlesource.com/92083 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
* move largest apis into privateGravatar Mike Reed2018-01-08
| | | | | | | | | Related to https://skia-review.googlesource.com/c/skia/+/91860 Bug: skia: Change-Id: Ia8fd981b422bbab75541b078277d2e09e1fc9d41 Reviewed-on: https://skia-review.googlesource.com/91940 Reviewed-by: Brian Salomon <bsalomon@google.com>
* Reland "CCPR: Initial semi-optimized vertex shader Impl"Gravatar Chris Dalton2018-01-04
| | | | | | | | | | | | | | | | | | | | This is a reland of e3877ce5ceb7842b61d54bebcc51864e5787a2bc Original change's description: > CCPR: Initial semi-optimized vertex shader Impl > > TBR=bsalomon@google.com > > Bug: skia: > Change-Id: I24173e146d8c95cec5f29e8cb4fa5e2c28f9a33c > Reviewed-on: https://skia-review.googlesource.com/89120 > Reviewed-by: Chris Dalton <csmartdalton@google.com> > Commit-Queue: Chris Dalton <csmartdalton@google.com> Bug: skia: Change-Id: I1d194853540e64df9c7b55ceb388a5d2f32bc258 Reviewed-on: https://skia-review.googlesource.com/90963 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* [sksg] Fix paint invalGravatar Florin Malita2017-12-29
| | | | | | | | | | | Paint nodes contribute to invalidation. Hoist the inval logic from geometry nodes to draw nodes. TBR= Change-Id: Iab33086c377ef4940a84dae3cdccb2c9bdbee99c Reviewed-on: https://skia-review.googlesource.com/89901 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Fix leak in GM:RectanizerGravatar Florin Malita2017-12-24
| | | | | | | | | TBR= Change-Id: I0e6135ac7fac433a0539f00a45f569ce4f48aa7c Reviewed-on: https://skia-review.googlesource.com/89421 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Revert "CCPR: Initial semi-optimized vertex shader Impl"Gravatar Chris Dalton2017-12-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e3877ce5ceb7842b61d54bebcc51864e5787a2bc. Reason for revert: Intel crashing again Original change's description: > CCPR: Initial semi-optimized vertex shader Impl > > TBR=bsalomon@google.com > > Bug: skia: > Change-Id: I24173e146d8c95cec5f29e8cb4fa5e2c28f9a33c > Reviewed-on: https://skia-review.googlesource.com/89120 > Reviewed-by: Chris Dalton <csmartdalton@google.com> > Commit-Queue: Chris Dalton <csmartdalton@google.com> TBR=bsalomon@google.com,brianosman@google.com,csmartdalton@google.com Change-Id: I2485db30397958722a07c5992c748ab69365ebb6 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/89300 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* CCPR: Initial semi-optimized vertex shader ImplGravatar Chris Dalton2017-12-22
| | | | | | | | | | TBR=bsalomon@google.com Bug: skia: Change-Id: I24173e146d8c95cec5f29e8cb4fa5e2c28f9a33c Reviewed-on: https://skia-review.googlesource.com/89120 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* Initial scene graph (SkSG)Gravatar Florin Malita2017-12-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sketching a thin (as in close-to-skia-semantics) scene graph API, focused on external animation, inval tracking and minimal repaint. Only a few concrete classes/features so far: * Rect/Color/Transform/Group * basic inval tracking * a trivial animated sample with inval visualization Pretty much everything (especially naming) is volatile, so treat accordingly. The interesting bits to review are likely in Node.{h,cpp} for inval and SampleSGInval.cpp for usage. Initial class hierarchy: * Node: invalidation/ancestors tracking | -- * RenderNode: onRender(SkCanvas) | | | -- * Draw (concrete): rendering a [geometry, paint] tuple | | | -- * Group (concrete): grouping multiple RenderNodes | | | -- * EffectNode: single-descendant effect wrapper | | | -- * Transform (concrete): transform effect | -- * PaintNode: onMakePaint() | | | -- * Color (concrete): SkColor paint wrapper | -- * GeometryNode: onComputeBounds(), onDraw(SkCanvas, SkPaint) | -- * Rect (concrete): SkRect wrapper TBR= Change-Id: Iacf9b773c181a7582ecd31ee968562f179d1aa1b Reviewed-on: https://skia-review.googlesource.com/85502 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Revert "CCPR: Initial semi-optimized vertex shader Impl"Gravatar Brian Osman2017-12-20
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a8f6aef13d0592305e05baf19ee724f31a53b466. Reason for revert: Looks to failing on ANGLE bots Original change's description: > CCPR: Initial semi-optimized vertex shader Impl > > Bug: skia: > Change-Id: If22f47a3b945ce7336f8e609c2e0c911f09e1d18 > Reviewed-on: https://skia-review.googlesource.com/86820 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Chris Dalton <csmartdalton@google.com> TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com Change-Id: Ic5a73434cba4246a72790db2c27d06e7a50f389a No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/88220 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* CCPR: Initial semi-optimized vertex shader ImplGravatar Chris Dalton2017-12-20
| | | | | | | | Bug: skia: Change-Id: If22f47a3b945ce7336f8e609c2e0c911f09e1d18 Reviewed-on: https://skia-review.googlesource.com/86820 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* Revert "efficiently dash very large rectangles and very long lines"Gravatar Cary Clark2017-12-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1ad81981b0027e96ef0cecd78661ab2c22bdc4aa. Reason for revert: broke chrome layout tests Original change's description: > efficiently dash very large rectangles and very long lines > > Speed up dashing when lines and rects are absurdly large. > > Prior to this CL, only horizontal lines were detected. > > The onOnceBeforeDraw changes are there to make debugging easier. > > Also folded in a change to handle dashing of zero length lines. > > R=​reed@google.com, egdaniel@google.com > Bug: skia:7311 > Change-Id: Ia16fb124c7a78a5cc639e612fae29c879a37da1a > Reviewed-on: https://skia-review.googlesource.com/84862 > Commit-Queue: Cary Clark <caryclark@skia.org> > Reviewed-by: Mike Reed <reed@google.com> TBR=egdaniel@google.com,reed@google.com,caryclark@skia.org Change-Id: I5e8f04c54486f8cd1a931f6cade92feaaa4a7647 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7311 Reviewed-on: https://skia-review.googlesource.com/87282 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
* Fix alpha contribution to tonal color.Gravatar Jim Van Verth2017-12-19
| | | | | | | | | | | Also adds a tonal color GM, a grayscale mode to shadowutils GM, and animated alpha to SampleAndroidShadows. Bug: skia: Change-Id: I1dcb5cab7e53ffa7a3bf1a07b6ebfed38df1a9ed Reviewed-on: https://skia-review.googlesource.com/85002 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* efficiently dash very large rectangles and very long linesGravatar Cary Clark2017-12-19
| | | | | | | | | | | | | | | | | Speed up dashing when lines and rects are absurdly large. Prior to this CL, only horizontal lines were detected. The onOnceBeforeDraw changes are there to make debugging easier. Also folded in a change to handle dashing of zero length lines. R=reed@google.com, egdaniel@google.com Bug: skia:7311 Change-Id: Ia16fb124c7a78a5cc639e612fae29c879a37da1a Reviewed-on: https://skia-review.googlesource.com/84862 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Mike Reed <reed@google.com>
* CCPR: Don't use instanced draw calls with geometry shadersGravatar Chris Dalton2017-12-11
| | | | | | | | | | | | It isn't necessary for the vertex shader to know all the points because everything happens in the geometry shader. It's simpler to use regular vertex arrays instead. Bug: skia: Change-Id: I7bf83180476fbe0ab01492611cd72e72b3f7d4f2 Reviewed-on: https://skia-review.googlesource.com/82881 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* Fix SampleLua buildGravatar Florin Malita2017-12-11
| | | | | | | Change-Id: Ie0114ab16b99aed4343f6255dbc86fb15554ea74 Reviewed-on: https://skia-review.googlesource.com/83380 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Revert "Revert "resources: remove most uses of GetResourcePath()""Gravatar Mike Reed2017-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit cca230055921d2df8708ed6f9abcc2d43468dc7f. Reason for revert: think I guessed wrong about g32 -- unreverting Original change's description: > Revert "resources: remove most uses of GetResourcePath()" > > This reverts commit 5093a539def3ae09df324018f2343827009b2e05. > > Reason for revert: google3 seems broken > > Original change's description: > > resources: remove most uses of GetResourcePath() > > > > Going forward, we will standardize on GetResourceAsData(), which will > > make it easier to run tests in environments without access to the > > filesystem. > > > > Also: GetResourceAsData() complains when a resource is missing. > > This is usually an error. > > > > Change-Id: Iaf70b71b0ca5ed8cd1a5538a60ef185ae8736188 > > Reviewed-on: https://skia-review.googlesource.com/82642 > > Reviewed-by: Hal Canary <halcanary@google.com> > > Commit-Queue: Hal Canary <halcanary@google.com> > > TBR=halcanary@google.com,scroggo@google.com > > Change-Id: Ic5a7c0167c995a672e6b06dc92abe00564432214 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/83001 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> TBR=halcanary@google.com,scroggo@google.com,reed@google.com Change-Id: I5a46e4de61186a8a5eb9cacd3275e24e311d5a07 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/82942 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "resources: remove most uses of GetResourcePath()"Gravatar Mike Reed2017-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 5093a539def3ae09df324018f2343827009b2e05. Reason for revert: google3 seems broken Original change's description: > resources: remove most uses of GetResourcePath() > > Going forward, we will standardize on GetResourceAsData(), which will > make it easier to run tests in environments without access to the > filesystem. > > Also: GetResourceAsData() complains when a resource is missing. > This is usually an error. > > Change-Id: Iaf70b71b0ca5ed8cd1a5538a60ef185ae8736188 > Reviewed-on: https://skia-review.googlesource.com/82642 > Reviewed-by: Hal Canary <halcanary@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> TBR=halcanary@google.com,scroggo@google.com Change-Id: Ic5a7c0167c995a672e6b06dc92abe00564432214 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/83001 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* CCPR: Combine loops and serpentines back into a single shaderGravatar Chris Dalton2017-12-08
| | | | | | | | Bug: skia: Change-Id: I945471ccd2580a2d39afd9c80acb8d9e5e196435 Reviewed-on: https://skia-review.googlesource.com/82460 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* resources: resource identifiers don't begin with leading slashGravatar Hal Canary2017-12-08
| | | | | | | Change-Id: I52522ffffbf0f5176ac9156cd563b41d6fdde59f Reviewed-on: https://skia-review.googlesource.com/82940 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* resources: remove most uses of GetResourcePath()Gravatar Hal Canary2017-12-08
| | | | | | | | | | | | | | Going forward, we will standardize on GetResourceAsData(), which will make it easier to run tests in environments without access to the filesystem. Also: GetResourceAsData() complains when a resource is missing. This is usually an error. Change-Id: Iaf70b71b0ca5ed8cd1a5538a60ef185ae8736188 Reviewed-on: https://skia-review.googlesource.com/82642 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* resources: orgainize directory.Gravatar Hal Canary2017-12-08
| | | | | | | | | Should make it easier to ask just for images. Change-Id: If821743dc924c4bfbc6b2b2d29b14affde7b3afd Reviewed-on: https://skia-review.googlesource.com/82684 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* CCPR: Eliminate texel buffersGravatar Chris Dalton2017-12-05
| | | | | | | | | | | | | | | | | | Points cost 8 bytes and indices cost 4. If a point is accessed twice, it's a wash whether we duplicate it or index. This change eliminates texel buffers by duplicating points across instance arrays. This reduces our dependence on extensions as well as getting rid of our indirect memory access pattern in vertex shaders. As a result of this change, memory usage by GPU buffers will only be a fraction larger at worst, and slightly better at best. Bug: skia: Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SKNX_NO_SIMD Change-Id: I3c7f03772edd4f850d5fdd7b55552647335c1b52 Reviewed-on: https://skia-review.googlesource.com/79185 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* Add analytic clip FPs that read from the CCPR atlasGravatar Chris Dalton2017-12-05
| | | | | | | | Bug: skia:7190 Change-Id: Ie31d368f52910e6917efdeb1b024370b06fc11ee Reviewed-on: https://skia-review.googlesource.com/77160 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* turn on extended Clang warnings on Windows tooGravatar Chris Dalton2017-12-04
| | | | | | | | | | Plus some small rearrangements of the various warning lists. Change-Id: Ied58f940341d69ddab971a529fd01b1e96b65641 Reviewed-on: https://skia-review.googlesource.com/67720 Commit-Queue: Chris Dalton <csmartdalton@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Fix SVGPong slide crash in ViewerGravatar Florin Malita2017-12-03
| | | | | | | | | | SVGPong relies on onOnceBeforeDraw() to initialize, but when switching slides via Viewer's UI, onAnimate() is fired before the first paint. Change-Id: I7be133072ec635975f7463538cd42edb69696b3f Reviewed-on: https://skia-review.googlesource.com/79424 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
* Remove more views code, just to simplify thingsGravatar Brian Osman2017-12-01
| | | | | | | | Bug: skia: Change-Id: Ie31a3c764e4f88f2b08f4198bd253841a2d8c264 Reviewed-on: https://skia-review.googlesource.com/79100 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Delete even more unused views codeGravatar Brian Osman2017-11-29
| | | | | | | | Bug: skia: Change-Id: I41480aa89dfcd8cb7e016e477cbabe354f35ce8a Reviewed-on: https://skia-review.googlesource.com/75480 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Remove a huge pile of views codeGravatar Brian Osman2017-11-22
| | | | | | | | | | | | | All of this is dead when not using the old SkWindow framework. TBR=reed@google.com Bug: skia: Change-Id: I0f6ab18987a98469bfd367d5bc10967300dfd3ca Reviewed-on: https://skia-review.googlesource.com/75384 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Fix XferDemo by sending push button events directly to parentGravatar Brian Osman2017-11-22
| | | | | | | | Bug: skia: Change-Id: I3141dd34a9a04c7a660000cba9e483191f28ef03 Reviewed-on: https://skia-review.googlesource.com/75362 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Remove SampleApp and convert HelloWorld to sk_appGravatar Brian Osman2017-11-21
| | | | | | | | | | | | | There is still a large amount of views code that could be trimmed down, but which is used to implement samples (in viewer). Seemed simpler to remove some of this code in pieces. Bug: skia: Change-Id: Ia3415060d03c8de604a154e3dc38379b754daab6 Reviewed-on: https://skia-review.googlesource.com/72801 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Remove clutter from experimentalGravatar Brian Osman2017-11-21
| | | | | | | | | | | | | SkMatrix has the canonical version of setPolyToPoly, we don't need three other copies sitting around. SkBorder appears to be useless. Bug: skia: Change-Id: Ie747ff7af6cf1d03e6276e8d7fe57e9b3e4ad411 Reviewed-on: https://skia-review.googlesource.com/74141 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Revert "Use int when possible to calculate atlas indices in shaders."Gravatar Jim Van Verth2017-11-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 999ec57291dc7cf1d8e3a745627670e6cadc1c12. Reason for revert: Causing issues with NexusPlayer Vulkan. Original change's description: > Use int when possible to calculate atlas indices in shaders. > > On certain iOS devices half has a mantissa of only 10 bits, which is not > enough to perform the floating point trickery to get the lower bits > out of the "texture coordinates". Instead we use int if available, and > float if not available. > > Also re-enables multitexturing for iOS and adds a sample which > stresses the issue. > > Bug: skia:7285 > Change-Id: I365532c7cbbcca7c7753af209bef46e05be49e11 > Reviewed-on: https://skia-review.googlesource.com/71181 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Jim Van Verth <jvanverth@google.com> TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com Change-Id: I82801a73a2a8067588049b213f010ff25f4014f3 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7285 Reviewed-on: https://skia-review.googlesource.com/74001 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Enable tonal color for shadows by default.Gravatar Jim Van Verth2017-11-20
| | | | | | | | | | This change swaps the sense of the tonal color shadow flag, so tonal color will always be on unless explicitly disabled. Change-Id: I56ce4228022cf59b570cd7461327628cf7fe7173 Reviewed-on: https://skia-review.googlesource.com/73900 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Use int when possible to calculate atlas indices in shaders.Gravatar Jim Van Verth2017-11-20
| | | | | | | | | | | | | | | | On certain iOS devices half has a mantissa of only 10 bits, which is not enough to perform the floating point trickery to get the lower bits out of the "texture coordinates". Instead we use int if available, and float if not available. Also re-enables multitexturing for iOS and adds a sample which stresses the issue. Bug: skia:7285 Change-Id: I365532c7cbbcca7c7753af209bef46e05be49e11 Reviewed-on: https://skia-review.googlesource.com/71181 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
* Alloc glyph image correctly for SkMask::k3D_Format.Gravatar Ben Wagner2017-11-14
| | | | | | | | | | | | | | | | | | | | | | Re-enable the code to test the emboss mask filter, updating it to use the new emboss mask filter factory. Add a test to ensure that embossed text is drawn correctly, as before glyphs did not allocate the proper amount of memory for the k3D_Format which the emboss mask filter produces. Fixes SkEmbossMask::Emboss to write the whole of the mul and add planes to avoid pixel differences and MemorySanitizer errors. Update the GPU to understand the k3D_Format and use just the alpha plane, ignoring the mul and add plane which it currently cannot support. Change-Id: I90edf34a918c06b0c6b24bfc43ce7031419eca41 Reviewed-on: https://skia-review.googlesource.com/70260 Reviewed-on: https://skia-review.googlesource.com/70962 Reviewed-on: https://skia-review.googlesource.com/71282 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* Revert "Alloc glyph image correctly for SkMask::k3D_Format."Gravatar Brian Osman2017-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1662257bdaaaf26b016bf2a3e329c34f7f5ed581. Reason for revert: Android still using this API Original change's description: > Alloc glyph image correctly for SkMask::k3D_Format. > > Remove the no longer used outside Skia SK_SUPPORT_LEGACY_EMBOSSMASKFILTER > define, and either delete the code it guards or update it to use the new > emboss mask filter factory. > > Re-enable the code to test the emboss mask filter. > > Add a test to ensure that embossed text is drawn correctly, as before > glyphs did not allocate the proper amount of memory for the k3D_Format > which the emboss mask filter produces. > > Fixes SkEmbossMask::Emboss to write the whole of the mul and add planes > to avoid pixel differences and MemorySanitizer errors. > > Update the GPU to understand the k3D_Format and use just the alpha > plane, ignoring the mul and add plane which it currently cannot support. > > Change-Id: Icac1a3f37d6e8c6be3151df570f5e14111e18585 > Reviewed-on: https://skia-review.googlesource.com/70260 > Reviewed-by: Herb Derby <herb@google.com> > Reviewed-on: https://skia-review.googlesource.com/70962 > Commit-Queue: Ben Wagner <bungeman@google.com> TBR=djsollen@google.com,bungeman@google.com,herb@google.com Change-Id: Id6625bae8d3bd70ce7aa3045348c04fdd146c637 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/71183 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Alloc glyph image correctly for SkMask::k3D_Format.Gravatar Ben Wagner2017-11-14
| | | | | | | | | | | | | | | | | | | | | | | | Remove the no longer used outside Skia SK_SUPPORT_LEGACY_EMBOSSMASKFILTER define, and either delete the code it guards or update it to use the new emboss mask filter factory. Re-enable the code to test the emboss mask filter. Add a test to ensure that embossed text is drawn correctly, as before glyphs did not allocate the proper amount of memory for the k3D_Format which the emboss mask filter produces. Fixes SkEmbossMask::Emboss to write the whole of the mul and add planes to avoid pixel differences and MemorySanitizer errors. Update the GPU to understand the k3D_Format and use just the alpha plane, ignoring the mul and add plane which it currently cannot support. Change-Id: Icac1a3f37d6e8c6be3151df570f5e14111e18585 Reviewed-on: https://skia-review.googlesource.com/70260 Reviewed-by: Herb Derby <herb@google.com> Reviewed-on: https://skia-review.googlesource.com/70962 Commit-Queue: Ben Wagner <bungeman@google.com>
* Revert "Alloc glyph image correctly for SkMask::k3D_Format."Gravatar Ben Wagner2017-11-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6b26deb8d6067589ce9b7853ab8e8d39de1a45de. Reason for revert: GPU bots failing Original change's description: > Alloc glyph image correctly for SkMask::k3D_Format. > > This removes the no longer used outside Skia > SK_SUPPORT_LEGACY_EMBOSSMASKFILTER define, and either deletes the code > it guards or updates it to use the new emboss mask filter factory. This > re-enables the code to test the emboss mask filter. Also added is a test > to ensure that embossed text is drawn correctly, as before this glyphs > did not allocate the proper amount of memory for the k3D_Format which > this mask filter produces. This also fixes SkEmbossMask::Emboss to write > the whole of the mul and add planes to avoid pixel differences and > MemorySanitizer errors. > > Change-Id: Ib492c72a19d6a27d140e3cd48179a3ca9ce313f5 > Reviewed-on: https://skia-review.googlesource.com/70260 > Commit-Queue: Ben Wagner <bungeman@google.com> > Reviewed-by: Herb Derby <herb@google.com> TBR=djsollen@google.com,bungeman@google.com,herb@google.com,reed@google.com Change-Id: I8a9db6c00e0cb84bdd4833474a9ffffa6ecc606c No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/70920 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* Alloc glyph image correctly for SkMask::k3D_Format.Gravatar Ben Wagner2017-11-13
| | | | | | | | | | | | | | | | | This removes the no longer used outside Skia SK_SUPPORT_LEGACY_EMBOSSMASKFILTER define, and either deletes the code it guards or updates it to use the new emboss mask filter factory. This re-enables the code to test the emboss mask filter. Also added is a test to ensure that embossed text is drawn correctly, as before this glyphs did not allocate the proper amount of memory for the k3D_Format which this mask filter produces. This also fixes SkEmbossMask::Emboss to write the whole of the mul and add planes to avoid pixel differences and MemorySanitizer errors. Change-Id: Ib492c72a19d6a27d140e3cd48179a3ca9ce313f5 Reviewed-on: https://skia-review.googlesource.com/70260 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Herb Derby <herb@google.com>
* move parts of SkPoint to SkPointPrivGravatar Cary Clark2017-11-08
| | | | | | | | | | | | Move specialized SkPoint methods to SkPointPriv. Use constexpr and inline initialization where possible. R=reed@google.com,bsalomon@google.com Bug: skia: 6898 Change-Id: I01ec5186f010f2dc80c068c70d9cc352f3221338 Reviewed-on: https://skia-review.googlesource.com/68700 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ravi Mistry <rmistry@google.com>
* Add clipping options to path text bench and samplesGravatar Chris Dalton2017-11-07
| | | | | | | | Bug: skia: Change-Id: I632a2fa5627ef1438d9ab451318a42d12c61b802 Reviewed-on: https://skia-review.googlesource.com/67683 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* clean up cruft about --portableFonts and --resourceFontsGravatar Mike Klein2017-11-06
| | | | | | | | | | --portableFonts exists but does nothing. --resourceFonts doesn't even exist. Change-Id: I7880208de4aaa9674ba720b9e70c34c145561ac0 Reviewed-on: https://skia-review.googlesource.com/67800 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* -= to control width of fatbits line widthGravatar Mike Reed2017-11-02
| | | | | | | | Bug: skia: Change-Id: Id100ac5c22f5cc878d782d53557c6b37370a2989 Reviewed-on: https://skia-review.googlesource.com/66621 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Convert geometry shaders to operate in Skia device spaceGravatar Chris Dalton2017-10-25
| | | | | | | | | | | | | Defers the transformation to normalized window coordinates until after the geometry shader. Merges vertex and a geometry shader builders into a single compilation unit with a common base class. Updates CCPR geometry shaders accordingly. Bug: skia: Change-Id: If93c90e978b1fdc7120febd05cfb05810fd496b5 Reviewed-on: https://skia-review.googlesource.com/62980 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* Print measure info before closeWindowGravatar Yuqian Li2017-10-23
| | | | | | | | | | | The closeWindow function does not guarantee the calling of ~SampleWindow (in Windows and Mac). So we print the info earlier. Bug: skia: Change-Id: Ib8b11cac4fb2fc7b62a02c7fb7f3aaaa48df2da6 Reviewed-on: https://skia-review.googlesource.com/63140 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Yuqian Li <liyuqian@google.com>
* SampleAAGeometry tweaksGravatar Chris Dalton2017-10-20
| | | | | | | | | | | | - Use capital letters avoid conflict with built-in commands, particularly zoom-window ('z') and toggle-backend ('d'). - Increase kHitToleranace for touch screens. Bug: skia: Change-Id: I6feaabd8aa06600bdeb4623ab081d973369c4841 Reviewed-on: https://skia-review.googlesource.com/52528 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
* Add a SampleApp flag to automate keystrokes on startupGravatar Chris Dalton2017-10-18
| | | | | | | | | | | | | This is a quick-and-dirty solution to select color mode, backend, etc. from the command line. e.g. 'out/Debug/SampleApp --keys CCd' for opengl and srgb Bug: skia: Change-Id: I61f9e0fd4209a5fadb585c02c71984398f2f0860 Reviewed-on: https://skia-review.googlesource.com/61482 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
* Remove redundant parentheses.Gravatar Ben Wagner2017-10-17
| | | | | | | | | | | | | | | | Recent clang versions produce output like ../../samplecode/SampleAll.cpp:306:27: error: redundant parentheses surrounding declarator [-Werror,-Wredundant-parens] Remove these to clean up the code a bit. Change-Id: Ib099201f23f83cd712487c238b6a508290e667a7 Reviewed-on: https://skia-review.googlesource.com/60822 Commit-Queue: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>