Commit Graph

4353 Commits

Author SHA1 Message Date
jbroman
7d1b945da6 Mark SkPictureRecorder::endRecording as SK_WARN_UNUSED_RESULT.
Ignoring the result is a memory leak.
Callers should always at least unref the result.

This bug has occurred in Blink:
  https://codereview.chromium.org/1068413002/

BUG=skia:3680

Review URL: https://codereview.chromium.org/1072633002
2015-04-09 06:12:17 -07:00
halcanary
16e833d5aa SkString: remove fStr member
Motivation:  I'd like sizeof(SkString) to be the same in Debug and Release.

Review URL: https://codereview.chromium.org/1073473003
2015-04-08 13:01:22 -07:00
mtklein
feaadee1c3 SkCanvas::resetForNextPicture()
No diffs against head for DM --config 8888 gpu 2ndpic-8888 2ndpic-gpu.

  picture_overhead_draw	1.62us ->  1.6us	0.99x
picture_overhead_nodraw	 792ns ->  342ns	0.43x

tiles and serialization modes will also test this a bit.

BUG=chromium:470553

Committed: https://skia.googlesource.com/skia/+/f920e468ac66a36c9653d1b11181480295044c7d

Review URL: https://codereview.chromium.org/1067893002
2015-04-08 11:25:48 -07:00
bsalomon
3f324321cd Add mechanism to proactively purge old resources in GrResourceCache.
This change leaves the feature turned off by default.

Review URL: https://codereview.chromium.org/1032873002
2015-04-08 11:01:55 -07:00
joshualitt
b7133bed55 Adding a cache + memory pool for GPU TextBlobs
BUG=skia:

Review URL: https://codereview.chromium.org/1055843002
2015-04-08 09:08:31 -07:00
bsalomon
e4579adfdf Add helper for creating a SkSurface from a client created texture.
Review URL: https://codereview.chromium.org/1071603002
2015-04-08 08:38:40 -07:00
caryclark
95bc5f3495 change isNestedRect to isNestedFillRect
R=reed@google.com, bsalomon@google.com

Let isNested(Fill)Rect return true if drawn path describes filled
rectangles.

Review URL: https://codereview.chromium.org/1073473002
2015-04-08 08:34:15 -07:00
joshualitt
f1f8895cbe add realloc method to SkAutoSTMalloc
BUG=skia:

