diff options
author | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 03:29:30 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 03:29:30 +0000 |
commit | 55af09e5315808c31b9a915d79395ab3edcfee45 (patch) | |
tree | b7ccaffadf3d326b1b5fcd642d149338f33e5c1b /cc | |
parent | d3e172f206dabce5adfd7249b2f1a6b6c5ed8713 (diff) | |
download | chromium_src-55af09e5315808c31b9a915d79395ab3edcfee45.zip chromium_src-55af09e5315808c31b9a915d79395ab3edcfee45.tar.gz chromium_src-55af09e5315808c31b9a915d79395ab3edcfee45.tar.bz2 |
change SoftwareOutputDevice CopyToBitmap to CopyToPixels, and remove device_ member variable
- SkDevice is deprecated
- unneeded with cleaner SkCanvas::readPixels() signature
Review URL: https://codereview.chromium.org/197703006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/output/software_output_device.cc | 18 | ||||
-rw-r--r-- | cc/output/software_output_device.h | 5 | ||||
-rw-r--r-- | cc/output/software_renderer.cc | 6 |
3 files changed, 11 insertions, 18 deletions
diff --git a/cc/output/software_output_device.cc b/cc/output/software_output_device.cc index d066f4c..428ba9b 100644 --- a/cc/output/software_output_device.cc +++ b/cc/output/software_output_device.cc @@ -6,7 +6,6 @@ #include "base/logging.h" #include "cc/output/software_frame_data.h" -#include "third_party/skia/include/core/SkBitmapDevice.h" #include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/skia_util.h" #include "ui/gfx/vsync_provider.h" @@ -21,14 +20,14 @@ void SoftwareOutputDevice::Resize(const gfx::Size& viewport_size) { if (viewport_size_ == viewport_size) return; + SkImageInfo info = SkImageInfo::MakeN32( + viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType); viewport_size_ = viewport_size; - device_ = skia::AdoptRef(new SkBitmapDevice(SkBitmap::kARGB_8888_Config, - viewport_size.width(), viewport_size.height(), true)); - canvas_ = skia::AdoptRef(new SkCanvas(device_.get())); + canvas_ = skia::AdoptRef(SkCanvas::NewRaster(info)); } SkCanvas* SoftwareOutputDevice::BeginPaint(const gfx::Rect& damage_rect) { - DCHECK(device_); + DCHECK(canvas_); damage_rect_ = damage_rect; return canvas_.get(); } @@ -41,11 +40,10 @@ void SoftwareOutputDevice::EndPaint(SoftwareFrameData* frame_data) { frame_data->handle = base::SharedMemory::NULLHandle(); } -void SoftwareOutputDevice::CopyToBitmap( - const gfx::Rect& rect, SkBitmap* output) { - DCHECK(device_); - const SkBitmap& bitmap = device_->accessBitmap(false); - bitmap.extractSubset(output, gfx::RectToSkIRect(rect)); +void SoftwareOutputDevice::CopyToPixels(const gfx::Rect& rect, void* pixels) { + DCHECK(canvas_); + SkImageInfo info = SkImageInfo::MakeN32Premul(rect.width(), rect.height()); + canvas_->readPixels(info, pixels, info.minRowBytes(), rect.x(), rect.y()); } void SoftwareOutputDevice::Scroll(const gfx::Vector2d& delta, diff --git a/cc/output/software_output_device.h b/cc/output/software_output_device.h index f03e964..e371654 100644 --- a/cc/output/software_output_device.h +++ b/cc/output/software_output_device.h @@ -50,8 +50,8 @@ class CC_EXPORT SoftwareOutputDevice { virtual void EndPaint(SoftwareFrameData* frame_data); // Copies pixels inside |rect| from the current software framebuffer to - // |output|. Fails if there is no current softwareframebuffer. - virtual void CopyToBitmap(const gfx::Rect& rect, SkBitmap* output); + // |pixels|. Fails if there is no current softwareframebuffer. + virtual void CopyToPixels(const gfx::Rect& rect, void* pixels); // Blit the pixel content of the SoftwareOutputDevice by |delta| with the // write clipped to |clip_rect|. @@ -76,7 +76,6 @@ class CC_EXPORT SoftwareOutputDevice { protected: gfx::Size viewport_size_; gfx::Rect damage_rect_; - skia::RefPtr<SkBaseDevice> device_; skia::RefPtr<SkCanvas> canvas_; scoped_ptr<gfx::VSyncProvider> vsync_provider_; diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index 778755f..4f132a1 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -648,13 +648,9 @@ void SoftwareRenderer::EnsureBackbuffer() { void SoftwareRenderer::GetFramebufferPixels(void* pixels, const gfx::Rect& rect) { TRACE_EVENT0("cc", "SoftwareRenderer::GetFramebufferPixels"); - SkBitmap subset_bitmap; gfx::Rect frame_rect(rect); frame_rect += current_viewport_rect_.OffsetFromOrigin(); - output_device_->CopyToBitmap(frame_rect, &subset_bitmap); - subset_bitmap.copyPixelsTo(pixels, - 4 * frame_rect.width() * frame_rect.height(), - 4 * frame_rect.width()); + output_device_->CopyToPixels(frame_rect, pixels); } void SoftwareRenderer::SetVisible(bool visible) { |