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

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

Issue 11299262: ui: Use skia::RefPtr<T> for implicit safe reference counting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: winbuild Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/detachable_toolbar_view.cc ('k') | ui/gfx/canvas.h » ('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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/shared_memory.h" 6 #include "base/shared_memory.h"
7 #include "skia/ext/platform_canvas.h" 7 #include "skia/ext/platform_canvas.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/blit.h" 9 #include "ui/gfx/blit.h"
10 #include "ui/gfx/point.h" 10 #include "ui/gfx/point.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 #if defined(OS_WIN) 138 #if defined(OS_WIN)
139 139
140 TEST(Blit, WithSharedMemory) { 140 TEST(Blit, WithSharedMemory) {
141 const int kCanvasWidth = 5; 141 const int kCanvasWidth = 5;
142 const int kCanvasHeight = 5; 142 const int kCanvasHeight = 5;
143 base::SharedMemory shared_mem; 143 base::SharedMemory shared_mem;
144 ASSERT_TRUE(shared_mem.CreateAnonymous(kCanvasWidth * kCanvasHeight)); 144 ASSERT_TRUE(shared_mem.CreateAnonymous(kCanvasWidth * kCanvasHeight));
145 base::SharedMemoryHandle section = shared_mem.handle(); 145 base::SharedMemoryHandle section = shared_mem.handle();
146 SkCanvas* canvas = skia::CreatePlatformCanvas(kCanvasWidth, kCanvasHeight, 146 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(
147 true, section, skia::RETURN_NULL_ON_FAILURE); 147 skia::CreatePlatformCanvas(kCanvasWidth, kCanvasHeight, true, section,
148 ASSERT_TRUE(NULL != canvas); 148 skia::RETURN_NULL_ON_FAILURE));
149 SkAutoUnref aur(canvas); 149 ASSERT_TRUE(canvas);
150 shared_mem.Close(); 150 shared_mem.Close();
151 151
152 uint8 initial_values[kCanvasHeight][kCanvasWidth] = { 152 uint8 initial_values[kCanvasHeight][kCanvasWidth] = {
153 { 0x00, 0x01, 0x02, 0x03, 0x04 }, 153 { 0x00, 0x01, 0x02, 0x03, 0x04 },
154 { 0x10, 0x11, 0x12, 0x13, 0x14 }, 154 { 0x10, 0x11, 0x12, 0x13, 0x14 },
155 { 0x20, 0x21, 0x22, 0x23, 0x24 }, 155 { 0x20, 0x21, 0x22, 0x23, 0x24 },
156 { 0x30, 0x31, 0x32, 0x33, 0x34 }, 156 { 0x30, 0x31, 0x32, 0x33, 0x34 },
157 { 0x40, 0x41, 0x42, 0x43, 0x44 }}; 157 { 0x40, 0x41, 0x42, 0x43, 0x44 }};
158 SetToCanvas<5, 5>(canvas, initial_values); 158 SetToCanvas<5, 5>(canvas.get(), initial_values);
159 159
160 // Sanity check on input. 160 // Sanity check on input.
161 VerifyCanvasValues<5, 5>(canvas, initial_values); 161 VerifyCanvasValues<5, 5>(canvas.get(), initial_values);
162 } 162 }
163 163
164 #endif 164 #endif
165 165
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/detachable_toolbar_view.cc ('k') | ui/gfx/canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698