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

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

Issue 297573003: Make delegated software renderer work on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebas Created 6 years, 7 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 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 12 matching lines...) Expand all
23 23
24 if (!surface_ozone_) 24 if (!surface_ozone_)
25 LOG(FATAL) << "Failed to initialize canvas"; 25 LOG(FATAL) << "Failed to initialize canvas";
26 26
27 vsync_provider_ = surface_ozone_->CreateVSyncProvider(); 27 vsync_provider_ = surface_ozone_->CreateVSyncProvider();
28 } 28 }
29 29
30 SoftwareOutputDeviceOzone::~SoftwareOutputDeviceOzone() { 30 SoftwareOutputDeviceOzone::~SoftwareOutputDeviceOzone() {
31 } 31 }
32 32
33 void SoftwareOutputDeviceOzone::Resize(const gfx::Size& viewport_size) { 33 void SoftwareOutputDeviceOzone::Resize(const gfx::Size& viewport_pixel_size,
34 if (viewport_size_ == viewport_size) 34 float scale_factor) {
35 scale_factor_ = scale_factor;
36
37 if (viewport_pixel_size_ == viewport_pixel_size)
35 return; 38 return;
36 39
37 viewport_size_ = viewport_size; 40 viewport_pixel_size_ = viewport_pixel_size;
38 41
39 surface_ozone_->ResizeCanvas(viewport_size_); 42 surface_ozone_->ResizeCanvas(viewport_pixel_size_);
40 } 43 }
41 44
42 SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) { 45 SkCanvas* SoftwareOutputDeviceOzone::BeginPaint(const gfx::Rect& damage_rect) {
43 DCHECK(gfx::Rect(viewport_size_).Contains(damage_rect)); 46 DCHECK(gfx::Rect(viewport_pixel_size_).Contains(damage_rect));
44 47
45 // Get canvas for next frame. 48 // Get canvas for next frame.
46 canvas_ = surface_ozone_->GetCanvas(); 49 canvas_ = surface_ozone_->GetCanvas();
47 50
48 return SoftwareOutputDevice::BeginPaint(damage_rect); 51 return SoftwareOutputDevice::BeginPaint(damage_rect);
49 } 52 }
50 53
51 void SoftwareOutputDeviceOzone::EndPaint(cc::SoftwareFrameData* frame_data) { 54 void SoftwareOutputDeviceOzone::EndPaint(cc::SoftwareFrameData* frame_data) {
52 SoftwareOutputDevice::EndPaint(frame_data); 55 SoftwareOutputDevice::EndPaint(frame_data);
53 56
54 surface_ozone_->PresentCanvas(damage_rect_); 57 surface_ozone_->PresentCanvas(damage_rect_);
55 } 58 }
56 59
57 } // namespace content 60 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698