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

Side by Side Diff: ui/gl/test/gl_image_test_template.h

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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/gl/test/egl_initialization_displays_unittest.cc ('k') | ui/gl/test/gl_test_helper.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // This file defines tests that implementations of GLImage should pass in order 5 // This file defines tests that implementations of GLImage should pass in order
6 // to be conformant. 6 // to be conformant.
7 7
8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_
9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_
10 10
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include "base/memory/scoped_ptr.h" 13 #include <memory>
14
14 #include "base/strings/stringize_macros.h" 15 #include "base/strings/stringize_macros.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "ui/gfx/buffer_format_util.h" 19 #include "ui/gfx/buffer_format_util.h"
19 #include "ui/gfx/buffer_types.h" 20 #include "ui/gfx/buffer_types.h"
20 #include "ui/gl/gl_bindings.h" 21 #include "ui/gl/gl_bindings.h"
21 #include "ui/gl/gl_context.h" 22 #include "ui/gl/gl_context.h"
22 #include "ui/gl/gl_helper.h" 23 #include "ui/gl/gl_helper.h"
23 #include "ui/gl/gl_image.h" 24 #include "ui/gl/gl_image.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 251
251 // Create a solid color green image of preferred format. This must succeed 252 // Create a solid color green image of preferred format. This must succeed
252 // in order for a GLImage to be conformant. 253 // in order for a GLImage to be conformant.
253 scoped_refptr<gl::GLImage> image = 254 scoped_refptr<gl::GLImage> image =
254 this->delegate_.CreateSolidColorImage(image_size, image_color); 255 this->delegate_.CreateSolidColorImage(image_size, image_color);
255 ASSERT_TRUE(image); 256 ASSERT_TRUE(image);
256 257
257 // Create a solid color blue texture of the same size as |image|. 258 // Create a solid color blue texture of the same size as |image|.
258 unsigned target = this->delegate_.GetTextureTarget(); 259 unsigned target = this->delegate_.GetTextureTarget();
259 GLuint texture = GLTestHelper::CreateTexture(target); 260 GLuint texture = GLTestHelper::CreateTexture(target);
260 scoped_ptr<uint8_t[]> pixels(new uint8_t[BufferSizeForBufferFormat( 261 std::unique_ptr<uint8_t[]> pixels(new uint8_t[BufferSizeForBufferFormat(
261 image_size, gfx::BufferFormat::RGBA_8888)]); 262 image_size, gfx::BufferFormat::RGBA_8888)]);
262 GLImageTestSupport::SetBufferDataToColor( 263 GLImageTestSupport::SetBufferDataToColor(
263 image_size.width(), image_size.height(), 264 image_size.width(), image_size.height(),
264 static_cast<int>(RowSizeForBufferFormat(image_size.width(), 265 static_cast<int>(RowSizeForBufferFormat(image_size.width(),
265 gfx::BufferFormat::RGBA_8888, 0)), 266 gfx::BufferFormat::RGBA_8888, 0)),
266 0, gfx::BufferFormat::RGBA_8888, texture_color, pixels.get()); 267 0, gfx::BufferFormat::RGBA_8888, texture_color, pixels.get());
267 glBindTexture(target, texture); 268 glBindTexture(target, texture);
268 glTexImage2D(target, 0, GL_RGBA, image_size.width(), image_size.height(), 0, 269 glTexImage2D(target, 0, GL_RGBA, image_size.width(), image_size.height(), 0,
269 GL_RGBA, GL_UNSIGNED_BYTE, pixels.get()); 270 GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
270 271
(...skipping 14 matching lines...) Expand all
285 image->Destroy(true /* have_context */); 286 image->Destroy(true /* have_context */);
286 } 287 }
287 288
288 // The GLImageCopyTest test case verifies that the GLImage implementation 289 // The GLImageCopyTest test case verifies that the GLImage implementation
289 // handles CopyTexImage correctly. 290 // handles CopyTexImage correctly.
290 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); 291 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage);
291 292
292 } // namespace gl 293 } // namespace gl
293 294
294 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ 295 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_
OLDNEW
« no previous file with comments | « ui/gl/test/egl_initialization_displays_unittest.cc ('k') | ui/gl/test/gl_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698