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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_surface_unittest.cc

Issue 2011713003: Roll skia to 8cc209111876b7c78b5ec577c9221d8ed5e21024 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "third_party/skia/include/core/SkColor.h" 8 #include "third_party/skia/include/core/SkColor.h"
9 #include "third_party/skia/include/core/SkDevice.h" 9 #include "third_party/skia/include/core/SkDevice.h"
10 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" 10 #include "ui/ozone/platform/drm/gpu/crtc_controller.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 SkPaint paint; 98 SkPaint paint;
99 paint.setColor(SK_ColorWHITE); 99 paint.setColor(SK_ColorWHITE);
100 SkRect rect = 100 SkRect rect =
101 SkRect::MakeWH(kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2); 101 SkRect::MakeWH(kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2);
102 surface_->GetSurface()->getCanvas()->drawRect(rect, paint); 102 surface_->GetSurface()->getCanvas()->drawRect(rect, paint);
103 surface_->PresentCanvas( 103 surface_->PresentCanvas(
104 gfx::Rect(0, 0, kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2)); 104 gfx::Rect(0, 0, kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2));
105 drm_->RunCallbacks(); 105 drm_->RunCallbacks();
106 106
107 SkBitmap image; 107 SkBitmap image;
108 std::vector<skia::RefPtr<SkSurface>> framebuffers; 108 std::vector<sk_sp<SkSurface>> framebuffers;
109 for (const auto& buffer : drm_->buffers()) { 109 for (const auto& buffer : drm_->buffers()) {
110 // Skip cursor buffers. 110 // Skip cursor buffers.
111 if (buffer->width() == kDefaultCursorSize && 111 if (buffer->width() == kDefaultCursorSize &&
112 buffer->height() == kDefaultCursorSize) 112 buffer->height() == kDefaultCursorSize)
113 continue; 113 continue;
114 114
115 framebuffers.push_back(buffer); 115 framebuffers.push_back(buffer);
116 } 116 }
117 117
118 // Buffer 0 is the modesetting buffer, buffer 1 is the frontbuffer and buffer 118 // Buffer 0 is the modesetting buffer, buffer 1 is the frontbuffer and buffer
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 paint.setColor(SK_ColorRED); 151 paint.setColor(SK_ColorRED);
152 rect.SetRect(0, kDefaultMode.vdisplay / 2, kDefaultMode.hdisplay / 2, 152 rect.SetRect(0, kDefaultMode.vdisplay / 2, kDefaultMode.hdisplay / 2,
153 kDefaultMode.vdisplay / 2); 153 kDefaultMode.vdisplay / 2);
154 surface_->GetSurface()->getCanvas()->drawRect(RectToSkRect(rect), paint); 154 surface_->GetSurface()->getCanvas()->drawRect(RectToSkRect(rect), paint);
155 surface_->PresentCanvas(rect); 155 surface_->PresentCanvas(rect);
156 156
157 drm_->RunCallbacks(); 157 drm_->RunCallbacks();
158 158
159 SkBitmap image; 159 SkBitmap image;
160 std::vector<skia::RefPtr<SkSurface>> framebuffers; 160 std::vector<sk_sp<SkSurface>> framebuffers;
161 for (const auto& buffer : drm_->buffers()) { 161 for (const auto& buffer : drm_->buffers()) {
162 // Skip cursor buffers. 162 // Skip cursor buffers.
163 if (buffer->width() == kDefaultCursorSize && 163 if (buffer->width() == kDefaultCursorSize &&
164 buffer->height() == kDefaultCursorSize) 164 buffer->height() == kDefaultCursorSize)
165 continue; 165 continue;
166 166
167 framebuffers.push_back(buffer); 167 framebuffers.push_back(buffer);
168 } 168 }
169 169
170 // Buffer 0 is the modesetting buffer, buffer 1 is the backbuffer and buffer 170 // Buffer 0 is the modesetting buffer, buffer 1 is the backbuffer and buffer
(...skipping 11 matching lines...) Expand all
182 for (int j = 0; j < image.width(); ++j) { 182 for (int j = 0; j < image.width(); ++j) {
183 if (j < kDefaultMode.hdisplay / 2 && i < kDefaultMode.vdisplay / 2) 183 if (j < kDefaultMode.hdisplay / 2 && i < kDefaultMode.vdisplay / 2)
184 EXPECT_EQ(SK_ColorWHITE, image.getColor(j, i)); 184 EXPECT_EQ(SK_ColorWHITE, image.getColor(j, i));
185 else if (j < kDefaultMode.hdisplay / 2) 185 else if (j < kDefaultMode.hdisplay / 2)
186 EXPECT_EQ(SK_ColorRED, image.getColor(j, i)); 186 EXPECT_EQ(SK_ColorRED, image.getColor(j, i));
187 else 187 else
188 EXPECT_EQ(SK_ColorBLACK, image.getColor(j, i)); 188 EXPECT_EQ(SK_ColorBLACK, image.getColor(j, i));
189 } 189 }
190 } 190 }
191 } 191 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_surface.cc ('k') | ui/ozone/platform/drm/gpu/drm_window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698