diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-07-06 09:12:59 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-07-06 09:12:59 -0600 |
commit | 0f8095b950dd144497919cfea65a1f154ed3ae9a (patch) | |
tree | e974ee11b9c5820e54ba40cff225ef92947932f7 /components/script/dom/canvasrenderingcontext2d.rs | |
parent | a3821bf24094bf5bb2a9553e66b69da3b6430aa5 (diff) | |
parent | 8438db89e151ed07b32a5b37fd4c4f903605c126 (diff) | |
download | servo-0f8095b950dd144497919cfea65a1f154ed3ae9a.tar.gz servo-0f8095b950dd144497919cfea65a1f154ed3ae9a.zip |
Auto merge of #6380 - ecoal95:webgl-refactoring, r=jdm
Refactor WebGL implementation to move logic inside the DOM interfaces
This improves the encapsulation and consistency in our WebGL
implementation.
Also allows to implement new methods such as `getShaderSource()`.
It will also allow us to use `delete()` in the destructors of them (note
that we will probably want to keep track of them from the context before).
Some concerns:
**Trait method repetition**:
I'm aware that the traits `WebGL{Buffer,Renderbuffer,Framebuffer,Texture}Helpers` are basically the same, but `delete()` and `id()` methods are everywhere. I've thought something like:
```rust
pub trait WebGLIdentifiable {
type WebGLId; // id is sometimes i32 (see WebGLUniformLocation)
fn id(&self) -> Self::WebGLId;
}
pub trait WebGLBindable {
fn bind(&self);
}
pub trait WebGLDeletable {
fn delete(&self);
}
```
But I'd want to know your opinion first.
**`renderer` repetition**:
Thought of moving the field: `renderer: Sender<CanvasMsg>` to `WebGLObject`, but I think it makes it way more complicated to read, and also a bit unnecessary, at least IMO (`WebGLObject` will never interact with the field directly). It would also mean that all `WebGLObject`s should have one, which is true at this moment, but maybe not with WebGL 2, for example.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6380)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/canvasrenderingcontext2d.rs')
0 files changed, 0 insertions, 0 deletions