| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 // The |backing_bitmap| must be clipped to the |plugin_rect| to avoid painting | 420 // The |backing_bitmap| must be clipped to the |plugin_rect| to avoid painting |
| 421 // outside the plugin area. This can happen if the plugin has been resized since | 421 // outside the plugin area. This can happen if the plugin has been resized since |
| 422 // PaintImageData verified the image is within the plugin size. | 422 // PaintImageData verified the image is within the plugin size. |
| 423 void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas, | 423 void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas, |
| 424 const gfx::Rect& plugin_rect, | 424 const gfx::Rect& plugin_rect, |
| 425 const gfx::Rect& paint_rect) { | 425 const gfx::Rect& paint_rect) { |
| 426 ImageDataAutoMapper auto_mapper(image_data_); | 426 ImageDataAutoMapper auto_mapper(image_data_); |
| 427 const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap(); | 427 const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap(); |
| 428 | 428 |
| 429 #if defined(OS_MACOSX) | 429 #if defined(OS_MACOSX) && !defined(USE_SKIA) |
| 430 SkAutoLockPixels lock(backing_bitmap); | 430 SkAutoLockPixels lock(backing_bitmap); |
| 431 | 431 |
| 432 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( | 432 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( |
| 433 CGDataProviderCreateWithData( | 433 CGDataProviderCreateWithData( |
| 434 NULL, backing_bitmap.getAddr32(0, 0), | 434 NULL, backing_bitmap.getAddr32(0, 0), |
| 435 backing_bitmap.rowBytes() * backing_bitmap.height(), NULL)); | 435 backing_bitmap.rowBytes() * backing_bitmap.height(), NULL)); |
| 436 base::mac::ScopedCFTypeRef<CGImageRef> image( | 436 base::mac::ScopedCFTypeRef<CGImageRef> image( |
| 437 CGImageCreate( | 437 CGImageCreate( |
| 438 backing_bitmap.width(), backing_bitmap.height(), | 438 backing_bitmap.width(), backing_bitmap.height(), |
| 439 8, 32, backing_bitmap.rowBytes(), | 439 8, 32, backing_bitmap.rowBytes(), |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 } | 606 } |
| 607 | 607 |
| 608 bool PPB_Graphics2D_Impl::HasPendingFlush() const { | 608 bool PPB_Graphics2D_Impl::HasPendingFlush() const { |
| 609 return !unpainted_flush_callback_.is_null() || | 609 return !unpainted_flush_callback_.is_null() || |
| 610 !painted_flush_callback_.is_null() || | 610 !painted_flush_callback_.is_null() || |
| 611 offscreen_flush_pending_; | 611 offscreen_flush_pending_; |
| 612 } | 612 } |
| 613 | 613 |
| 614 } // namespace ppapi | 614 } // namespace ppapi |
| 615 } // namespace webkit | 615 } // namespace webkit |
| OLD | NEW |