Move SkBitmap's validate_alphaType to SkImageInfo, with the new
name SkColorTypeValidateAlphaType. Use it in SkPixelRef's constructors,
as well as in SkDecodingImageGenerator. This fixes a bug where an
SkPixelRef's SkAlphaType could get out of sync with its SkBitmap,
when both were assigned the same SkAlphaType.
R=reed@google.com, halcanary@google.com
Author: scroggo@google.com
Review URL: https://codereview.chromium.org/346593003
This CL makes it possible for pulled-forward-layers to be atlased. It currently has a couple glaring limitations (which is why it is disabled):
1) the atlased layers cannot be purged nor aged out
2) the texture backing the atlas is not pulled from (or returned to) the resource cache
#1 is on hold until we have a recycling rectanizer
A separate major limitation (the non-atlased layers aren't cached) is blocked until we can transmute entries in the resource cache from scratch to non-scratch while potentially preserving their contents.
Committed: https://skia.googlesource.com/skia/+/55e61f0ef4e5c8c34ac107deaadc9b4ffef3111bR=bsalomon@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/354533004
Reason for revert:
Sigh
Original issue's description:
> Begin atlasing
>
> This CL makes it possible for pulled-forward-layers to be atlased. It currently has a couple glaring limitations (which is why it is disabled):
>
> 1) the atlased layers cannot be purged nor aged out
> 2) the texture backing the atlas is not pulled from (or returned to) the resource cache
>
> #1 is on hold until we have a recycling rectanizer
>
> A separate major limitation (the non-atlased layers aren't cached) is blocked until we can transmute entries in the resource cache from scratch to non-scratch while potentially preserving their contents.
>
> Committed: https://skia.googlesource.com/skia/+/55e61f0ef4e5c8c34ac107deaadc9b4ffef3111bR=bsalomon@google.comTBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/359953002
This CL makes it possible for pulled-forward-layers to be atlased. It currently has a couple glaring limitations (which is why it is disabled):
1) the atlased layers cannot be purged nor aged out
2) the texture backing the atlas is not pulled from (or returned to) the resource cache
#1 is on hold until we have a recycling rectanizer
A separate major limitation (the non-atlased layers aren't cached) is blocked until we can transmute entries in the resource cache from scratch to non-scratch while potentially preserving their contents.
R=bsalomon@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/354533004
When drawing perlin noise, generate noise at the resolution determined
by CTM, not by the resolution at construction time. This required moving
the generation of PaintingData to getContext() and asNewEffect() for the
raster and GPU paths, respectively.
It also required adjusting the matrices used during rendering
to be translate-only.
R=sugoi@chromium.org, bsalomon@google.com
Author: senorblanco@chromium.org
Review URL: https://codereview.chromium.org/358903002
Unlike SkAutoSTMalloc, it doesn't make sense for SkAutoTMalloc to set
SK_MALLOC_TEMP. See SkAutoMalloc/SkAutoSMalloc for similar in the void*
world.(This change is a documentation-only no-op. No code pays any
attention to SK_MALLOC_TEMP.)
BUG=skia:
R=halcanary@google.com
Review URL: https://codereview.chromium.org/356913003
- support fRecord in copy constructor
- support SkDrawPictureCallback
Moved SkDrawPictureCallback to its own header so
SkRecordDraw can include it without pulling in all of
SkPicture.
Adding an SkAutoSaveRestore to SkRecordDraw was the easiest
way to match the balance guarantees of the callback, and
probably not a bad idea in general. Updated its tests.
BUG=skia:
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/349973008
Implement path tight bounds using path ops machinery. This is not
as efficient as it could be; for instance, internally, it creates
a path ops structure more suited to intersection. If this shows
up as a performance bottleneck, it could be improved.
Fix path ops gyp files, which have fallen out of sync with other
tests.
R=mtklein@google.com, bsalomon@google.com
TBR=mtklein
BUG=skia:1712
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/348343002
Use path rendering to render the text from outlines if supported by the
GPU. Implement this in GrStencilAndCoverTextContext by copying chunks of code
from GrBitmapTextContext.
The drawing is implemented with "instanced" path drawing functions.
Moves the creation of the "main" text context from SkGpuDevice to the
GrContext::createTextContext. This is done because the decision of which text
renderer is optimal can be made only with the internal implementation-specific
information of the context.
Remove a windows assertion from SkScalerContext_GDI::getGDIGlyphPath. The
GetGlyphOutlineW fails in fontmgr_match for the initial space char in the string
" [700] ...". According to MSDN, this is a known problem. Just return that the
glyph has no path data in these cases.
R=jvanverth@google.com, bsalomon@google.com, mtklein@google.com
Author: kkinnunen@nvidia.com
Review URL: https://codereview.chromium.org/196133014
I've tagged all the functions in SkPicture.cpp is // fRecord TODO or // fRecord
OK, depending on whether or not they're totally broken when used from an
SkRecord-based picture. Obviously next steps are to eliminate all the TODOs,
then clean up the notes.
I converted SkPicture over to smart pointers too. It's particularly helpful
that the smart pointers initialize to NULL by default.
For now I've got all the SkRecord-based code jammed in at the bottom of the file. I figure it'll help me keep things straight for a bit, then we can rearrange later.
BUG=skia:
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/333823007
Reason for revert:
Rebaseline CL is ready to be submitted
Original issue's description:
> Revert of Fix SkPaint::measureText for stroked hairline text (https://codereview.chromium.org/335603003/)
>
> Reason for revert:
> Caused many shadertext GM failures
>
> Original issue's description:
> > Fix SkPaint::measureText for stroked hairline text
> >
> > SkPaint::measureText and text drawing used different criteria for
> > determining whether text should be drawn as paths or not.
> >
> > Adds tests glyph_pos_(h/n)_(s/f/b) to test the text rendering and the glyph
> > positioning in the rendering. Mainly added in order to define what is the
> > expected text rendering when hairline stroke is used with various transform
> > options.
> >
> > The testcase also tries to note or highlight the fact that SkPaint::measureText
> > is not expected to produce intuitively matching results when compared to a
> > rendering, if the rendering is done so that the device ends up having a device
> > transform.
> >
> > This fixes the glyph_pos_h_s (hairline, stroked) test-case.
> >
> > Ignore shadertext2_pdf-poppler.png gm on
> > Test-Ubuntu13.10-ShuttleA-NoGPU-x86_64-Debug temporarily, as that fails.
> >
> > Committed: https://skia.googlesource.com/skia/+/196af738027c5e18c3eb792dbcaf90ef27821793
>
> TBR=jvanverth@google.com,reed@google.com,kkinnunen@nvidia.com
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://skia.googlesource.com/skia/+/abc9bb55ddfeb4b1a7acc335a34841fddcd22d27R=jvanverth@google.com, reed@google.com, kkinnunen@nvidia.comTBR=jvanverth@google.com, kkinnunen@nvidia.com, reed@google.com
NOTREECHECKS=true
NOTRY=true
Author: rmistry@google.com
Review URL: https://codereview.chromium.org/349153005
Reason for revert:
Will have to unfortunately revert this CL in order to revert https://codereview.chromium.org/319043005/
Original issue's description:
> Add functions to support NV_path_rendering in OpenGL ES
>
> Add OpenGL ES extension functions needed to support NV_path_rendering in OpenGL
> ES.
>
> The added glProgramPathFragmentInputGenNV call is defined in NV_path_rendering
> revision 30, similar to following:
>
> Append to the end of the "Shader Inputs" subsection of Section 3.12.2
> "Shader Execution":
>
> The command
>
> void ProgramPathFragmentInputGenNV(uint program,
> int location,
> enum genMode,
> int components,
> const float *coeffs);
>
> controls how a user-defined (non-built-in) fragment input of a
> GLSL program object is computed for fragment shading operations that
> occur as a result of CoverFillPathNV or CoverStrokePathNV.
>
> /program/ names a GLSL program object. If /program/ has not been
> successfully linked, the error INVALID_OPERATION is generated.
>
> The given fragment input generation state is loaded into the fragment
> input variable location identified by /location/. This location
> is a value returned either by GetProgramResourceLocation with a
> /programInterface/ of FRAGMENT_INPUT_NV and a given fragment shader
> input variable name or by GetProgramResourceiv with FRAGMENT_INPUT_NV
> for the /programInterface/ and LOCATION for the property for a given
> fragment input resource index.
>
> ....
>
> glProgramPathFragmentInputGenNV will be used instead of glPathTexGen,
> because the latter depends on fixed function pipeline that is not
> exposed in ES.
>
> Also add glGetProgramResourceLocation from OpenGL 4.3 or
> ARB_program_interface_query.
>
> Also add FRAGMENT_INPUT define to be used with glGetProgramResourceLocation.
>
> The added functions are not used yet, but they're needed when implementing
> NV_path_rendering support for OpenGL ES. They can also be used on OpenGL.
>
> Remove uncalled NV_path_rendering functions, so they do not cause confusion
> or take space in the interface definition. The ones that are later used
> can be re-added when needed.
>
> Remove definitions NV_path_rendering that are for NV_path_rendering function
> parameters that are not used. The ones that are later used
> can be re-added when needed.
>
> Committed: https://skia.googlesource.com/skia/+/4a995dfff2ecf91e8bf999d77e3218cec596232cR=bsalomon@google.com, kkinnunen@nvidia.comTBR=bsalomon@google.com, kkinnunen@nvidia.com
NOTREECHECKS=true
NOTRY=true
Author: rmistry@google.com
Review URL: https://codereview.chromium.org/349983002
Reason for revert:
Caused many shadertext GM failures
Original issue's description:
> Fix SkPaint::measureText for stroked hairline text
>
> SkPaint::measureText and text drawing used different criteria for
> determining whether text should be drawn as paths or not.
>
> Adds tests glyph_pos_(h/n)_(s/f/b) to test the text rendering and the glyph
> positioning in the rendering. Mainly added in order to define what is the
> expected text rendering when hairline stroke is used with various transform
> options.
>
> The testcase also tries to note or highlight the fact that SkPaint::measureText
> is not expected to produce intuitively matching results when compared to a
> rendering, if the rendering is done so that the device ends up having a device
> transform.
>
> This fixes the glyph_pos_h_s (hairline, stroked) test-case.
>
> Ignore shadertext2_pdf-poppler.png gm on
> Test-Ubuntu13.10-ShuttleA-NoGPU-x86_64-Debug temporarily, as that fails.
>
> Committed: https://skia.googlesource.com/skia/+/196af738027c5e18c3eb792dbcaf90ef27821793R=jvanverth@google.com, reed@google.com, kkinnunen@nvidia.comTBR=jvanverth@google.com, kkinnunen@nvidia.com, reed@google.com
NOTREECHECKS=true
NOTRY=true
Author: rmistry@google.com
Review URL: https://codereview.chromium.org/354433002
Add OpenGL ES extension functions needed to support NV_path_rendering in OpenGL
ES.
The added glProgramPathFragmentInputGenNV call is defined in NV_path_rendering
revision 30, similar to following:
Append to the end of the "Shader Inputs" subsection of Section 3.12.2
"Shader Execution":
The command
void ProgramPathFragmentInputGenNV(uint program,
int location,
enum genMode,
int components,
const float *coeffs);
controls how a user-defined (non-built-in) fragment input of a
GLSL program object is computed for fragment shading operations that
occur as a result of CoverFillPathNV or CoverStrokePathNV.
/program/ names a GLSL program object. If /program/ has not been
successfully linked, the error INVALID_OPERATION is generated.
The given fragment input generation state is loaded into the fragment
input variable location identified by /location/. This location
is a value returned either by GetProgramResourceLocation with a
/programInterface/ of FRAGMENT_INPUT_NV and a given fragment shader
input variable name or by GetProgramResourceiv with FRAGMENT_INPUT_NV
for the /programInterface/ and LOCATION for the property for a given
fragment input resource index.
....
glProgramPathFragmentInputGenNV will be used instead of glPathTexGen,
because the latter depends on fixed function pipeline that is not
exposed in ES.
Also add glGetProgramResourceLocation from OpenGL 4.3 or
ARB_program_interface_query.
Also add FRAGMENT_INPUT define to be used with glGetProgramResourceLocation.
The added functions are not used yet, but they're needed when implementing
NV_path_rendering support for OpenGL ES. They can also be used on OpenGL.
Remove uncalled NV_path_rendering functions, so they do not cause confusion
or take space in the interface definition. The ones that are later used
can be re-added when needed.
Remove definitions NV_path_rendering that are for NV_path_rendering function
parameters that are not used. The ones that are later used
can be re-added when needed.
R=bsalomon@google.com
Author: kkinnunen@nvidia.com
Review URL: https://codereview.chromium.org/345723002
SkPaint::measureText and text drawing used different criteria for
determining whether text should be drawn as paths or not.
Adds tests glyph_pos_(h/n)_(s/f/b) to test the text rendering and the glyph
positioning in the rendering. Mainly added in order to define what is the
expected text rendering when hairline stroke is used with various transform
options.
The testcase also tries to note or highlight the fact that SkPaint::measureText
is not expected to produce intuitively matching results when compared to a
rendering, if the rendering is done so that the device ends up having a device
transform.
This fixes the glyph_pos_h_s (hairline, stroked) test-case.
Ignore shadertext2_pdf-poppler.png gm on
Test-Ubuntu13.10-ShuttleA-NoGPU-x86_64-Debug temporarily, as that fails.
R=jvanverth@google.com, reed@google.com
Author: kkinnunen@nvidia.com
Review URL: https://codereview.chromium.org/335603003
Always build the tools with JSON, but either build our own
or use the system's.
Rename skia_build_json_writer to skia_use_system_jsoncpp,
since we now always build with JSON.
Remove SK_BUILD_JSON_WRITER, which was only there so
we could build without JSON it in the framework.
BUG=skia:2448
R=djsollen@google.com, reed@google.com
Author: scroggo@google.com
Review URL: https://codereview.chromium.org/303913002
Example failure:
fRefCnt was 3
../../../usr/local/google/home/mtklein/skia/include/core/SkRefCnt.h:40: failed assertion "(fRefCnt == 1) || (SkDebugf("fRefCnt was %d""\n", fRefCnt), false)"
Command terminated by signal 11
Not pretty, but everything's there. Perhaps we'll think of ways to make it nicer later.
BUG=skia:
R=bsalomon@google.com, reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/337243004
This is a follow up to https://codereview.chromium.org/338913002/. More
tweaks to allow migrating clients to the new API.
1) switch the shim call direction willSave(SaveFlags) -> willSave()
(internal users are still using the former, so external overriders of
the latter will not be notified otherwise - doh)
2) ensure willSave() stays visible in SkProxyCanvas (Chromium's
TimingCanvas attempts to call it explicitly).
BUG=skia:2297
R=reed@google.com
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/334393008
The interesting stuff is in SkPictureRecorder.{h,cpp}. The rest is mostly moving SkRecord from its own directories into core to avoid circular dependencies in GYP.
After plumbing SkRecord all the way through in Picture, I'll delete its old entry point include/record/SkRecording.h. For now it and record.gypi need to stay where they are to keep Chrome building.
BUG=skia:
R=reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/331573004
This will allow us to batch dashed lines together when drawing. Also, this removes the need for
a coord transform matrix in the shader, thus we save the cost of uploading a new matrix uniform
everytime we do a simple transform to the dashed line we are drawing.
BUG=skia:
R=bsalomon@google.com
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/326103002
This CL improves the separation of the SkPicture and SkPictureRecord classes. It delays creation of the SkPicture (in SkPictureRecorder) until recording is actually completed. To accomplish this the SkRecord-derived classes now get SkPathHeap and SkPictureContentInfo members that are absorbed by the SkPicture when it is constructed.
As an ancillary change, this CL also moves the SkPictureContentInfo object from SkPicture to SkPicturePlayback. This is intended to centralize all the data in the SkPicturePlayback object.
R=mtklein@google.com, reed@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/324293004
From inside GrContext, we have a need to create an SkPath an original path and
some dashing info. We do not have access to the original path effect so we need
a way to make the FilterPath function accessible outside of the effect. So I moved
the core filterPath code (and all need helper functions) out of SkDashPathEffect
and created a SkDashPath in utils to store these helper functions.
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/576dcdc793a762ec63fbecdbfd5768066b548fe5
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/314623004
The new signature is:
bool asNewEffect(GrContext* context, const SkPaint& paint, GrColor* grColor, GrEffectRef** grEffect, const SkMatrix* localMatrixOrNull) const;
It will fix the hack for skcolorshader by modifying the GrColor parameter in SkGr::SkPaint2GrPaintShader.
BUG=skia:2646
R=jvanverth@google.com, bsalomon@google.com
Author: dandov@google.com
Review URL: https://codereview.chromium.org/318923005
This is split out of https://codereview.chromium.org/316063005/ for clarity. Keeping in mind that SkPicture::FakeEndRecording is now only called from SkPictureRecorder, its deepCopy parameter is no longer necessary. This is b.c., given the new Picture recording semantics (where SkPictures can no longer be actively recording), cloning for thread safety only happens when an SkPicturePlayback has already been allocated (i.e., it happens in the SkPicturePlayback copy constructor.
R=scroggo@google.com, reed@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/324093003
This was introduced by removing SkValidatingReadBuffer::readBitmap in https://codereview.chromium.org/295793002/
Since SkReadBuffer::skip wasn't virtual, it was using the unsafe SkReadBuffer::skip within SkReadBuffer::readBitmap rather than using SkValidatingReadBuffer::skip. I also removed direct uses of fReader within SkReadBuffer::readBitmap so that it can use the virtual readInt / readFixed functions that have a version in SkValidatingReadBuffer.
Also, I changed SkReadBuffer::readPoint so that it uses the virtual readScalar, that way, it becomes redundant with SkValidatingReadBuffer::readPoint, which can then be removed.
BUG=380723
R=reed@google.com, mtklein@google.com, sugoi@google.com
Author: sugoi@chromium.org
Review URL: https://codereview.chromium.org/317003003
(
This is intended to facilitate efficient kMatrix_SaveFlags emulation
on restore():
* collect all clip stack elements for the current save count into a
side clip stack
* canvas.restore(everything)
* replay the collected clip ops to restore the initial clip state
=> we restored the matrix but the clip state is unchanged
)
Two main changes:
* expose the save count for SkClipStack::Element
* expose a replay method for the same (logic relocated from
SkCanvas::replayClips)
The SkCanvas::ClipVisitor shuffling is to enable forward decl
in SkClipStack.h (cannot fwdecl a nested class).
R=reed@google.com, robertphillips@google.comTBR=reed@google.com
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/269693003
From inside GrContext, we have a need to create an SkPath an original path and
some dashing info. We do not have access to the original path effect so we need
a way to make the FilterPath function accessible outside of the effect. So I moved
the core filterPath code (and all need helper functions) out of SkDashPathEffect
and created a SkDashPath in utils to store these helper functions.
BUG=skia:
R=bsalomon@google.com, reed@google.com, rmistry@google.com
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/314623004
In SkLayerRasterizer::snapshotRasterizer() and ::detachRasterizer(),
if no layers have been added, do not attempt to create an
SkLayerRasterizer. Instead, return NULL.
This fixes an error when running tests on Android.
Update dox to state that NULL may be returned.
Add tests.
R=reed@google.com
Author: scroggo@google.com
Review URL: https://codereview.chromium.org/313653006
1 Remove atExit feature: clients can do it just as well as SkOnce can.
2 Remove support for functors: no one but the unit test did that.
3 Remove support for unused non-static SkOnceFlag (no SK_ONCE_INIT).
4 Add SkOnce variants for no-arg functions so we're not forced to pass dummy values all the time.
5 Merge SkSpinlock and SkOnceFlag, making all members private.
6 More notes about memory barriers, adding an acquire load after acquiring the spinlock.
BUG=skia:
R=bungeman@google.com, mtklein@google.com, reed@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/302083003
SK_DECLARE_STATIC_LAZY_PTR and
SK_DECLARE_STATIC_LAZY_PTR_ARRAY let you declare a single or
array of static pointers that are lazily initialized.
You can think of this as a restricted, lighter-weight
version of SkOnce. There's no guarantee that Create will be
called exactly once, but we do guarantee all threads will
agree on the resulting pointer.
We'll clean up any other extra pointers we Create()ed by
calling Destroy(), which defaults to SkDELETE. In debug
mode, we also clean up the winning pointer at process exit,
so we can make sure we didn't leak it or free it early.
I've ported SkData (singleton) and SkXfermode (array) as
examples. Once this lands I'll port most other users of
SkOnce.
BUG=skia:
R=bungeman@google.com, mtklein@google.com, reed@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/306943003
git-svn-id: http://skia.googlecode.com/svn/trunk@14976 2bbb7eff-a529-9590-31e7-b0007b416f81
Every doc I've found about using Android's atomics says, "stop".
"* A handful of basic atomic operations. The appropriate pthread
* functions should be used instead of these whenever possible."
"... we recommend stopping from using these functions entirely. Very fortunately, GCC provides handy intrinsics functions that work with very reasonable performance and always provide a full barrier."
As far as I can tell, there's no code generation change here: both the __sync atomics and the android_ atomics use full memory barriers. (And now with this all unified, it'll be easier to get the real wins by switching everything to __atomic atomics, which are like __sync atomics but allow control over memory barriers.)
BUG=skia:
R=bungeman@google.com, djsollen@google.com, mtklein@google.com, reed@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/305593002
git-svn-id: http://skia.googlecode.com/svn/trunk@14896 2bbb7eff-a529-9590-31e7-b0007b416f81