diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-02 15:06:08 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-02 15:06:08 +0000 |
commit | b88d2742f13529b4b4caaa3dbc5a709d6be788d3 (patch) | |
tree | 8fa352c0850ca46b80bc188bb58b5eccfacd12a0 /ui | |
parent | 58609aee1bcc733af2addbfb9b7a88e2b7dd9461 (diff) | |
download | chromium_src-b88d2742f13529b4b4caaa3dbc5a709d6be788d3.zip chromium_src-b88d2742f13529b4b4caaa3dbc5a709d6be788d3.tar.gz chromium_src-b88d2742f13529b4b4caaa3dbc5a709d6be788d3.tar.bz2 |
Changes to port holey layer changes into windows compositor
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7582029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99368 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gfx/compositor/compositor.h | 3 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_gl.cc | 4 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_gl.h | 5 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_win.cc | 38 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.cc | 4 |
5 files changed, 18 insertions, 36 deletions
diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h index 42bb770..01e20e7 100644 --- a/ui/gfx/compositor/compositor.h +++ b/ui/gfx/compositor/compositor.h @@ -52,9 +52,6 @@ class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { const gfx::Point& origin, const gfx::Size& overall_size) = 0; - // Draws the texture. - virtual void Draw(const ui::TextureDrawParams& params) = 0; - // Draws the portion of the texture contained within clip_bounds virtual void Draw(const ui::TextureDrawParams& params, const gfx::Rect& clip_bounds_in_texture) = 0; diff --git a/ui/gfx/compositor/compositor_gl.cc b/ui/gfx/compositor/compositor_gl.cc index c9e6dfa..ee1a38d 100644 --- a/ui/gfx/compositor/compositor_gl.cc +++ b/ui/gfx/compositor/compositor_gl.cc @@ -345,10 +345,6 @@ void TextureGL::SetCanvas(const SkCanvas& canvas, } } -void TextureGL::Draw(const ui::TextureDrawParams& params) { - Draw(params, gfx::Rect(0, 0, size_.width(), size_.height())); -} - void TextureGL::Draw(const ui::TextureDrawParams& params, const gfx::Rect& clip_bounds_in_texture) { SharedResources* instance = SharedResources::GetInstance(); diff --git a/ui/gfx/compositor/compositor_gl.h b/ui/gfx/compositor/compositor_gl.h index cfa4756..c89d47b 100644 --- a/ui/gfx/compositor/compositor_gl.h +++ b/ui/gfx/compositor/compositor_gl.h @@ -71,11 +71,6 @@ class COMPOSITOR_EXPORT TextureGL : public Texture { const gfx::Point& origin, const gfx::Size& overall_size) OVERRIDE; - // Draws the texture. - // TODO(pkotwicz) merge these two methods into one, this method currently - // doesn't make sense in the context of windows - virtual void Draw(const ui::TextureDrawParams& params) OVERRIDE; - virtual void Draw(const ui::TextureDrawParams& params, const gfx::Rect& clip_bounds_in_texture) OVERRIDE; diff --git a/ui/gfx/compositor/compositor_win.cc b/ui/gfx/compositor/compositor_win.cc index 346fd13..3c0a2ff 100644 --- a/ui/gfx/compositor/compositor_win.cc +++ b/ui/gfx/compositor/compositor_win.cc @@ -55,7 +55,6 @@ class ViewTexture : public Texture { virtual void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin, const gfx::Size& overall_size) OVERRIDE; - virtual void Draw(const ui::TextureDrawParams& params) OVERRIDE; virtual void Draw(const ui::TextureDrawParams& params, const gfx::Rect& clip_bounds_in_texture) OVERRIDE; @@ -67,7 +66,8 @@ class ViewTexture : public Texture { void ConvertBitmapToD3DData(const SkBitmap& bitmap, scoped_array<uint32>* converted_data); - void CreateVertexBuffer(const gfx::Size& size); + // Creates vertex buffer for specified region + void CreateVertexBufferForRegion(const gfx::Rect& bounds); scoped_refptr<CompositorWin> compositor_; @@ -197,8 +197,6 @@ ViewTexture::~ViewTexture() { void ViewTexture::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin, const gfx::Size& overall_size) { - if (view_size_ != overall_size) - CreateVertexBuffer(overall_size); view_size_ = overall_size; scoped_array<uint32> converted_data; @@ -241,7 +239,8 @@ void ViewTexture::SetCanvas(const SkCanvas& canvas, } } -void ViewTexture::Draw(const ui::TextureDrawParams& params) { +void ViewTexture::Draw(const ui::TextureDrawParams& params, + const gfx::Rect& clip_bounds) { compositor_->UpdatePerspective(params.transform, view_size_); // Make texture active. @@ -258,6 +257,7 @@ void ViewTexture::Draw(const ui::TextureDrawParams& params) { UINT stride = sizeof(Vertex); UINT offset = 0; + CreateVertexBufferForRegion(clip_bounds); ID3D10Buffer* vertex_buffer = vertex_buffer_.get(); device_->IASetVertexBuffers(0, 1, &vertex_buffer, &stride, &offset); device_->IASetIndexBuffer(compositor_->GetTextureIndexBuffer(), @@ -265,11 +265,6 @@ void ViewTexture::Draw(const ui::TextureDrawParams& params) { device_->DrawIndexed(6, 0, 0); } -void ViewTexture::Draw(const ui::TextureDrawParams& params, - const gfx::Rect& clip_bounds_in_texture) { - NOTIMPLEMENTED(); -} - void ViewTexture::Errored(HRESULT result) { // TODO: figure out error handling. DCHECK(false); @@ -296,18 +291,21 @@ void ViewTexture::ConvertBitmapToD3DData( } } -void ViewTexture::CreateVertexBuffer(const gfx::Size& size) { +void ViewTexture::CreateVertexBufferForRegion(const gfx::Rect& bounds) { vertex_buffer_.Release(); - const gfx::Size& host_size = compositor_->size(); - float x = static_cast<float>(host_size.width()) / 2.0f; - float y = static_cast<float>(host_size.height()) / 2.0f; - float w = static_cast<float>(size.width()); - float h = static_cast<float>(size.height()); + float x = bounds.x(); + float max_x = bounds.right(); + float y = bounds.y(); + float max_y = bounds.bottom(); + float tex_x = x / static_cast<float>(view_size_.width()); + float max_tex_x = max_x / static_cast<float>(view_size_.width()); + float tex_y = y / static_cast<float>(view_size_.width()); + float max_tex_y = max_y / static_cast<float>(view_size_.height()); Vertex vertices[] = { - { D3DXVECTOR3(0.0f, -h, 0.0f), D3DXVECTOR2(0.0f, 1.0f) }, - { D3DXVECTOR3(0.0f, 0.0f, 0.0f), D3DXVECTOR2(0.0f, 0.0f) }, - { D3DXVECTOR3( w, 0.0f, 0.0f), D3DXVECTOR2(1.0f, 0.0f) }, - { D3DXVECTOR3( w, -h, 0.0f), D3DXVECTOR2(1.0f, 1.0f) }, + { D3DXVECTOR3( x, -max_y, 0.0f), D3DXVECTOR2( tex_x, max_tex_y) }, + { D3DXVECTOR3( x, -y, 0.0f), D3DXVECTOR2( tex_x, tex_y) }, + { D3DXVECTOR3(max_x, -y, 0.0f), D3DXVECTOR2(max_tex_x, tex_y) }, + { D3DXVECTOR3(max_x, -max_y, 0.0f), D3DXVECTOR2(max_tex_x, max_tex_y) } }; // Create the vertex buffer containing the points. diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc index bf22832..67a34a8 100644 --- a/ui/gfx/compositor/layer.cc +++ b/ui/gfx/compositor/layer.cc @@ -133,9 +133,6 @@ void Layer::Draw() { texture_draw_params.blend = parent_ != NULL && !fills_bounds_opaquely_; texture_draw_params.compositor_size = compositor_->size(); -#if defined(OS_WIN) - texture_->Draw(texture_draw_params); -#else hole_rect_ = hole_rect_.Intersect( gfx::Rect(0, 0, bounds_.width(), bounds_.height())); @@ -162,7 +159,6 @@ void Layer::Draw() { hole_rect_.bottom(), bounds_.width(), bounds_.height() - hole_rect_.bottom())); -#endif } void Layer::DrawRegion(const ui::TextureDrawParams& params, |