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

Side by Side Diff: media/renderers/skcanvas_video_renderer_unittest.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 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 | « media/blink/webmediaplayer_cast_android.cc ('k') | printing/emf_win.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <GLES3/gl3.h> 5 #include <GLES3/gl3.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/aligned_memory.h" 9 #include "base/memory/aligned_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 scoped_refptr<media::VideoFrame> video_frame = 547 scoped_refptr<media::VideoFrame> video_frame =
548 CreateTestY16Frame(gfx::Size(stride, offset_y + bitmap.height()), rect, 548 CreateTestY16Frame(gfx::Size(stride, offset_y + bitmap.height()), rect,
549 memory.get(), cropped_frame()->timestamp()); 549 memory.get(), cropped_frame()->timestamp());
550 550
551 cc::SkiaPaintCanvas canvas(bitmap); 551 cc::SkiaPaintCanvas canvas(bitmap);
552 cc::PaintFlags flags; 552 cc::PaintFlags flags;
553 flags.setFilterQuality(kNone_SkFilterQuality); 553 flags.setFilterQuality(kNone_SkFilterQuality);
554 renderer_.Paint(video_frame, &canvas, 554 renderer_.Paint(video_frame, &canvas,
555 gfx::RectF(bitmap.width(), bitmap.height()), flags, 555 gfx::RectF(bitmap.width(), bitmap.height()), flags,
556 VIDEO_ROTATION_0, Context3D()); 556 VIDEO_ROTATION_0, Context3D());
557 SkAutoLockPixels lock(bitmap);
558 for (int j = 0; j < bitmap.height(); j++) { 557 for (int j = 0; j < bitmap.height(); j++) {
559 for (int i = 0; i < bitmap.width(); i++) { 558 for (int i = 0; i < bitmap.width(); i++) {
560 const int value = i + j * bitmap.width(); 559 const int value = i + j * bitmap.width();
561 EXPECT_EQ(SkColorSetRGB(value, value, value), bitmap.getColor(i, j)); 560 EXPECT_EQ(SkColorSetRGB(value, value, value), bitmap.getColor(i, j));
562 } 561 }
563 } 562 }
564 } 563 }
565 564
566 namespace { 565 namespace {
567 class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub { 566 class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 EXPECT_EQ(expected_value, data[(i + j * width)]); 792 EXPECT_EQ(expected_value, data[(i + j * width)]);
794 } 793 }
795 } 794 }
796 }); 795 });
797 SkCanvasVideoRenderer::TexSubImage2D(GL_TEXTURE_2D, &gles2, video_frame.get(), 796 SkCanvasVideoRenderer::TexSubImage2D(GL_TEXTURE_2D, &gles2, video_frame.get(),
798 0, GL_RED, GL_FLOAT, 2 /*xoffset*/, 797 0, GL_RED, GL_FLOAT, 2 /*xoffset*/,
799 1 /*yoffset*/, false /*flip_y*/, true); 798 1 /*yoffset*/, false /*flip_y*/, true);
800 } 799 }
801 800
802 } // namespace media 801 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_cast_android.cc ('k') | printing/emf_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698