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

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

Issue 959953002: [Ozone-Dri] Do not call AddFramebuffer with cursor buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 9 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 | « ui/ozone/platform/dri/dri_buffer.cc ('k') | ui/ozone/platform/dri/dri_surface_unittest.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/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "third_party/skia/include/core/SkSurface.h" 11 #include "third_party/skia/include/core/SkSurface.h"
12 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/skia_util.h" 13 #include "ui/gfx/skia_util.h"
14 #include "ui/ozone/platform/dri/dri_buffer.h" 14 #include "ui/ozone/platform/dri/dri_buffer.h"
15 #include "ui/ozone/platform/dri/dri_vsync_provider.h" 15 #include "ui/ozone/platform/dri/dri_vsync_provider.h"
16 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" 16 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
17 #include "ui/ozone/platform/dri/dri_wrapper.h" 17 #include "ui/ozone/platform/dri/dri_wrapper.h"
18 #include "ui/ozone/platform/dri/hardware_display_controller.h" 18 #include "ui/ozone/platform/dri/hardware_display_controller.h"
19 19
20 namespace ui { 20 namespace ui {
21 21
22 namespace { 22 namespace {
23 23
24 scoped_refptr<DriBuffer> AllocateBuffer(const scoped_refptr<DriWrapper>& dri, 24 scoped_refptr<DriBuffer> AllocateBuffer(const scoped_refptr<DriWrapper>& dri,
25 const gfx::Size& size) { 25 const gfx::Size& size) {
26 scoped_refptr<DriBuffer> buffer(new DriBuffer(dri)); 26 scoped_refptr<DriBuffer> buffer(new DriBuffer(dri));
27 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); 27 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height());
28 28
29 bool initialized = buffer->Initialize(info); 29 bool initialized =
30 buffer->Initialize(info, true /* should_register_framebuffer */);
30 DCHECK(initialized) << "Failed to create drm buffer."; 31 DCHECK(initialized) << "Failed to create drm buffer.";
31 32
32 return buffer; 33 return buffer;
33 } 34 }
34 35
35 } // namespace 36 } // namespace
36 37
37 DriSurface::DriSurface(DriWindowDelegate* window_delegate) 38 DriSurface::DriSurface(DriWindowDelegate* window_delegate)
38 : window_delegate_(window_delegate), buffers_(), front_buffer_(0) { 39 : window_delegate_(window_delegate), buffers_(), front_buffer_(0) {
39 } 40 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); 91 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_));
91 92
92 // Copy damage region. 93 // Copy damage region.
93 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); 94 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot());
94 canvas->drawImageRect(image.get(), &real_damage, real_damage, NULL); 95 canvas->drawImageRect(image.get(), &real_damage, real_damage, NULL);
95 96
96 last_damage_ = damage; 97 last_damage_ = damage;
97 } 98 }
98 99
99 } // namespace ui 100 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_buffer.cc ('k') | ui/ozone/platform/dri/dri_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698