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

Side by Side Diff: ui/gfx/blit_unittest.cc

Issue 2595023002: clean-up and clarify CreatePlatformCanvas methods (Closed)
Patch Set: single decl of CreatePlatformCanvasWithPixels Created 3 years, 12 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 | « skia/ext/skia_utils_mac.mm ('k') | ui/surface/transport_dib_posix.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/memory/shared_memory.h" 7 #include "base/memory/shared_memory.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "skia/ext/platform_canvas.h" 9 #include "skia/ext/platform_canvas.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 #if defined(OS_WIN) 147 #if defined(OS_WIN)
148 148
149 TEST(Blit, WithSharedMemory) { 149 TEST(Blit, WithSharedMemory) {
150 const int kCanvasWidth = 5; 150 const int kCanvasWidth = 5;
151 const int kCanvasHeight = 5; 151 const int kCanvasHeight = 5;
152 base::SharedMemory shared_mem; 152 base::SharedMemory shared_mem;
153 ASSERT_TRUE(shared_mem.CreateAnonymous(kCanvasWidth * kCanvasHeight)); 153 ASSERT_TRUE(shared_mem.CreateAnonymous(kCanvasWidth * kCanvasHeight));
154 base::SharedMemoryHandle section = shared_mem.handle(); 154 base::SharedMemoryHandle section = shared_mem.handle();
155 std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas( 155 std::unique_ptr<SkCanvas> canvas =
156 kCanvasWidth, kCanvasHeight, true, section.GetHandle(), 156 skia::CreatePlatformCanvasWithSharedSection(kCanvasWidth, kCanvasHeight,
157 skia::RETURN_NULL_ON_FAILURE); 157 true, section.GetHandle(),
158 skia::RETURN_NULL_ON_FAILURE);
158 ASSERT_TRUE(canvas); 159 ASSERT_TRUE(canvas);
159 shared_mem.Close(); 160 shared_mem.Close();
160 161
161 uint8_t initial_values[kCanvasHeight][kCanvasWidth] = { 162 uint8_t initial_values[kCanvasHeight][kCanvasWidth] = {
162 {0x00, 0x01, 0x02, 0x03, 0x04}, 163 {0x00, 0x01, 0x02, 0x03, 0x04},
163 {0x10, 0x11, 0x12, 0x13, 0x14}, 164 {0x10, 0x11, 0x12, 0x13, 0x14},
164 {0x20, 0x21, 0x22, 0x23, 0x24}, 165 {0x20, 0x21, 0x22, 0x23, 0x24},
165 {0x30, 0x31, 0x32, 0x33, 0x34}, 166 {0x30, 0x31, 0x32, 0x33, 0x34},
166 {0x40, 0x41, 0x42, 0x43, 0x44}}; 167 {0x40, 0x41, 0x42, 0x43, 0x44}};
167 SetToCanvas<5, 5>(canvas.get(), initial_values); 168 SetToCanvas<5, 5>(canvas.get(), initial_values);
168 169
169 // Sanity check on input. 170 // Sanity check on input.
170 VerifyCanvasValues<5, 5>(canvas.get(), initial_values); 171 VerifyCanvasValues<5, 5>(canvas.get(), initial_values);
171 } 172 }
172 173
173 #endif 174 #endif
174 175
OLDNEW
« no previous file with comments | « skia/ext/skia_utils_mac.mm ('k') | ui/surface/transport_dib_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698