Review URL: https://codereview.chromium.org/1069013002
2015-04-08 07:33:33 -07:00
mtklein
c654e9016a Revert of SkCanvas::resetForNextPicture() (patchset #4 id:60001 of https://codereview.chromium.org/1067893002/)
Reason for revert:
https://uberchromegw.corp.google.com/i/client.skia/builders/Linux%20Tests/builds/1816

Original issue's description:
> SkCanvas::resetForNextPicture()
>
> No diffs against head for DM --config 8888 gpu 2ndpic-8888 2ndpic-gpu.
>
>   picture_overhead_draw	1.62us ->  1.6us	0.99x
> picture_overhead_nodraw	 792ns ->  342ns	0.43x
>
> tiles and serialization modes will also test this a bit.
>
> BUG=chromium:470553
>
> Committed: https://skia.googlesource.com/skia/+/f920e468ac66a36c9653d1b11181480295044c7d

TBR=mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:470553

Review URL: https://codereview.chromium.org/1062353002
2015-04-07 15:27:14 -07:00
mtklein
f920e468ac SkCanvas::resetForNextPicture()
No diffs against head for DM --config 8888 gpu 2ndpic-8888 2ndpic-gpu.

  picture_overhead_draw	1.62us ->  1.6us	0.99x
picture_overhead_nodraw	 792ns ->  342ns	0.43x

tiles and serialization modes will also test this a bit.

BUG=chromium:470553

Review URL: https://codereview.chromium.org/1067893002
2015-04-07 14:11:22 -07:00
reed
687fa1c745 restore clipstack to heap-ptr, so clients can ref it
BUG=skia:

Review URL: https://codereview.chromium.org/1068883004
2015-04-07 08:00:56 -07:00
scroggo
5965b73e54 Revert of Remove now-redundant SkPathOps enum. (patchset #1 id:1 of https://codereview.chromium.org/1051113005/)
Reason for revert:
Android is still using this. See 4c2968b94c/logs/build_error.log

Original issue's description:
> Remove now-redundant SkPathOps enum.
>
> R=caryclark,reed
> BUG=473772
>
> Committed: https://skia.googlesource.com/skia/+/143244e27d95255807d8fa505ce0affef96d1fc8

TBR=caryclark@google.com,reed@google.com,schenney@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=473772

Review URL: https://codereview.chromium.org/1068873002
2015-04-07 06:53:21 -07:00
mtklein
e35268ef4c Send SkPicture deletion message lazily.
If no one has read the picture's unique ID, there's no point invalidating it.

This is the same trick we pull with SkPixelRefs.

Before:
  26M	1	1.49µs	1.6µs	1.77µs	6.25µs	42%	picture_overhead_draw
  13M	32	742ns	749ns	756ns	823ns	2%	picture_overhead_nodraw

After:
  26M	1	1.27µs	1.33µs	1.49µs	5.51µs	45%	picture_overhead_draw
  14M	43	677ns	680ns	681ns	701ns	1%	picture_overhead_nodraw

BUG=skia:

Review URL: https://codereview.chromium.org/1061283002
2015-04-07 06:34:05 -07:00
reed
b679ca8926 reduce alloc overhead for SkCanvas
use pre-allocated space in the canvas to avoid initial calls to malloc

BUG=skia:

Review URL: https://codereview.chromium.org/1060583007
2015-04-07 04:40:48 -07:00
schenney
143244e27d Remove now-redundant SkPathOps enum.
R=caryclark,reed
BUG=473772

Review URL: https://codereview.chromium.org/1051113005
2015-04-06 09:37:56 -07:00
mtklein
76f5cc6e9e Clean up BlockRef
- It's no longer needed to help the (2011?) transition to SkAutoTUnref.
  - It prevents us from making classes that go in SkAutoTUnrefs final,
    i.e. all ref-counted classes.

This had better not have been public API...
TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1068443002
2015-04-06 08:57:32 -07:00
scroggo
028a4135aa Add a method to read a stream without advancing it.
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
2015-04-02 13:19:51 -07:00
borenet
4808757d7a Remove all code related to NaCl
BUG=skia:3600
DOCS_PREVIEW= https://skia.org/?cl=1036283002

Review URL: https://codereview.chromium.org/1036283002
2015-04-02 12:16:36 -07:00
bsalomon
c9c3e62b4e Add constant color GrFP.
Committed: https://skia.googlesource.com/skia/+/dfbbec436cbcacc3270d4b28357c8393e67d6494

Review URL: https://codereview.chromium.org/978713002
2015-04-02 11:12:09 -07:00
joshualitt
dbd3593e0b Rename GrBitmapTextContextB to GrAtlasTextContext
BUG=skia:

Review URL: https://codereview.chromium.org/1050173002
2015-04-02 09:19:04 -07:00
bsalomon
599ea40cec Revert of Add constant color GrFP. (patchset #10 id:180001 of 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
2015-04-02 08:33:54 -07:00
bsalomon
dfbbec436c Add constant color GrFP.
Review URL: https://codereview.chromium.org/978713002
2015-04-01 14:54:57 -07:00
joshualitt
2b6acb4ed5 Switch to one single bitmap text blob cache allocation
BUG=skia:

Review URL: https://codereview.chromium.org/1041953002
2015-04-01 11:30:28 -07:00
scroggo
5842154480 SkCodec::onGetScanlineDecoder must call rewind.
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
2015-04-01 11:25:20 -07:00
vbuzinov
08b4d29a0a GrGLInterface: Add support for NV_framebuffer_mixed_samples
Import glCoverageModulation if NV_framebuffer_mixed samples
is available

BUG=skia:3177

Review URL: https://codereview.chromium.org/993363002
2015-04-01 06:29:49 -07:00
joshualitt
7c3a2f834e BitmapTextBatch and BitmapTextBlob
BUG=skia:

Committed: https://skia.googlesource.com/skia/+/eed1dae04932483579b02c10f0706127d3f5d984

Review URL: https://codereview.chromium.org/1011403004
2015-03-31 13:32:05 -07:00
joshualitt
c03391e792 Revert of BitmapTextBatch and BitmapTextBlob (patchset #18 id:360001 of 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
2015-03-31 11:33:08 -07:00
joshualitt
eed1dae049 BitmapTextBatch and BitmapTextBlob
BUG=skia:

Review URL: https://codereview.chromium.org/1011403004
2015-03-31 11:04:53 -07:00
halcanary
af9c85dee1 SkPDF: remove SK_NO_FLATE & dead code in SkPDFStream
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
2015-03-31 08:22:01 -07:00
mtklein
c9adb05b64 Refactor Sk2x<T> + Sk4x<T> into SkNf<N,T> and SkNi<N,T>
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
2015-03-30 10:50:27 -07:00
mtklein
50ffd9921e Extract the spinlock from SkOnce as SkSpinlock.
This uses slightly newer APIs from SkAtomics.h to make it a bit more efficient.

No public API changes.
TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1039323002
2015-03-30 08:13:34 -07:00
reed
7da19014fd use Sk4f for matrix math
Need to land SK_SUPPORT_LEGACY_SCALAR_MAPPOINTS in chrome to suppress Affine
version which causes slight differences (which will need to be rebaselined)

BUG=skia:

Review URL: https://codereview.chromium.org/1045493002
2015-03-29 11:58:48 -07:00
reed
d8b34c26c2 use table of procs (and unrolling) to speed up mapPts
BUG=skia:

Review URL: https://codereview.chromium.org/1040783002
2015-03-27 14:00:41 -07:00
scroggo
5cffba8d8e Remove SkMemoryStream::peek()
I'd like to add a new API to SkStream for peeking - i.e. reading some
bytes without advancing the stream. This will be implemented for the
streams where it makes sense. I think the function should look
something like the following:

size_t peek(void* buffer, size_t bytesToRead) {
     return this->onPeek(buffer, bytesToRead);
}

virtual size_t onPeek(void* buffer, size_t bytesToRead) {
    return 0;   // unimplemented base class.
}

In order to avoid confusion, I'd like to remove SkMemoryStream::peek(),
which is not currently used internally, by Chrome, or by Android as far
as I can tell. There is also another function does the same thing:
getPosition().

BUG=skia:3257

Review URL: https://codereview.chromium.org/1039373002
2015-03-27 13:27:51 -07:00
halcanary
a096d7a6d0 SkCodec: add wbmp class
Review URL: https://codereview.chromium.org/1006583005
2015-03-27 12:16:53 -07:00
robertphillips
1d24b8dfe9 Add matrix constructing helpers to SkMatrix
Review URL: https://codereview.chromium.org/1034273002
2015-03-26 19:57:08 -07:00
caryclark
d8bc16b306 add legacy pathop enums; fix uninitialized warning
R=reed@google.com
BUG=skia:3588
NOTREECHECKS=true
NOTRY=true
NOPRESUBMIT=true

Review URL: https://codereview.chromium.org/1034073004
2015-03-26 09:05:12 -07:00
caryclark
54359294a7 cumulative pathops patch
Replace the implicit curve intersection with a geometric curve intersection. The implicit intersection proved mathematically unstable and took a long time to zero in on an answer.

Use pointers instead of indices to refer to parts of curves. Indices required awkward renumbering.

Unify t and point values so that small intervals can be eliminated in one pass.

Break cubics up front to eliminate loops and cusps.

Make the Simplify and Op code more regular and eliminate arbitrary differences.

Add a builder that takes an array of paths and operators.

Delete unused code.

BUG=skia:3588
R=reed@google.com

Review URL: https://codereview.chromium.org/1037573004
2015-03-26 07:52:43 -07:00
fmalita
65cdb57ae8 Add a paint filter utility canvas (SkPaintFilterCanvas)
Introduce a paint filter proxy base class as a SkDrawFilter replacement,
and convert SkDebugCanvas to use the new approach.

BUG=skia:3587
R=reed@google.com,mtklein@google.com,robertphillips@google.com,tomhudson@google.com

Review URL: https://codereview.chromium.org/1032173002
2015-03-26 07:24:48 -07:00
halcanary
b880d7f87e SkCodec: conditionally remove fInfo
Review URL: https://codereview.chromium.org/1029423005
2015-03-26 06:29:03 -07:00
mtklein
36352bf5e3 C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}
NOPRESUBMIT=true

BUG=skia:
DOCS_PREVIEW= https://skia.org/?cl=1037793002

Review URL: https://codereview.chromium.org/1037793002
2015-03-25 18:17:32 -07:00
djsollen
59f9ec7e9c Replace error checking mutex initializer with the glibc-compatible version
No public API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1038733002
2015-03-25 13:47:13 -07:00
joshualitt
2af858354d simple patch to always init SkTextBlob uniqueID
BUG=skia:

Review URL: https://codereview.chromium.org/1036613002
2015-03-25 13:40:13 -07:00
scroggo
05245900bf Add scanline decoding to SkCodec.
Add an interface for decoding scanlines, and implement that interface
in the PNG decoder.

Use a separate method to determine whether an image that used a type
with alpha was actually opaque.

SkScanlineDecoder.h:
New interface for decoding scanlines.

SkCodec.h:
Add getScanlineDecoder.
Add a virtual function (with non-virtual caller) for determining
whether the image truly had alpha. The client can call this to
determine if the image was actually opaque if it reported having alpha.
Remove code to sneakily change the passed in alpha type.

SkCodec_libpng.*:
Split up code onGetPixels into helper functions that can be shared with
the scanline decoder.
Implement scanline decoding.
Implement onReallyHasAlpha.

SkSwizzler.*:
Add a new SrcConfig as a default, which is invalid.
Add a function for setting fDstRow directly.
Assert fDstRow is not NULL.

BUG=skia:3257

Review URL: https://codereview.chromium.org/1010903003
2015-03-25 11:11:52 -07:00
msarett
9bde918754 Enabling ico decoding with use of png and bmp decoders
BUG=skia:3257

NOPRESUBMIT=true

Review URL: https://codereview.chromium.org/1011343003
2015-03-25 05:27:48 -07:00
reed
0dc4dd6dda Revert of pathops version two (patchset #16 id:150001 of https://codereview.chromium.org/1002693002/)
Reason for revert:
ASAN investigation

Original issue's description:
> pathops version two
>
> R=reed@google.com
>
> marked 'no commit' to attempt to get trybots to run
>
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/ccec0f958ffc71a9986d236bc2eb335cb2111119

TBR=caryclark@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1029993002
2015-03-24 13:55:33 -07:00
tomhudson
7aa846c683 Revert of Enabling ico decoding with use of png and bmp decoders (patchset #10 id:280001 of https://codereview.chromium.org/1011343003/)
Reason for revert:
Reverting on suspicion of massive bot failures - possible command line too long?

Original issue's description:
> Enabling ico decoding with use of png and bmp decoders
>
> BUG=skia:3257
>
> Committed: https://skia.googlesource.com/skia/+/15bfd075d38e4422a477e22940d06a137f66cc97

TBR=scroggo@google.com,reed@google.com,djsollen@google.com,msarett@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:3257

Review URL: https://codereview.chromium.org/1022843005
2015-03-24 13:47:41 -07:00
msarett
15bfd075d3 Enabling ico decoding with use of png and bmp decoders
BUG=skia:3257

Review URL: https://codereview.chromium.org/1011343003
2015-03-24 12:24:27 -07:00
senorblanco
8c24d453a2 Move SkMatrixImageFilter.h into src/core.
Callers in Blink have been updated to call
SkImageFilter::CreateMatrixFilter() instead.

BUG=skia:3568

Review URL: https://codereview.chromium.org/1013753013
2015-03-24 07:51:30 -07:00
caryclark
ccec0f958f pathops version two
R=reed@google.com

marked 'no commit' to attempt to get trybots to run

TBR=reed@google.com

Review URL: https://codereview.chromium.org/1002693002
2015-03-24 07:28:17 -07:00