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

Side by Side Diff: ui/ozone/platform/dri/dri_surface.cc

Issue 535963002: ozone: Directly provide size of active mode from HardwareDisplayController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | ui/ozone/platform/dri/gbm_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/ozone/platform/dri/dri_surface.h" 5 #include "ui/ozone/platform/dri/dri_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkSurface.h" 10 #include "third_party/skia/include/core/SkSurface.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 SkImageInfo info = SkImageInfo::MakeN32( 51 SkImageInfo info = SkImageInfo::MakeN32(
52 viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType); 52 viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType);
53 surface_ = skia::AdoptRef(SkSurface::NewRaster(info)); 53 surface_ = skia::AdoptRef(SkSurface::NewRaster(info));
54 54
55 HardwareDisplayController* controller = window_delegate_->GetController(); 55 HardwareDisplayController* controller = window_delegate_->GetController();
56 if (!controller) 56 if (!controller)
57 return; 57 return;
58 58
59 // For the display buffers use the mode size since a |viewport_size| smaller 59 // For the display buffers use the mode size since a |viewport_size| smaller
60 // than the display size will not scanout. 60 // than the display size will not scanout.
61 gfx::Size mode_size(controller->get_mode().hdisplay,
62 controller->get_mode().vdisplay);
63 for (size_t i = 0; i < arraysize(buffers_); ++i) 61 for (size_t i = 0; i < arraysize(buffers_); ++i)
64 buffers_[i] = AllocateBuffer(dri_, mode_size); 62 buffers_[i] = AllocateBuffer(dri_, controller->GetModeSize());
65 } 63 }
66 64
67 void DriSurface::PresentCanvas(const gfx::Rect& damage) { 65 void DriSurface::PresentCanvas(const gfx::Rect& damage) {
68 DCHECK(base::MessageLoopForUI::IsCurrent()); 66 DCHECK(base::MessageLoopForUI::IsCurrent());
69 DCHECK(buffers_[front_buffer_ ^ 1]); 67 DCHECK(buffers_[front_buffer_ ^ 1]);
70 68
71 HardwareDisplayController* controller = window_delegate_->GetController(); 69 HardwareDisplayController* controller = window_delegate_->GetController();
72 if (!controller) 70 if (!controller)
73 return; 71 return;
74 72
(...skipping 19 matching lines...) Expand all
94 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); 92 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_));
95 93
96 // Copy damage region. 94 // Copy damage region.
97 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); 95 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot());
98 image->draw(canvas, &real_damage, real_damage, NULL); 96 image->draw(canvas, &real_damage, real_damage, NULL);
99 97
100 last_damage_ = damage; 98 last_damage_ = damage;
101 } 99 }
102 100
103 } // namespace ui 101 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/dri/gbm_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698