aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
Commit message (Collapse)AuthorAge
* BUG=skia:Gravatar joshualitt2015-04-03
| | | | Review URL: https://codereview.chromium.org/1031423002
* Get rid of leaks in SkCodec::NewFromStream.Gravatar scroggo2015-04-03
| | | | | | | | | | | | | | | | | | | | SkCodec::NewFromStream claims to delete the passed in SkStream on failure. This allows the caller to pass an SkStream to the function and not worry about deleting it depending on the return value. Most of our SkCodecs did not honor this contract though. Update them to delete the stream on failure. Further, update SkCodec::NewFromStream to delete the stream if it did not match any subclass, and delete the SkCodec if we decided to return NULL because it was too big. Add a test which tests streams which represent the beginnings of supported format types but do not contain enough data to create an SkCodec. The interesting part of the test is when we run it on ASAN, which will report that we leaked something without the other changes. BUG=skia:3257 Review URL: https://codereview.chromium.org/1058873006
* New names for SkPMFloat methods.Gravatar mtklein2015-04-03
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1055123002
* Use switch operator[](int) to kth<int>() so we can use vget_lane.Gravatar mtklein2015-04-03
| | | | | | | | | #floats BUG=skia: BUG=skia:3592 Review URL: https://codereview.chromium.org/1059743002
* Exclusion and Difference modes using Sk4fGravatar reed2015-04-02
| | | | | | | | | | | | | | Before: 7M 1 15.3ms 15.5ms 15.8ms 17.2ms 4% ▁█▄▁▇▂▁▁▂▁ 8888 Xfermode_Exclusion 7M 1 16.5ms 17.1ms 17.3ms 18.8ms 5% ▁█▃█▃▂▂▃▂▂ 8888 Xfermode_Difference After: 7M 1 9.06ms 9.34ms 9.42ms 10.4ms 4% ▁▁▅▄█▁▂▁▂▃ 8888 Xfermode_Exclusion 7M 1 10.5ms 10.9ms 11ms 12ms 5% ▃▁▆█▂▁▅▂▁▃ 8888 Xfermode_Difference TBR=mtklein@google.com Review URL: https://codereview.chromium.org/1060493002
* impl Multiply mode using Sk4fGravatar reed2015-04-02
| | | | | | | | | | | | Before: 7M 1 14.4ms 14.8ms 15.4ms 17.5ms 7% ▆█▅▅▂▁▁▁▂▁ 8888 Xfermode_Multiply After: 7M 1 12ms 12.1ms 12.5ms 14.1ms 6% ▃█▇▂▁▂▁▁▂▁ 8888 Xfermode_Multiply TBR=mtklein@google.com Review URL: https://codereview.chromium.org/1056003002
* Add a method to read a stream without advancing it.Gravatar scroggo2015-04-02
| | | | | | | | | | | | | | | | | | | | | Add a virtual method on SkStream which will do a "peek" some bytes, so that those bytes are read, but the next call to read will be unaffected. Implement peek for SkMemoryStream, where the implementation is simple and obvious. Implement peek on SkFrontBufferedStream. Add tests. Motivated by decoding streams which cannot be rewound. TBR=reed@google.com BUG=skia:3257 Review URL: https://codereview.chromium.org/1044953002
* experimental speedup some xfermodes with Sk4fGravatar reed2015-04-02
| | | | | | | | | | | | | | | | | | | | | | Old: 7M 1 11.1ms 11.3ms 11.3ms 11.6ms 1% ▅▄▂▂▁▁▄▄█▇ 8888 Xfermode_Screen 7M 1 10.7ms 10.9ms 10.9ms 11.1ms 1% ▄▄▄▇▃▁█▄▂▅ 8888 Xfermode_Modulate 7M 1 7.86ms 8.03ms 8ms 8.18ms 1% █▇▅▁▃▃▂▃▆▅ 8888 Xfermode_Plus 7M 1 14.6ms 14.8ms 14.8ms 15.1ms 1% ▄█▆▅▄▁▁▆▄▆ 8888 Xfermode_Xor 7M 1 13ms 13.5ms 13.4ms 13.8ms 2% ▅▃▇▁█▂▃▅▃▅ 8888 Xfermode_DstATop 7M 1 13.1ms 13.4ms 13.3ms 13.6ms 1% ▄▁▁▆▅▄▇▆█▂ 8888 Xfermode_SrcATop New: 7M 1 6.99ms 7.19ms 7.4ms 8.98ms 8% ▁▂▁▃▂█▁▂▂▂ 8888 Xfermode_Screen 7M 1 5.27ms 5.46ms 5.46ms 5.89ms 3% ▁▁▅▁▂█▄▃▄▃ 8888 Xfermode_Modulate 7M 1 6.8ms 7.04ms 7.27ms 8.53ms 8% ▂▁█▁▁▂▂▂▂▇ 8888 Xfermode_Plus 7M 1 9ms 9.2ms 9.33ms 10.5ms 5% ▁█▃▁▂▁▁▁▅▂ 8888 Xfermode_Xor 7M 1 8.34ms 8.57ms 8.73ms 10.6ms 8% ▁▁▁▂▂▂▂▂▂█ 8888 Xfermode_DstATop 7M 1 8.38ms 8.62ms 8.91ms 10.3ms 8% ▁▃▁▂▇▂▁▂▁█ 8888 Xfermode_SrcATop Need to define SK_SUPPORT_LEGACY_SCALAR_XFERMODES in chrome to suppress change (see https://codereview.chromium.org/1054083002/) Review URL: https://codereview.chromium.org/1043413002
* I suspect S32A_D565_Opaque_neon for Daisy problems.Gravatar Mike Klein2015-04-02
| | | | | | | | | | | I don't see any color-order handling logic in the 32-bit code. BUG=skia:1843 CQ_EXCLUDE_TRYBOTS=client.skia.compile:Build-Win-MSVC-x86-Debug-Trybot,Build-Win-MSVC-x86_64-Debug-Trybot R=mtklein@google.com Review URL: https://codereview.chromium.org/1051683003
* Remove all code related to NaClGravatar borenet2015-04-02
| | | | | | | BUG=skia:3600 DOCS_PREVIEW= https://skia.org/?cl=1036283002 Review URL: https://codereview.chromium.org/1036283002
* SkPMFloat: fewer internal this->isValid() assertions.Gravatar mtklein2015-04-02
| | | | | | | | | | | | | Each of these conversion functions now only asserts is output is valid. For SkPMColor -> SkPMFloat, we assert isValid(). For SkPMFloat -> SkPMColor, we SkPMColorAssert. #floats BUG=skia: BUG=skia:3592 Review URL: https://codereview.chromium.org/1055093002
* Add constant color GrFP.Gravatar bsalomon2015-04-02
| | | | | | Committed: https://skia.googlesource.com/skia/+/dfbbec436cbcacc3270d4b28357c8393e67d6494 Review URL: https://codereview.chromium.org/978713002
* Rename GrBitmapTextContextB to GrAtlasTextContextGravatar joshualitt2015-04-02
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1050173002
* Revert of Add constant color GrFP. (patchset #10 id:180001 of ↵Gravatar bsalomon2015-04-02
| | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/978713002/) Reason for revert: Revert while investigating assertions. Original issue's description: > Add constant color GrFP. > > Committed: https://skia.googlesource.com/skia/+/dfbbec436cbcacc3270d4b28357c8393e67d6494 TBR=egdaniel@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1055023002
* Implement approx-match support in image filter saveLayer() offscreen.Gravatar senorblanco2015-04-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the GPU-side image filter implementation creates exact-match textures for the offscreen backing stores for saveLayer(). This is because several filters have GPU implementations which depend on the texture coordinates being 0..1. The fix is three-fold: 1) Store the actual requested size in the SkGpuDevice, so that when wrapping it in an SkBitmap for passing to filterImage(), we can give it the original size. 2) Fix the filters (SkMagnifierImageFilter, SkLightingImageFilter, SkMatrixConvolutionImageFilter, SkMatrixImageFilter) whose GPU implementation depends on 0..1 texture coordinates. 3) Remove the exception for GPU-side image filters in SkCanvas::internalSaveLayer(). For the lighting filters, there were two bugs which were cancelling each other out: the sobel filter matrix was being computed upside down, but then we'd negate the resulting normal. This worked fine in the exact-match case, but in the approx-match case we'd sample garbage along the edge pixels. Also, we never implemented the edge pixels according to spec in the GPU case. It requires a different fragment shader for each edge of the nine-patch, which meant we couldn't use asFragmentProcessor(), and had to implement the drawing via a filterImageGPU() override. In order to avoid polluting the public API, I inserted a new base class, SkLightingImageFilterInternal above Sk[Diffuse|Specular]LightingImageFilter to handle the implementation. For the SkMatrixConvolutionImageFilter, it seems the GLSL clamp() function occasionally returns values outside the clamped range, resulting in access of garbage texels even in GL_NEAREST. The fix here is to clamp to a rect inset by half a texel. There was also a bug in the unpremultiply step when fConvolveAlpha is false. For SkMatrixImageFilter, the fix was to make the generic draw path be more careful about when to use texture domain. If the bitmap already has a texture, use texture domain if the srcRect is smaller than the entire texture (not the entire bitmap). N.B.: this change will cause some minor pixel diffs in the GPU results of the following GMs (and possibly more): matriximagefilter, matrixconvolution, imagefiltersscaled, lighting, imagemagnifier, filterfastbounds, complexclip_aa_Layer_invert, complexclip_aa_layer, complexclip_bw_layer_invert, complexclip_bw_layer. BUG=skia:3532 Committed: https://skia.googlesource.com/skia/+/b97dafefe63ea0a1bbce8e8b209f4920983fb8b9 Committed: https://skia.googlesource.com/skia/+/f5f8518fe0bbd2703e4ffc1b11ad7b4312ff7641 Committed: https://skia.googlesource.com/skia/+/46112cf2a7c7307f1c9eebb5f881cbda15aa460c Review URL: https://codereview.chromium.org/1034733002
* [SkDebugger] Flatten drawPicture opsGravatar fmalita2015-04-01
| | | | | | | Add two drawPicture bracketing ops (BeginDrawPicture, EndDrawPicture) to replace the current DrawPicture op, and flatten picture contents. Review URL: https://codereview.chromium.org/1048383002
* Revert of Implement approx-match support in image filter saveLayer() ↵Gravatar rmistry2015-04-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | offscreen. (patchset #31 id:590001 of https://codereview.chromium.org/1034733002/) Reason for revert: Spoke to Stephen about this. Reverting because failing debug builds: https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Mac10.9-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug/builds/51 https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-ShuttleA-GPU-GTX660-x86_64-Debug/builds/54 Original issue's description: > Implement approx-match support in image filter saveLayer() offscreen. > > Currently, the GPU-side image filter implementation creates > exact-match textures for the offscreen backing stores for > saveLayer(). This is because several filters have GPU > implementations which depend on the texture coordinates > being 0..1. > > The fix is three-fold: > > 1) Store the actual requested size in the SkGpuDevice, so > that when wrapping it in an SkBitmap for passing to > filterImage(), we can give it the original size. > 2) Fix the filters (SkMagnifierImageFilter, > SkLightingImageFilter, SkMatrixConvolutionImageFilter, > SkMatrixImageFilter) whose GPU implementation depends on > 0..1 texture coordinates. > 3) Remove the exception for GPU-side image filters in > SkCanvas::internalSaveLayer(). > > For the lighting filters, there were two bugs which were > cancelling each other out: the sobel filter matrix was > being computed upside down, but then we'd negate the > resulting normal. This worked fine in the exact-match case, > but in the approx-match case we'd sample garbage along > the edge pixels. Also, we never implemented the edge pixels > according to spec in the GPU case. It requires a > different fragment shader for each edge of the nine-patch, > which meant we couldn't use asFragmentProcessor(), and had > to implement the drawing via a filterImageGPU() override. > In order to avoid polluting the public API, I inserted a > new base class, SkLightingImageFilterInternal above > Sk[Diffuse|Specular]LightingImageFilter to handle the > implementation. > > For the SkMatrixConvolutionImageFilter, it seems the > GLSL clamp() function occasionally returns values outside > the clamped range, resulting in access of garbage > texels even in GL_NEAREST. The fix here is to clamp to a > rect inset by half a texel. There was also a bug in > the unpremultiply step when fConvolveAlpha is false. > > For SkMatrixImageFilter, the fix was to make the generic > draw path be more careful about when to use texture domain. > If the bitmap already has a texture, use texture domain > if the srcRect is smaller than the entire texture (not > the entire bitmap). > > N.B.: this change will cause some minor pixel diffs in the > GPU results of the following GMs (and possibly more): > matriximagefilter, matrixconvolution, imagefiltersscaled, > lighting, imagemagnifier, filterfastbounds, > complexclip_aa_Layer_invert, complexclip_aa_layer, > complexclip_bw_layer_invert, complexclip_bw_layer. > > BUG=skia:3532 > > Committed: https://skia.googlesource.com/skia/+/b97dafefe63ea0a1bbce8e8b209f4920983fb8b9 > > Committed: https://skia.googlesource.com/skia/+/f5f8518fe0bbd2703e4ffc1b11ad7b4312ff7641 > > Committed: https://skia.googlesource.com/skia/+/46112cf2a7c7307f1c9eebb5f881cbda15aa460c TBR=bsalomon@google.com,reed@chromium.org,senorblanco@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:3532 Review URL: https://codereview.chromium.org/1057693002
* Revert of Fix GLSL error on Android. (patchset #2 id:20001 of ↵Gravatar rmistry2015-04-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1053873002/) Reason for revert: Spoke to Stephan about this. Reverting because failing debug builds: https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Mac10.9-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug/builds/51 https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Ubuntu-GCC-ShuttleA-GPU-GTX660-x86_64-Debug/builds/54 Original issue's description: > Fix GLSL error on Android. > > BUG=skia: > TBR=bsalomon > NOTREECHECKS=true > NOTRY=true > > Committed: https://skia.googlesource.com/skia/+/f90cd8e0e39af02c3826c80366efa3c06e88f642 TBR=bsalomon@google.com,senorblanco@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1056713002
* Fix GLSL error on Android.Gravatar senorblanco2015-04-01
| | | | | | | | | BUG=skia: TBR=bsalomon NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1053873002
* Add constant color GrFP.Gravatar bsalomon2015-04-01
| | | | Review URL: https://codereview.chromium.org/978713002
* Implement approx-match support in image filter saveLayer() offscreen.Gravatar senorblanco2015-04-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the GPU-side image filter implementation creates exact-match textures for the offscreen backing stores for saveLayer(). This is because several filters have GPU implementations which depend on the texture coordinates being 0..1. The fix is three-fold: 1) Store the actual requested size in the SkGpuDevice, so that when wrapping it in an SkBitmap for passing to filterImage(), we can give it the original size. 2) Fix the filters (SkMagnifierImageFilter, SkLightingImageFilter, SkMatrixConvolutionImageFilter, SkMatrixImageFilter) whose GPU implementation depends on 0..1 texture coordinates. 3) Remove the exception for GPU-side image filters in SkCanvas::internalSaveLayer(). For the lighting filters, there were two bugs which were cancelling each other out: the sobel filter matrix was being computed upside down, but then we'd negate the resulting normal. This worked fine in the exact-match case, but in the approx-match case we'd sample garbage along the edge pixels. Also, we never implemented the edge pixels according to spec in the GPU case. It requires a different fragment shader for each edge of the nine-patch, which meant we couldn't use asFragmentProcessor(), and had to implement the drawing via a filterImageGPU() override. In order to avoid polluting the public API, I inserted a new base class, SkLightingImageFilterInternal above Sk[Diffuse|Specular]LightingImageFilter to handle the implementation. For the SkMatrixConvolutionImageFilter, it seems the GLSL clamp() function occasionally returns values outside the clamped range, resulting in access of garbage texels even in GL_NEAREST. The fix here is to clamp to a rect inset by half a texel. There was also a bug in the unpremultiply step when fConvolveAlpha is false. For SkMatrixImageFilter, the fix was to make the generic draw path be more careful about when to use texture domain. If the bitmap already has a texture, use texture domain if the srcRect is smaller than the entire texture (not the entire bitmap). N.B.: this change will cause some minor pixel diffs in the GPU results of the following GMs (and possibly more): matriximagefilter, matrixconvolution, imagefiltersscaled, lighting, imagemagnifier, filterfastbounds, complexclip_aa_Layer_invert, complexclip_aa_layer, complexclip_bw_layer_invert, complexclip_bw_layer. BUG=skia:3532 Committed: https://skia.googlesource.com/skia/+/b97dafefe63ea0a1bbce8e8b209f4920983fb8b9 Committed: https://skia.googlesource.com/skia/+/f5f8518fe0bbd2703e4ffc1b11ad7b4312ff7641 Review URL: https://codereview.chromium.org/1034733002
* SkPDF: SkPDFGraphicState Lookup hashtabledGravatar halcanary2015-04-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Release, running `dm --src skp --config pdf`, I get a speedup of about 1.2%. SkPDFGraphicState class: - Holds the subset of SkPaint that maps to a PDF Graphics State - These fields are easily comparable, making hashtable comparisons easy. SkPDFCanon: - findGraphicState() takes a SkPDFGraphicState, not a SkPaint - fGraphicStateRecords is a SkHashSet, not a SkTDArray SkPDFGraphicState: - mode_for_pdf() replaces logic inside equivalent(), but is only called once per lookup. - emitObject() no longer modifies the SkPDFGraphicState to cache the SkPDFDict stucture. (Since it is de-duped, this get no speedup). - Static Functions that don't use the canon return a plain SkPDFDict now. No need for fPopulated. SkTHash.h - SkHashSet::forall added SkPDFDevice; SkPDFShader - Updated for new SkPDFGraphicState interface. BUG=skia:3585 Review URL: https://codereview.chromium.org/1046293002
* Implicit constructors for SkFunction are much more readable.Gravatar mtklein2015-04-01
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1052663004
* Emulate distance field gamma fix by making glyphs thicker or thinnerGravatar jvanverth2015-04-01
| | | | | | | | | | | | The idea here is that we determine the 0.5 crossover for each row in the gamma table, then invert the mapping to determine which point that maps to in the original range [-.65, .65]. That gives us a change in the apparent width of the glyph that closely corresponds to the change produced by the gamma fix. BUG=skia:2933 Review URL: https://codereview.chromium.org/1042373002
* move Atlas Text Context to its own fileGravatar joshualitt2015-04-01
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1045723010
* Switch to one single bitmap text blob cache allocationGravatar joshualitt2015-04-01
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1041953002
* Constructor and call argument forwarding for SkFunction.Gravatar mtklein2015-04-01
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1050113003
* SkCodec::onGetScanlineDecoder must call rewind.Gravatar scroggo2015-04-01
| | | | | | | | | | | | | | | | | | | | This mirrors the behavior in onGetPixels, and allows the implementation to share code for handling calls to rewindIfNeeded. This also fixes a bug where getScanlineDecoder was calling rewindIfNeeded and treating the result as a bool. In SkPngCodec, factor out the code to call rewindIfNeeded, and call it in both onGetPixels and onGetScanlineDecoder. Update the test to include testing the scanline decoder. Rename "gen" to "codec" now that it must be an SkCodec. BUG=skia:3257 Depends on https://codereview.chromium.org/1048423003/ (DIFFERENT ISSUE). Review URL: https://codereview.chromium.org/1050893002
* Add SkTHashSet::find()Gravatar mtklein2015-04-01
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1058553002
* Revert of Enable both static and dynamically linked libpng (patchset #4 ↵Gravatar djsollen2015-04-01
| | | | | | | | | | | | | | | | | | | | | | | id:60001 of https://codereview.chromium.org/1032253003/) Reason for revert: breaking the nexus_9 and ios builds. Original issue's description: > Enable both static and dynamically linked libpng > > All platforms except android are configured to use the statically linked copy of libpng. Android uses the system provided dynamic copy for SkImageDecoder and the static copy for SkCodec. The exception being android framework builds that currently use the dynamic copy everywhere. > > This CL also enables NEON optimizations for libpng. > > Committed: https://skia.googlesource.com/skia/+/2469c999518e7b0063d35e9e2eb074a0477c21ac TBR=scroggo@google.com,msarett@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1050183002
* Enable both static and dynamically linked libpngGravatar djsollen2015-04-01
| | | | | | | | All platforms except android are configured to use the statically linked copy of libpng. Android uses the system provided dynamic copy for SkImageDecoder and the static copy for SkCodec. The exception being android framework builds that currently use the dynamic copy everywhere. This CL also enables NEON optimizations for libpng. Review URL: https://codereview.chromium.org/1032253003
* Make SkPngCodec support rewinding properly.Gravatar scroggo2015-04-01
| | | | | | | | | | | | | | Separate out the code for reading the header, and use it to reinitialize fPng_ptr and fInfo_ptr after a rewind. Use common code to clean up fPng_ptr and fInfo_ptr, and set them to NULL and treat them as NULL as appropriate. Update the test to expect SkPngCodec to succeed. BUG=skia:3257 Review URL: https://codereview.chromium.org/1048423003
* small-object optimization for SkFunctionGravatar mtklein2015-04-01
| | | | | | | | Anything <= sizeof(void*) will be inlined, avoiding heap allocation. BUG=skia: Review URL: https://codereview.chromium.org/1048243002
* Handle rewinds in SkBmpCodec.Gravatar scroggo2015-04-01
| | | | | | | | Factor our BMP code for reading the header, and call it after a rewind. BUG=skia:3257 Review URL: https://codereview.chromium.org/1057483003
* Creating a new wrapper for gif decoderGravatar msarett2015-04-01
| | | | | | | BUG=skia:3257 BUG=skia:3534 Review URL: https://codereview.chromium.org/1022673011
* GrGLInterface: Add support for NV_framebuffer_mixed_samplesGravatar vbuzinov2015-04-01
| | | | | | | | | Import glCoverageModulation if NV_framebuffer_mixed samples is available BUG=skia:3177 Review URL: https://codereview.chromium.org/993363002
* Revert of Implement approx-match support in image filter saveLayer() ↵Gravatar rmistry2015-04-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | offscreen. (patchset #27 id:510001 of https://codereview.chromium.org/1034733002/) Reason for revert: Looks like this change is causing layout test failures which is blocking Skia's DEPS roll into Chromium: https://codereview.chromium.org/1050563002/ https://codereview.chromium.org/1043133005/ https://codereview.chromium.org/1048273002/ Reverting to see if this fixes the DEPS roll. Original issue's description: > Implement approx-match support in image filter saveLayer() offscreen. > > Currently, the GPU-side image filter implementation creates > exact-match textures for the offscreen backing stores for > saveLayer(). This is because several filters have GPU > implementations which depend on the texture coordinates > being 0..1. > > The fix is three-fold: > > 1) Store the actual requested size in the SkGpuDevice, so > that when wrapping it in an SkBitmap for passing to > filterImage(), we can give it the original size. > 2) Fix the filters (SkMagnifierImageFilter, > SkLightingImageFilter) whose GPU implementation depends on > 0..1 texture coordinates. > 3) Remove the exception for GPU-side image filters in > SkCanvas::internalSaveLayer(). > > For the lighting filters, there were two bugs which were > cancelling each other out: the sobel filter matrix was > being computed upside down, but then we'd negate the > resulting normal. This worked fine in the exact-match case, > but in the approx-match case we'd sample garbage along > the edge pixels. Also, we never implemented the edge pixels > according to spec in the GPU case. It requires a > different fragment shader for each edge of the nine-patch, > which meant we couldn't use asFragmentProcessor(), and had > to implement the drawing via a filterImageGPU() override. > In order to avoid polluting the public API, I inserted a > new base class, SkLightingImageFilterInternal above > Sk[Diffuse|Specular]LightingImageFilter to handle the > implementation. > > N.B.: this change will cause some minor pixel diffs in the > GPU results of the following GMs (and possibly more): > matriximagefilter, matrixconvolution, imagefiltersscaled, > lighting, imagemagnifier, filterfastbounds, > complexclip_aa_Layer_invert, complexclip_aa_layer, > complexclip_bw_layer_invert, complexclip_bw_layer. > > BUG=skia:3532 > > Committed: https://skia.googlesource.com/skia/+/b97dafefe63ea0a1bbce8e8b209f4920983fb8b9 > > Committed: https://skia.googlesource.com/skia/+/f5f8518fe0bbd2703e4ffc1b11ad7b4312ff7641 TBR=bsalomon@google.com,reed@chromium.org,senorblanco@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:3532 Review URL: https://codereview.chromium.org/1057443003
* Sketch SkFunctionGravatar mtklein2015-03-31
| | | | | | | | | | Let's start with baby steps in case some bot can't handle this. I have left many TODOs, most of which I know how to do if this looks feasible and useful. BUG=skia: Review URL: https://codereview.chromium.org/1049223003
* BitmapTextBatch and BitmapTextBlobGravatar joshualitt2015-03-31
| | | | | | | | BUG=skia: Committed: https://skia.googlesource.com/skia/+/eed1dae04932483579b02c10f0706127d3f5d984 Review URL: https://codereview.chromium.org/1011403004
* SkPDF: style nitGravatar halcanary2015-03-31
| | | | | | TBR=mtklein@google.com Review URL: https://codereview.chromium.org/1039313004
* SkPDF: Factor SkPDFCatalog into SkPDFObjNumMap and SkPDFSubstituteMapGravatar halcanary2015-03-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: Keep separate features separate. Also, future linearization work will need to have several objNumMap objects share a substituteMap. Also "catalog" has a specific meaning in PDF. This catalog did not map to that catalog. - Modify SkPDFObject::emitObject and SkPDFObject::addResources interface to requiore SkPDFObjNumMap and SkPDFSubstituteMap. - SkPDFObjNumMap const in SkPDFObject::emitObject. - Remove SkPDFCatalog.cpp/.h - Modify SkDocument_PDF.cpp to use new functions - Fold in SkPDFStream::populate - Fold in SkPDFBitmap::emitDict - Move SkPDFObjNumMap and SkPDFSubstituteMap to SkPDFTypes.h - Note (via assert) that SkPDFArray & SkPDFDict don't need to check substitutes. - Remove extra space from SkPDFDict serialization. - SkPDFBitmap SkPDFType0Font SkPDFGraphicState SkPDFStream updated to new interface. - PDFPrimitivesTest updated for new interface. BUG=skia:3585 Review URL: https://codereview.chromium.org/1049753002
* skia: Fix text subpixel half sample default for GPU rasterizationGravatar hendrikw2015-03-31
| | | | | | | | | | | | In software, SkDraw1Glyph::Proc SkDraw1Glyph::init initializes fHalfSampleX, fHalfSampleY to SkGlyph::kSubpixelRound. In hardware, however, these values were initialized to zero. Fix, match software's implementation BUG=471919 Review URL: https://codereview.chromium.org/1047803004
* Revert of BitmapTextBatch and BitmapTextBlob (patchset #18 id:360001 of ↵Gravatar joshualitt2015-03-31
| | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1011403004/) Reason for revert: Breaks a unit test on mac Original issue's description: > BitmapTextBatch and BitmapTextBlob > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/eed1dae04932483579b02c10f0706127d3f5d984 TBR=fmalita@chromium.org,reed@google.com,jvanverth@google.com,robertphillips@google.com,bsalomon@google.com,jvanverth@chromium.org,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1050633002
* BitmapTextBatch and BitmapTextBlobGravatar joshualitt2015-03-31
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1011403004
* Implement approx-match support in image filter saveLayer() offscreen.Gravatar senorblanco2015-03-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the GPU-side image filter implementation creates exact-match textures for the offscreen backing stores for saveLayer(). This is because several filters have GPU implementations which depend on the texture coordinates being 0..1. The fix is three-fold: 1) Store the actual requested size in the SkGpuDevice, so that when wrapping it in an SkBitmap for passing to filterImage(), we can give it the original size. 2) Fix the filters (SkMagnifierImageFilter, SkLightingImageFilter) whose GPU implementation depends on 0..1 texture coordinates. 3) Remove the exception for GPU-side image filters in SkCanvas::internalSaveLayer(). For the lighting filters, there were two bugs which were cancelling each other out: the sobel filter matrix was being computed upside down, but then we'd negate the resulting normal. This worked fine in the exact-match case, but in the approx-match case we'd sample garbage along the edge pixels. Also, we never implemented the edge pixels according to spec in the GPU case. It requires a different fragment shader for each edge of the nine-patch, which meant we couldn't use asFragmentProcessor(), and had to implement the drawing via a filterImageGPU() override. In order to avoid polluting the public API, I inserted a new base class, SkLightingImageFilterInternal above Sk[Diffuse|Specular]LightingImageFilter to handle the implementation. N.B.: this change will cause some minor pixel diffs in the GPU results of the following GMs (and possibly more): matriximagefilter, matrixconvolution, imagefiltersscaled, lighting, imagemagnifier, filterfastbounds, complexclip_aa_Layer_invert, complexclip_aa_layer, complexclip_bw_layer_invert, complexclip_bw_layer. BUG=skia:3532 Committed: https://skia.googlesource.com/skia/+/b97dafefe63ea0a1bbce8e8b209f4920983fb8b9 Review URL: https://codereview.chromium.org/1034733002
* SkPDF: remove SK_NO_FLATE & dead code in SkPDFStreamGravatar halcanary2015-03-31
| | | | | | | | | | | | SkPDFStream copy constructor SkPDFStream Substitute mechanism SkPDFStream::setData(NULL); SkPDFStream SK_NO_FLATE logic BUG=skia:3585 TBR=bsalomon@google.com,reed@google.com Review URL: https://codereview.chromium.org/1041183002
* back to Sk4f for SkPMColorGravatar mtklein2015-03-31
| | | | | | | | | #floats BUG=skia: BUG=skia:3592 Review URL: https://codereview.chromium.org/1047823002
* clamp matrix-translate before converting to pmcolorGravatar reed2015-03-30
| | | | | | | | .. thanks to https://codereview.chromium.org/1032593003/ layout failures BUG=skia: Review URL: https://codereview.chromium.org/1041203004
* Add option to embed font data into executable.Gravatar bungeman2015-03-30
| | | | | | | | Some tools would like to be built with all resources embedded. This change makes it possible to build a font manager which uses font data embedded into the executable. Review URL: https://codereview.chromium.org/1015723004
* Refactor Sk2x<T> + Sk4x<T> into SkNf<N,T> and SkNi<N,T>Gravatar mtklein2015-03-30
| | | | | | | | | | | | | | | | | | | | | The primary feature this delivers is SkNf and SkNd for arbitrary power-of-two N. Non-specialized types or types larger than 128 bits should now Just Work (and we can drop in a specialization to make them faster). Sk4s is now just a typedef for SkNf<4, SkScalar>; Sk4d is SkNf<4, double>, Sk2f SkNf<2, float>, etc. This also makes implementing new specializations easier and more encapsulated. We're now using template specialization, which means the specialized versions don't have to leak out so much from SkNx_sse.h and SkNx_neon.h. This design leaves us room to grow up, e.g to SkNf<8, SkScalar> == Sk8s, and to grown down too, to things like SkNi<8, uint16_t> == Sk8h. To simplify things, I've stripped away most APIs (swizzles, casts, reinterpret_casts) that no one's using yet. I will happily add them back if they seem useful. You shouldn't feel bad about using any of the typedef Sk4s, Sk4f, Sk4d, Sk2s, Sk2f, Sk2d, Sk4i, etc. Here's how you should feel: - Sk4f, Sk4s, Sk2d: feel awesome - Sk2f, Sk2s, Sk4d: feel pretty good No public API changes. TBR=reed@google.com BUG=skia:3592 Review URL: https://codereview.chromium.org/1048593002