| OLD | NEW |
| 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 <deque> | 5 #include <deque> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 DecoderTester* decoder_tester, | 296 DecoderTester* decoder_tester, |
| 297 scoped_refptr<CaptureData> data, | 297 scoped_refptr<CaptureData> data, |
| 298 const SkIRect* rects, int count) { | 298 const SkIRect* rects, int count) { |
| 299 data->mutable_dirty_region().setRects(rects, count); | 299 data->mutable_dirty_region().setRects(rects, count); |
| 300 encoder_tester->AddRects(rects, count); | 300 encoder_tester->AddRects(rects, count); |
| 301 decoder_tester->AddRects(rects, count); | 301 decoder_tester->AddRects(rects, count); |
| 302 | 302 |
| 303 // Generate random data for the updated region. | 303 // Generate random data for the updated region. |
| 304 srand(0); | 304 srand(0); |
| 305 for (int i = 0; i < count; ++i) { | 305 for (int i = 0; i < count; ++i) { |
| 306 const int bytes_per_pixel = GetBytesPerPixel(data->pixel_format()); | 306 CHECK_EQ(data->pixel_format(), media::VideoFrame::RGB32); |
| 307 const int bytes_per_pixel = 4; // Because of RGB32 on previous line. |
| 307 const int row_size = bytes_per_pixel * rects[i].width(); | 308 const int row_size = bytes_per_pixel * rects[i].width(); |
| 308 uint8* memory = data->data_planes().data[0] + | 309 uint8* memory = data->data_planes().data[0] + |
| 309 data->data_planes().strides[0] * rects[i].top() + | 310 data->data_planes().strides[0] * rects[i].top() + |
| 310 bytes_per_pixel * rects[i].left(); | 311 bytes_per_pixel * rects[i].left(); |
| 311 for (int y = 0; y < rects[i].height(); ++y) { | 312 for (int y = 0; y < rects[i].height(); ++y) { |
| 312 for (int x = 0; x < row_size; ++x) | 313 for (int x = 0; x < row_size; ++x) |
| 313 memory[x] = rand() % 256; | 314 memory[x] = rand() % 256; |
| 314 memory += data->data_planes().strides[0]; | 315 memory += data->data_planes().strides[0]; |
| 315 } | 316 } |
| 316 } | 317 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 341 kTestRects, 1); | 342 kTestRects, 1); |
| 342 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, | 343 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, |
| 343 kTestRects + 1, 1); | 344 kTestRects + 1, 1); |
| 344 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, | 345 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, |
| 345 kTestRects + 2, 1); | 346 kTestRects + 2, 1); |
| 346 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, | 347 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, |
| 347 kTestRects + 3, 2); | 348 kTestRects + 3, 2); |
| 348 } | 349 } |
| 349 | 350 |
| 350 } // namespace remoting | 351 } // namespace remoting |
| OLD | NEW |