diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-02 17:16:48 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-02 17:16:48 +0000 |
commit | 7b432b1bb0a077e8af60cbc735a386848a8fe243 (patch) | |
tree | a2f43ad646ac8a0953e9e5487d2ca6319e04e858 /ui | |
parent | 5b744912851ee478198d9a407e654acb5b5694e6 (diff) | |
download | chromium_src-7b432b1bb0a077e8af60cbc735a386848a8fe243.zip chromium_src-7b432b1bb0a077e8af60cbc735a386848a8fe243.tar.gz chromium_src-7b432b1bb0a077e8af60cbc735a386848a8fe243.tar.bz2 |
Makes the compositors handle updating part of a texture when the
texture is sized to a new size.
BUG=none
TEST=none
R=piman@chromium.org,ben@chromium.org
Review URL: http://codereview.chromium.org/8351054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gfx/compositor/compositor_gl.cc | 12 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_win.cc | 21 |
2 files changed, 13 insertions, 20 deletions
diff --git a/ui/gfx/compositor/compositor_gl.cc b/ui/gfx/compositor/compositor_gl.cc index 2b2c102..c28195c 100644 --- a/ui/gfx/compositor/compositor_gl.cc +++ b/ui/gfx/compositor/compositor_gl.cc @@ -354,7 +354,7 @@ void TextureGL::SetCanvas(const SkCanvas& canvas, glBindTexture(GL_TEXTURE_2D, texture_id_); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_.width(), size_.height(), 0, - GL_RGBA, GL_UNSIGNED_BYTE, pixels); + GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -365,13 +365,13 @@ void TextureGL::SetCanvas(const SkCanvas& canvas, glBindTexture(GL_TEXTURE_2D, texture_id_); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_.width(), size_.height(), 0, - GL_RGBA, GL_UNSIGNED_BYTE, pixels); - } else { // Uploading partial texture. + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } else { glBindTexture(GL_TEXTURE_2D, texture_id_); - glTexSubImage2D(GL_TEXTURE_2D, 0, origin.x(), origin.y(), - bitmap.width(), bitmap.height(), - GL_RGBA, GL_UNSIGNED_BYTE, pixels); } + glTexSubImage2D(GL_TEXTURE_2D, 0, origin.x(), origin.y(), + bitmap.width(), bitmap.height(), + GL_RGBA, GL_UNSIGNED_BYTE, pixels); } void TextureGL::Draw(const ui::TextureDrawParams& params, diff --git a/ui/gfx/compositor/compositor_win.cc b/ui/gfx/compositor/compositor_win.cc index f00310f..18c71c9 100644 --- a/ui/gfx/compositor/compositor_win.cc +++ b/ui/gfx/compositor/compositor_win.cc @@ -219,25 +219,18 @@ void ViewTexture::SetCanvas(const SkCanvas& canvas, texture_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE; texture_desc.CPUAccessFlags = 0; texture_desc.MiscFlags = 0; - D3D10_SUBRESOURCE_DATA texture_data; - texture_data.pSysMem = converted_data.get(); - texture_data.SysMemPitch = texture_desc.Width * 4; - texture_data.SysMemSlicePitch = 0; RETURN_IF_FAILED(device_->CreateTexture2D(&texture_desc, - &texture_data, - texture_.Receive())); + NULL, texture_.Receive())); RETURN_IF_FAILED( device_->CreateShaderResourceView(texture_.get(), NULL, shader_view_.Receive())); - } else { - // Only part of the texture was updated. - DCHECK(texture_.get()); - D3D10_BOX dst_box = { origin.x(), origin.y(), 0, - origin.x() + bitmap.width(), - origin.y() + bitmap.height(), 1 }; - device_->UpdateSubresource(texture_.get(), 0, &dst_box, - converted_data.get(), bitmap.width() * 4, 0); } + DCHECK(texture_.get()); + D3D10_BOX dst_box = { origin.x(), origin.y(), 0, + origin.x() + bitmap.width(), + origin.y() + bitmap.height(), 1 }; + device_->UpdateSubresource(texture_.get(), 0, &dst_box, + converted_data.get(), bitmap.width() * 4, 0); } void ViewTexture::Draw(const ui::TextureDrawParams& params, |