Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: cc/software_output_device_impl.cc

Issue 11967033: [CLOSED] In-browser software compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the lack SkCanvas::clear scissoring. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/software_output_device_impl.h ('k') | cc/software_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/software_output_device_impl.h"
6
7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkDevice.h"
10
11 namespace cc {
12
13 SoftwareOutputDeviceImpl::SoftwareOutputDeviceImpl() {}
14
15 SoftwareOutputDeviceImpl::~SoftwareOutputDeviceImpl() {}
16
17 SkCanvas* SoftwareOutputDeviceImpl::BeginPaint() {
18 DCHECK(device_);
19 return canvas_.get();
20 }
21
22 void SoftwareOutputDeviceImpl::EndPaint(const gfx::Rect& damage_rect) {
23 DCHECK(device_);
24 }
25
26 void SoftwareOutputDeviceImpl::Resize(const gfx::Size& viewport_size) {
27 if (viewport_size_ == viewport_size)
28 return;
29
30 viewport_size_ = viewport_size;
31 device_ = skia::AdoptRef(new SkDevice(SkBitmap::kARGB_8888_Config,
32 viewport_size.width(), viewport_size.height(), true));
33 canvas_ = skia::AdoptRef(new SkCanvas(device_.get()));
34 }
35
36 void SoftwareOutputDeviceImpl::CopyToBitmap(
37 const gfx::Rect& rect, SkBitmap* output) {
38 DCHECK(device_);
39 SkIRect invertRect = SkIRect::MakeXYWH(
40 rect.x(), viewport_size_.height() - rect.bottom(),
41 rect.width(), rect.height());
42 const SkBitmap& bitmap = device_->accessBitmap(false);
43 bitmap.extractSubset(output, invertRect);
44 }
45
46 void SoftwareOutputDeviceImpl::Scroll(
47 const gfx::Vector2d& delta, const gfx::Rect& clip_rect) {
48 NOTIMPLEMENTED();
49 }
50
51 } // namespace cc
OLDNEW
« no previous file with comments | « cc/software_output_device_impl.h ('k') | cc/software_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698