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

Side by Side Diff: content/browser/compositor/software_output_device_ozone.cc

Issue 249413003: ozone: dri: Composite to intermediate surface & copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor cleanup Created 6 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/compositor/software_output_device_ozone.h" 5 #include "content/browser/compositor/software_output_device_ozone.h"
6 #include "third_party/skia/include/core/SkDevice.h" 6 #include "third_party/skia/include/core/SkDevice.h"
7 #include "ui/compositor/compositor.h" 7 #include "ui/compositor/compositor.h"
8 #include "ui/gfx/ozone/surface_factory_ozone.h" 8 #include "ui/gfx/ozone/surface_factory_ozone.h"
9 #include "ui/gfx/ozone/surface_ozone_canvas.h" 9 #include "ui/gfx/ozone/surface_ozone_canvas.h"
10 #include "ui/gfx/skia_util.h" 10 #include "ui/gfx/skia_util.h"
(...skipping 27 matching lines...) Expand all
38 38
39 surface_ozone_->ResizeCanvas(viewport_size_); 39 surface_ozone_->ResizeCanvas(viewport_size_);
40 } 40 }
41 41
42 SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) { 42 SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) {
43 DCHECK(gfx::Rect(viewport_size_).Contains(damage_rect)); 43 DCHECK(gfx::Rect(viewport_size_).Contains(damage_rect));
44 44
45 // Get canvas for next frame. 45 // Get canvas for next frame.
46 canvas_ = surface_ozone_->GetCanvas(); 46 canvas_ = surface_ozone_->GetCanvas();
47 47
48 canvas_->clipRect(gfx::RectToSkRect(damage_rect), SkRegion::kReplace_Op);
49 // Save the current state so we can restore once we're done drawing. This is
50 // saved after the clip since we want to keep the clip information after we're
51 // done drawing such that OZONE knows what was updated.
52 canvas_->save();
53
54 return SoftwareOutputDevice::BeginPaint(damage_rect); 48 return SoftwareOutputDevice::BeginPaint(damage_rect);
55 } 49 }
56 50
57 void SoftwareOutputDeviceOzone::EndPaint(cc::SoftwareFrameData* frame_data) { 51 void SoftwareOutputDeviceOzone::EndPaint(cc::SoftwareFrameData* frame_data) {
58 SoftwareOutputDevice::EndPaint(frame_data); 52 SoftwareOutputDevice::EndPaint(frame_data);
59 53
60 canvas_->restore(); 54 surface_ozone_->PresentCanvas(damage_rect_);
61
62 if (damage_rect_.IsEmpty())
63 return;
64
65 bool scheduled = surface_ozone_->PresentCanvas();
66 DCHECK(scheduled) << "Failed to present canvas";
danakj 2014/04/23 19:05:38 Can this be expected to fail more than before? Or
spang 2014/04/23 20:57:18 Changing to void sounds fine to me. The error path
67 } 55 }
68 56
69 } // namespace content 57 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698