diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-27 02:47:22 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-27 02:47:22 +0000 |
commit | 892ad8a7cf97a64b584faa5d381a407058e38d78 (patch) | |
tree | 220cbd5609e9058b078e6ffba0c4b75f6be119b7 /ui/gfx | |
parent | c1d3e3b22d907664e72bcb222aa131da75a17e74 (diff) | |
download | chromium_src-892ad8a7cf97a64b584faa5d381a407058e38d78.zip chromium_src-892ad8a7cf97a64b584faa5d381a407058e38d78.tar.gz chromium_src-892ad8a7cf97a64b584faa5d381a407058e38d78.tar.bz2 |
Update Texture/Layer SetCanvas, callsites, and comments.
Fix TestTexture and ViewLayerTest compile.
BUG=90548
TEST=none
Review URL: http://codereview.chromium.org/7470030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/compositor/compositor.h | 8 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_gl.cc | 5 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_gl.h | 2 | ||||
-rw-r--r-- | ui/gfx/compositor/compositor_win.cc | 9 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.cc | 4 | ||||
-rw-r--r-- | ui/gfx/compositor/layer.h | 6 |
6 files changed, 18 insertions, 16 deletions
diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h index 7ca9dd1..46544e5 100644 --- a/ui/gfx/compositor/compositor.h +++ b/ui/gfx/compositor/compositor.h @@ -10,7 +10,7 @@ #include "ui/gfx/transform.h" #include "ui/gfx/native_widget_types.h" -class SkBitmap; +class SkCanvas; namespace gfx { class Point; class Rect; @@ -33,7 +33,7 @@ struct TextureDrawParams { }; // Textures are created by a Compositor for managing an accelerated view. -// Any time a View with a texture needs to redraw itself it invokes SetBitmap(). +// Any time a View with a texture needs to redraw itself it invokes SetCanvas(). // When the view is ready to be drawn Draw() is invoked. // // Texture is really a proxy to the gpu. Texture does not itself keep a copy of @@ -42,9 +42,9 @@ struct TextureDrawParams { // Views own the Texture. class Texture : public base::RefCounted<Texture> { public: - // Sets the bitmap of this texture. The bitmaps origin is at |origin|. + // Sets the canvas of this texture. The origin is at |origin|. // |overall_size| gives the total size of texture. - virtual void SetBitmap(const SkBitmap& bitmap, + virtual void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin, const gfx::Size& overall_size) = 0; diff --git a/ui/gfx/compositor/compositor_gl.cc b/ui/gfx/compositor/compositor_gl.cc index ddd2ad8..3df7fee 100644 --- a/ui/gfx/compositor/compositor_gl.cc +++ b/ui/gfx/compositor/compositor_gl.cc @@ -10,7 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/threading/thread_restrictions.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "third_party/skia/include/core/SkDevice.h" #include "third_party/skia/include/core/SkMatrix.h" #include "third_party/skia/include/core/SkScalar.h" #include "ui/gfx/rect.h" @@ -292,9 +292,10 @@ TextureGL::~TextureGL() { } } -void TextureGL::SetBitmap(const SkBitmap& bitmap, +void TextureGL::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin, const gfx::Size& overall_size) { + const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false); // Verify bitmap pixels are contiguous. DCHECK_EQ(bitmap.rowBytes(), SkBitmap::ComputeRowBytes(bitmap.config(), bitmap.width())); diff --git a/ui/gfx/compositor/compositor_gl.h b/ui/gfx/compositor/compositor_gl.h index dc7f187..759c653 100644 --- a/ui/gfx/compositor/compositor_gl.h +++ b/ui/gfx/compositor/compositor_gl.h @@ -25,7 +25,7 @@ class TextureGL : public Texture { public: explicit TextureGL(CompositorGL* compositor); - virtual void SetBitmap(const SkBitmap& bitmap, + virtual void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin, const gfx::Size& overall_size) OVERRIDE; diff --git a/ui/gfx/compositor/compositor_win.cc b/ui/gfx/compositor/compositor_win.cc index 0019dae..c938525 100644 --- a/ui/gfx/compositor/compositor_win.cc +++ b/ui/gfx/compositor/compositor_win.cc @@ -14,7 +14,7 @@ #include "base/string_piece.h" #include "base/win/scoped_comptr.h" #include "grit/gfx_resources.h" -#include "third_party/skia/include/core/SkBitmap.h" +#include "third_party/skia/include/core/SkCanvas.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/rect.h" @@ -44,7 +44,7 @@ struct Vertex { // D3D 10 Texture implementation. Creates a quad representing the view and // a texture with the bitmap data. The quad has an origin of 0,0,0 with a size -// matching that of |SetBitmap|. +// matching that of |SetCanvas|. class ViewTexture : public Texture { public: ViewTexture(CompositorWin* compositor, @@ -52,7 +52,7 @@ class ViewTexture : public Texture { ID3D10Effect* effect); // Texture: - virtual void SetBitmap(const SkBitmap& bitmap, + virtual void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin, const gfx::Size& overall_size) OVERRIDE; virtual void Draw(const ui::TextureDrawParams& params) OVERRIDE; @@ -198,7 +198,7 @@ ViewTexture::ViewTexture(CompositorWin* compositor, ViewTexture::~ViewTexture() { } -void ViewTexture::SetBitmap(const SkBitmap& bitmap, +void ViewTexture::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin, const gfx::Size& overall_size) { if (view_size_ != overall_size) @@ -206,6 +206,7 @@ void ViewTexture::SetBitmap(const SkBitmap& bitmap, view_size_ = overall_size; scoped_array<uint32> converted_data; + const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false); ConvertBitmapToD3DData(bitmap, &converted_data); if (gfx::Size(bitmap.width(), bitmap.height()) == overall_size) { shader_view_.Release(); diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc index ddcfb5a..ec2bf41 100644 --- a/ui/gfx/compositor/layer.cc +++ b/ui/gfx/compositor/layer.cc @@ -46,8 +46,8 @@ void Layer::SetTexture(ui::Texture* texture) { texture_ = texture; } -void Layer::SetBitmap(const SkBitmap& bitmap, const gfx::Point& origin) { - texture_->SetBitmap(bitmap, origin, bounds_.size()); +void Layer::SetCanvas(const SkCanvas& canvas, const gfx::Point& origin) { + texture_->SetCanvas(canvas, origin, bounds_.size()); } void Layer::Draw() { diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h index 00574cc..e06a1f5 100644 --- a/ui/gfx/compositor/layer.h +++ b/ui/gfx/compositor/layer.h @@ -12,7 +12,7 @@ #include "ui/gfx/rect.h" #include "ui/gfx/transform.h" -class SkBitmap; +class SkCanvas; namespace ui { @@ -59,8 +59,8 @@ class Layer { void SetTexture(ui::Texture* texture); const ui::Texture* texture() const { return texture_.get(); } - // Resets the bitmap of the texture. - void SetBitmap(const SkBitmap& bitmap, const gfx::Point& origin); + // Resets the canvas of the texture. + void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); // Draws the layer. void Draw(); |