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

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

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/aura/software_output_device_ozone.h" 5 #include "content/browser/aura/software_output_device_ozone.h"
6 #include "third_party/skia/include/core/SkBitmapDevice.h" 6 #include "third_party/skia/include/core/SkBitmapDevice.h"
7 #include "third_party/skia/include/core/SkDevice.h" 7 #include "third_party/skia/include/core/SkDevice.h"
8 #include "ui/compositor/compositor.h" 8 #include "ui/compositor/compositor.h"
9 #include "ui/gfx/ozone/surface_factory_ozone.h" 9 #include "ui/gfx/ozone/surface_factory_ozone.h"
10 #include "ui/gfx/skia_util.h" 10 #include "ui/gfx/skia_util.h"
(...skipping 27 matching lines...) Expand all
38 gfx::Rect bounds(viewport_size_); 38 gfx::Rect bounds(viewport_size_);
39 39
40 gfx::SurfaceFactoryOzone* factory = gfx::SurfaceFactoryOzone::GetInstance(); 40 gfx::SurfaceFactoryOzone* factory = gfx::SurfaceFactoryOzone::GetInstance();
41 factory->AttemptToResizeAcceleratedWidget(compositor_->widget(), 41 factory->AttemptToResizeAcceleratedWidget(compositor_->widget(),
42 bounds); 42 bounds);
43 43
44 canvas_ = skia::SharePtr(factory->GetCanvasForWidget(realized_widget_)); 44 canvas_ = skia::SharePtr(factory->GetCanvasForWidget(realized_widget_));
45 device_ = skia::SharePtr(canvas_->getDevice()); 45 device_ = skia::SharePtr(canvas_->getDevice());
46 } 46 }
47 47
48 SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(gfx::Rect damage_rect) { 48 SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) {
49 DCHECK(gfx::Rect(viewport_size_).Contains(damage_rect)); 49 DCHECK(gfx::Rect(viewport_size_).Contains(damage_rect));
50 50
51 canvas_->clipRect(gfx::RectToSkRect(damage_rect), SkRegion::kReplace_Op); 51 canvas_->clipRect(gfx::RectToSkRect(damage_rect), SkRegion::kReplace_Op);
52 // Save the current state so we can restore once we're done drawing. This is 52 // Save the current state so we can restore once we're done drawing. This is
53 // saved after the clip since we want to keep the clip information after we're 53 // saved after the clip since we want to keep the clip information after we're
54 // done drawing such that OZONE knows what was updated. 54 // done drawing such that OZONE knows what was updated.
55 canvas_->save(); 55 canvas_->save();
56 56
57 return SoftwareOutputDevice::BeginPaint(damage_rect); 57 return SoftwareOutputDevice::BeginPaint(damage_rect);
58 } 58 }
59 59
60 void SoftwareOutputDeviceOzone::EndPaint(cc::SoftwareFrameData* frame_data) { 60 void SoftwareOutputDeviceOzone::EndPaint(cc::SoftwareFrameData* frame_data) {
61 SoftwareOutputDevice::EndPaint(frame_data); 61 SoftwareOutputDevice::EndPaint(frame_data);
62 62
63 canvas_->restore(); 63 canvas_->restore();
64 64
65 if (damage_rect_.IsEmpty()) 65 if (damage_rect_.IsEmpty())
66 return; 66 return;
67 67
68 bool scheduled = gfx::SurfaceFactoryOzone::GetInstance()->SchedulePageFlip( 68 bool scheduled = gfx::SurfaceFactoryOzone::GetInstance()->SchedulePageFlip(
69 compositor_->widget()); 69 compositor_->widget());
70 DCHECK(scheduled) << "Failed to schedule pageflip"; 70 DCHECK(scheduled) << "Failed to schedule pageflip";
71 } 71 }
72 72
73 } // namespace content 73 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/aura/software_output_device_ozone.h ('k') | content/browser/aura/software_output_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698