Commit graph

295 commits

Author SHA1 Message Date
Anthony Ramine
2c0acf6b9b Move PixelFormat to the pixels crate 2018-11-20 10:14:52 +01:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Anthony Ramine
a5779ad372 Prefix some pixels functions with rgba8_ 2018-11-16 12:37:34 +01:00
Simon Sapin
9f977c5287 Remove useless use crate_name; imports.
A `crate_name::foo` path always works in 2018
2018-11-08 09:29:52 +01:00
Simon Sapin
2012be4a8b cargo fix --edition-idioms 2018-11-08 09:28:00 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Simon Sapin
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
Anthony Ramine
bb2101f540 Simplify ctx.drawImage a bit
There is no need to swap between RGBA and BGRA twice.
2018-10-11 15:46:42 +02:00
Anthony Ramine
6c469b90b1 Share some code between 2D canvas and WebGL 2018-10-09 14:57:02 +02:00
Anthony Ramine
551c405b0f Avoid ctx.getImageData in canvas.toDataURL 2018-10-08 12:19:10 +02:00
Anthony Ramine
77c28bdfc9 Abstract some stuff common to ctx.getImageData and ctx.putImageData 2018-10-08 11:39:09 +02:00
Anthony Ramine
e62dbabb46 Handle some transparent black cases in ctx.getImageData 2018-10-07 02:52:06 +02:00
Anthony Ramine
241dba064d Align ctx.createImageData and ctx.getImageData with the spec 2018-10-06 11:41:48 +02:00
Anthony Ramine
75e6f5dfaa Avoid copying pixels in ctx.putImageData sometimes 2018-10-06 02:59:25 +02:00
Anthony Ramine
19f40cdf0b Introduce ImageData::get_rect
We use that to send only the pixels that will be actually drawn to the
canvas thread in CanvasRenderingContext2d::PutImageData.

We also make the canvas thread byte swap and premultiply colours in-place.
2018-10-06 01:12:05 +02:00
Anthony Ramine
784fbb2bc1 Merge some byte swap/premultiply functions in their own crate 2018-10-06 01:11:55 +02:00
Anthony Ramine
82c7d71811 Improve gl.putImageData
This commit should allow us to send smaller blobs to the canvas thread,
I made it into its own commit just to try=wpt.
2018-10-05 17:07:58 +02:00
Anthony Ramine
3d910feb3a Align canvas.putImageData with spec
The arguments are supposed to be long values, not floats.
2018-10-05 17:07:56 +02:00
Anthony Ramine
62ea3c093a Move canvas.putImageData checks to the DOM side 2018-10-05 00:35:39 +02:00
Anthony Ramine
a3392610c3 Make HTMLCanvasElement::get_size return a Size2D<u32>
The changes keep trickling down.
2018-10-02 14:21:06 +02:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Anthony Ramine
8c100b23b1 Implement proper origin checks for WebGL textures (fixes #21522) 2018-09-18 10:33:42 +02:00
Anthony Ramine
36c8cd229e Remove Canvas2dMsg::DrawImageSelf
Now that all canvas share the same thread, it's useless to have a separate message
for that.
2018-09-17 16:24:01 +02:00
Anthony Ramine
f1e8eb640c Don't create 2D canvas contexts arbitrarily
Sometimes, the canvas still has no rendering context, in this case it represents
a transparent black rectangle.
2018-09-16 20:44:41 +02:00
Anthony Ramine
3528ef30e5 Update CanvasRenderingContext2D WebIDL definition
CanvasImageSource was never supposed to include CanvasRenderingContext2D.
2018-09-14 14:48:42 +02:00
Anthony Ramine
2f2331f149 Use a byte channel to retrieve pixels of 2D canvas 2018-09-13 22:04:30 +02:00
Anthony Ramine
b5c469d52e Merge byte swap and unmultiplying loops in ctx.getImageData() 2018-09-13 22:04:30 +02:00
Brody-Eastwood
f3065f3707 Moved Canvas rendering to a single thread. 2018-04-23 20:50:05 -04:00
Brody Eastwood
8a1590efc6 Add unique canvas IDs to all canvas operations. 2018-04-02 22:02:22 -04:00
Anthony Ramine
ce81420bef Use ByteBuf for the canvas messages
The type Vec<u8> is super unefficient to work with in Serde if all you want
to represent is a simple blob.
2018-03-26 20:48:02 +02:00
Nakul Jindal
7d4e2b11e9 Implements profiler for blocked recv 2018-03-22 11:48:27 -07:00
Alex Fong
8d09398230 Avoid Window::GetComputedStyle when checking for display: none 2018-02-26 19:07:04 +08:00
Josh Matthews
0e211d0d8f Revert "Send IPC receiver for canvas as part of CreateCanvasPaintThread message"
This reverts commit a504c9358b.
2017-12-18 10:51:00 -05:00
tigercosmos
a504c9358b Send IPC receiver for canvas as part of CreateCanvasPaintThread message 2017-12-16 12:04:59 +08:00
tigercosmos
80a81f2774 use entry global's origin in is_origin_clean check for canvas rendering 2017-12-05 15:10:55 +08:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Simon Sapin
aa15dc269f Remove use of unstable box syntax.
http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.

This is expected since `Box::new` is defined as:

```rust
impl<T> Box<T> {
    #[inline(always)]
    pub fn new(x: T) -> Box<T> {
        box x
    }
}
```

With inlining, it should compile to the same as box syntax.
2017-10-16 17:16:20 +02:00
Anthony Ramine
f87c2a8d76 Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
2017-09-26 09:49:10 +02:00
Anthony Ramine
577370746e Rename DOMRefCell<T> to DomRefCell<T>
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
e2dac78d36 Rename LayoutJS<T> to LayoutDom<T> 2017-09-26 09:49:04 +02:00
Anthony Ramine
7be32fb237 Rename JS<T> to Dom<T> 2017-09-26 09:48:55 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Joone Hur
57e283aaab Implement Ellipse Canvas 2D API
* Update rust-azure to 0.21.0
* Mark the following test case as fail:
  tests/wpt/mozilla/tests/mozilla/css-paint-api/background-image-tiled.html
* Make the ellipse test case pass.

BUG: https://github.com/servo/servo/issues/17598
2017-09-01 16:04:06 -07:00
bors-servo
4743696189 Auto merge of #18179 - davidcl:master, r=jdm
Automatically verify that derive() lists are alphabetically ordered #…

<!-- Please describe your changes on the following line: -->
Automatically verify that derive() lists are alphabetically ordered #18172

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #18172 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18179)
<!-- Reviewable:end -->
2017-08-23 17:18:31 -05:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
Bruno Bernardino
2af828485f
Implement CanvasRenderingContext2d.fillText's "unimplemented" message 2017-08-23 17:34:55 +01:00
Anthony Ramine
676f2c8acf Revert "Auto merge of #18114 - emilio:revert-webgl-refactor, r=nox"
This reverts commit 4d10d39e8f, reversing
changes made to ee94e2b7c0.
2017-08-16 23:23:18 +02:00
Emilio Cobos Álvarez
cfe22e3979
Revert "Auto merge of #17891 - MortimerGoro:webgl_move, r=glennw,emilio"
This reverts commit 90f55ea458, reversing
changes made to 2e60b27a21.
2017-08-16 16:42:13 +02:00