I want to play around with how SkTileGrid stores its tiles. Having a
cap on the number of insert() calls can be pretty handy.
While I'm at it, I gave flush() a default empty impl. Like reserve(),
it's really an optional hook for subclasses.
BUG=skia:
Review URL: https://codereview.chromium.org/639933003
Draw thick-stroked Beziers by computing the outset quadratic, measuring the error, and subdividing until the error is within a predetermined limit.
To try this CL out, change src/core/SkStroke.h:18 to
#define QUAD_STROKE_APPROXIMATION 1
or from the command line: CPPFLAGS="-D QUAD_STROKE_APPROXIMATION=1" ./gyp_skia
Here's what's in this CL:
bench/BezierBench.cpp : a microbench for examining where the time is going
gm/beziers.cpp : random Beziers with various thicknesses
gm/smallarc.cpp : a distillation of bug skia:2769
samplecode/SampleRotateCircles.cpp : controls added for error, limit, width
src/core/SkStroke.cpp : the new stroke implementation (disabled)
tests/StrokerTest.cpp : a stroke torture test that checks normal and extreme values
The new stroke algorithm has a tweakable parameter:
stroker.setError(1); (SkStrokeRec.cpp:112)
The stroke error is the allowable gap between the midpoint of the stroke quadratic and the center Bezier. As the projection from the quadratic approaches the endpoints, the error is decreased proportionally so that it is always inside the quadratic curve.
An overview of how this works:
- For a given T range of a Bezier, compute the perpendiculars and find the points outset and inset for some radius.
- Construct tangents for the quadratic stroke.
- If the tangent don't intersect between them (may happen with cubics), subdivide.
- If the quadratic stroke end points are close (again, may happen with cubics), draw a line between them.
- Compute the quadratic formed by the intersecting tangents.
- If the midpoint of the quadratic is close to the midpoint of the Bezier perpendicular, return the quadratic.
- If the end of the stroke at the Bezier midpoint doesn't intersect the quad's bounds, subdivide.
- Find where the Bezier midpoint ray intersects the quadratic.
- If the intersection is too close to the quad's endpoints, subdivide.
- If the error is large proportional to the intersection's distance to the quad's endpoints, subdivide.
BUG=skia:723,skia:2769
Review URL: https://codereview.chromium.org/558163005
Make the Sk GL context class, SkGLNativeContext, an abstract base class. Before,
it depended on ifdefs to implement the platform dependent polymorphism. Move
the logic to subclasses of the various platform implementations.
This a step to enable Skia embedders to compile dm and bench_pictures. The
concrete goal is to support running these test apps with Chromium command buffer.
With this change, Chromium can implement its own version of SkGLNativeContext
that uses command buffer, and host the implementation in its own repository.
Implements the above by renaming the SkGLContextHelper to SkGLContext and
removing the unneeded SkGLNativeContext. Also removes
SkGLNativeContext::AutoRestoreContext functionality, it appeared to be unused:
no use in Skia code, and no tests.
BUG=skia:2992
Committed: https://skia.googlesource.com/skia/+/a90ed4e83897b45d6331ee4c54e1edd4054de9a8
Review URL: https://codereview.chromium.org/630843002
Reason for revert:
nanobech failing on Android
Original issue's description:
> Make the Sk GL context class an abstract base class
>
> Make the Sk GL context class, SkGLNativeContext, an abstract base class. Before,
> it depended on ifdefs to implement the platform dependent polymorphism. Move
> the logic to subclasses of the various platform implementations.
>
> This a step to enable Skia embedders to compile dm and bench_pictures. The
> concrete goal is to support running these test apps with Chromium command buffer.
>
> With this change, Chromium can implement its own version of SkGLNativeContext
> that uses command buffer, and host the implementation in its own repository.
>
> Implements the above by renaming the SkGLContextHelper to SkGLContext and
> removing the unneeded SkGLNativeContext. Also removes
> SkGLNativeContext::AutoRestoreContext functionality, it appeared to be unused:
> no use in Skia code, and no tests.
>
> BUG=skia:2992
>
> Committed: https://skia.googlesource.com/skia/+/a90ed4e83897b45d6331ee4c54e1edd4054de9a8TBR=kkinnunen@nvidia.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2992
Review URL: https://codereview.chromium.org/639793002
Make the Sk GL context class, SkGLNativeContext, an abstract base class. Before,
it depended on ifdefs to implement the platform dependent polymorphism. Move
the logic to subclasses of the various platform implementations.
This a step to enable Skia embedders to compile dm and bench_pictures. The
concrete goal is to support running these test apps with Chromium command buffer.
With this change, Chromium can implement its own version of SkGLNativeContext
that uses command buffer, and host the implementation in its own repository.
Implements the above by renaming the SkGLContextHelper to SkGLContext and
removing the unneeded SkGLNativeContext. Also removes
SkGLNativeContext::AutoRestoreContext functionality, it appeared to be unused:
no use in Skia code, and no tests.
BUG=skia:2992
Review URL: https://codereview.chromium.org/630843002
this is a huge refactor and cleanup of the gl shader building system in
Skia. The entire shader building pipeline is now part of
GrGLProgramCreator, which takes a gp, and some fps, and creates a
program. I added some subclasses of GrGLProgram to handle the
eccentricities of Nvpr/Nvpres. Outside of the builders folder
and GrGLPrograms, this change is basically just a rename
solo gp
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/fe1233c3f12f81bb675718516bbb32f72af726ec
Review URL: https://codereview.chromium.org/611653002
Reason for revert:
Seems to have messed up windows 7 gms
Original issue's description:
> Cleanup of shader building system
>
> this is a huge refactor and cleanup of the gl shader building system in
> Skia. The entire shader building pipeline is now part of
> GrGLProgramCreator, which takes a gp, and some fps, and creates a
> program. I added some subclasses of GrGLProgram to handle the
> eccentricities of Nvpr/Nvpres. Outside of the builders folder
> and GrGLPrograms, this change is basically just a rename
>
>
> solo gp
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/fe1233c3f12f81bb675718516bbb32f72af726ecTBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/635533005
this is a huge refactor and cleanup of the gl shader building system in
Skia. The entire shader building pipeline is now part of
GrGLProgramCreator, which takes a gp, and some fps, and creates a
program. I added some subclasses of GrGLProgram to handle the
eccentricities of Nvpr/Nvpres. Outside of the builders folder
and GrGLPrograms, this change is basically just a rename
solo gp
BUG=skia:
Review URL: https://codereview.chromium.org/611653002
Reason for revert:
Changing some GMs
Original issue's description:
> Add isSingleComponent bool to getConstantColorComponent
>
> Initial step to allowing effects to use/output 1 or 4 color/coverage components. This cl doesn't change any current logic and all effects still assume they are working with 4 components.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3b8af078281a5a20f951b9fd84f38d92b8f6217bTBR=joshualitt@chromium.org,bsalomon@google.com,reed@google.com,egdaniel@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/617853003
Initial step to allowing effects to use/output 1 or 4 color/coverage components. This cl doesn't change any current logic and all effects still assume they are working with 4 components.
BUG=skia:
Review URL: https://codereview.chromium.org/608253002
Now that the old backend's not using BBHs, we can specialize them for
SkRecord's needs. The only thing we really want to store is op index, which
should always be small enough to fit into an unsigned (unsigned also helps keep
it straight from other ints floating around).
This means we'll need half (32-bit) or a quarter (64-bit) the bytes in SkTileGrid,
because we don't have to store an extra int for ordering.
BUG=skia:2834
Review URL: https://codereview.chromium.org/617393004
It makes no sense for the paint from a saveLayer to effect anything outside its saveLayer/restore block. But as currently written, we'll adjust the clip bounds just after a restore by that paint.
Turns out the test I wrote for the last CL (which caused this bug) actually had the bug baked into its expectations. I've updated them and added some notes to explain.
BUG=418417
Review URL: https://codereview.chromium.org/623563002
This removes:
1) ability to record old pictures with SkPictureRecorder;
2) a couple tests specific to the old backend.
The functionality of DEPRECATED_beginRecording() now lives in
(private) SkPicture::Backport(), which is the only place we
need it now.
BUG=skia:
TBR=reed@google.com
Review URL: https://codereview.chromium.org/618303002
Having hoisted layers from different pictures invalidates the assumptions of the old GrReplacements object. This is fixed by switching to a SkTDynamicHash-based back-end.
Sub-picture-layers also require that the replacement drawing occur for the sub-pictures too. The ReplaceDraw object is added to make this happen and limit the replacement lookup to saveLayer draw commands.
This is split out of (Fix sub-picture layer rendering bugs - https://codereview.chromium.org/597293002/).
BUG=skia:2315
Review URL: https://codereview.chromium.org/607763008
Feature-wise, this removes:
1) BBH support;
2) peephole optimizations;
3) record-time text op specializations;
4) the guarantee that SkPaints are flattened.
This deletes the optimizations GM, which only exists to test the peepholes of
the old backend. SkRecord optimizations are unit tested, and if that ever fails we
can think about adding another GM like this, but they're different enough we'd
want to start from scratch anyway.
We need to keep the code that plays back the specialized text ops around for
a while for compatibility with existing .SKPs that have those ops recorded.
BUG=skia:
CQ_EXTRA_TRYBOTS=tryserver.skia:Canary-Chrome-Ubuntu13.10-Ninja-x86_64-ToT-Trybot
R=robertphillips@google.com, reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/617953002
This CL reduces the amount of information used in the layer cache key:
- the stop value isn't needed since the start value uniquely identifies the layer in the picture.
- only the upper-left 2x2 portion of the CTM should be used as a key for looking up cached layers.
- individual layers can be redraw in different locations so the final offset cannot be a part of the key.
Since this data is no longer stored in the cached layer, but is still required to draw the cached layer, it is now stored in the per-layer information (i.e., HoistedLayer).
This is split out of (Fix sub-picture layer rendering bugs - https://codereview.chromium.org/597293002/).
BUG=skia:2315
R=egdaniel@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/609403003
fDirtyBits is only used by SkPaint::FlatteningTraits, which in turn was
only used as a smaller, faster format to flatten paints in-memory to dedup
them in the old picture backend.
SkRecord obsoleted all this. Neither flatten()/unflatten() (disk format)
nor FlatteningTraits is used anywhere performance or size matters.
Here I revert the deduping code back to using the disk format for flattened paints.
We stil do have to flatten and unflatten paints while coverting from SkRecord
backend to the old backend, so we can't just delete this all yet, but any
faithful round trip flatten()/unflatten() pair will be fine, however slow.
NOTRY=true
BUG=skia:
R=reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/604813003