Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Needed on Windows to get |M_PI| from math.h. | 5 // Needed on Windows to get |M_PI| from math.h. |
| 6 #ifdef _WIN32 | 6 #ifdef _WIN32 |
| 7 #define _USE_MATH_DEFINES | 7 #define _USE_MATH_DEFINES |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 #include <math.h> | 10 #include <math.h> |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 | 302 |
| 303 { | 303 { |
| 304 // Set the image layer | 304 // Set the image layer |
| 305 if (image_layer_.is_null()) { | 305 if (image_layer_.is_null()) { |
| 306 image_layer_ = compositor_.AddLayer(); | 306 image_layer_ = compositor_.AddLayer(); |
| 307 assert(!image_layer_.is_null()); | 307 assert(!image_layer_.is_null()); |
| 308 } | 308 } |
| 309 float x = frame % 800; | 309 float x = frame % 800; |
| 310 float y = 200 - 200 * factor_sin; | 310 float y = 200 - 200 * factor_sin; |
| 311 const float transform[16] = { | 311 const float transform[16] = { |
| 312 fabs(factor_sin) + 0.2f, 0.0f, 0.0f, 0.0f, | 312 fabsf(factor_sin) + 0.2f, 0.0f, 0.0f, 0.0f, |
| 313 0.0f, fabs(factor_sin) + 0.2f, 0.0f, 0.0f, | 313 0.0f, fabsf(factor_sin) + 0.2f, 0.0f, 0.0f, |
|
dmichael (off chromium)
2014/06/17 16:16:00
factor_sin is a float, and fabs is supposed to hav
| |
| 314 0.0f, 0.0f, 1.0f, 0.0f, | 314 0.0f, 0.0f, 1.0f, 0.0f, |
| 315 x, y, 0.0f, 1.0f, | 315 x, y, 0.0f, 1.0f, |
| 316 }; | 316 }; |
| 317 rv = image_layer_.SetTransform(transform); | 317 rv = image_layer_.SetTransform(transform); |
| 318 assert(rv == PP_OK); | 318 assert(rv == PP_OK); |
| 319 | 319 |
| 320 pp::ImageData image = PrepareImage(); | 320 pp::ImageData image = PrepareImage(); |
| 321 uint8_t *p = static_cast<uint8_t*>(image.data()); | 321 uint8_t *p = static_cast<uint8_t*>(image.data()); |
| 322 for (int x = 0; x < kImageWidth; ++x) { | 322 for (int x = 0; x < kImageWidth; ++x) { |
| 323 for (int y = 0; y < kImageHeight; ++y) { | 323 for (int y = 0; y < kImageHeight; ++y) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 }; | 430 }; |
| 431 | 431 |
| 432 } // anonymous namespace | 432 } // anonymous namespace |
| 433 | 433 |
| 434 namespace pp { | 434 namespace pp { |
| 435 // Factory function for your specialization of the Module object. | 435 // Factory function for your specialization of the Module object. |
| 436 Module* CreateModule() { | 436 Module* CreateModule() { |
| 437 return new DemoModule(); | 437 return new DemoModule(); |
| 438 } | 438 } |
| 439 } // namespace pp | 439 } // namespace pp |
| OLD | NEW |