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 "ui/gfx/compositor/compositor.h" | 5 #include "ui/gfx/compositor/compositor.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin
t.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin
t.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 void Compositor::didCommitAndDrawFrame() { | 296 void Compositor::didCommitAndDrawFrame() { |
297 FOR_EACH_OBSERVER(CompositorObserver, | 297 FOR_EACH_OBSERVER(CompositorObserver, |
298 observer_list_, | 298 observer_list_, |
299 OnCompositingStarted(this)); | 299 OnCompositingStarted(this)); |
300 } | 300 } |
301 | 301 |
302 void Compositor::didCompleteSwapBuffers() { | 302 void Compositor::didCompleteSwapBuffers() { |
303 NotifyEnd(); | 303 NotifyEnd(); |
304 } | 304 } |
305 | 305 |
306 void Compositor::scheduleComposite() { | 306 #if defined(WEBLAYERTREEVIEWCLIENT_SCHEDULECOMPOSITE_RETURNS_BOOL) |
| 307 #define SCHEDULECOMPOSITE_RETURN_TYPE bool |
| 308 #else |
| 309 #define SCHEDULECOMPOSITE_RETURN_TYPE void |
| 310 #endif |
| 311 |
| 312 SCHEDULECOMPOSITE_RETURN_TYPE Compositor::scheduleComposite() { |
307 ScheduleDraw(); | 313 ScheduleDraw(); |
| 314 #if defined(WEBLAYERTREEVIEWCLIENT_SCHEDULECOMPOSITE_RETURNS_BOOL) |
| 315 return true; |
| 316 #endif |
308 } | 317 } |
309 | 318 |
310 void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, | 319 void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, |
311 const gfx::Size& image_size) { | 320 const gfx::Size& image_size) { |
312 // Swizzle from RGBA to BGRA | 321 // Swizzle from RGBA to BGRA |
313 size_t bitmap_size = 4 * image_size.width() * image_size.height(); | 322 size_t bitmap_size = 4 * image_size.width() * image_size.height(); |
314 for(size_t i = 0; i < bitmap_size; i += 4) | 323 for(size_t i = 0; i < bitmap_size; i += 4) |
315 std::swap(pixels[i], pixels[i + 2]); | 324 std::swap(pixels[i], pixels[i + 2]); |
316 | 325 |
317 // Vertical flip to transform from GL co-ords | 326 // Vertical flip to transform from GL co-ords |
(...skipping 27 matching lines...) Expand all Loading... |
345 | 354 |
346 COMPOSITOR_EXPORT void DisableTestCompositor() { | 355 COMPOSITOR_EXPORT void DisableTestCompositor() { |
347 test_compositor_enabled = false; | 356 test_compositor_enabled = false; |
348 } | 357 } |
349 | 358 |
350 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 359 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
351 return test_compositor_enabled; | 360 return test_compositor_enabled; |
352 } | 361 } |
353 | 362 |
354 } // namespace ui | 363 } // namespace ui |
OLD | NEW |