| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 490 |
| 491 // The |backing_bitmap| must be clipped to the |plugin_rect| to avoid painting | 491 // The |backing_bitmap| must be clipped to the |plugin_rect| to avoid painting |
| 492 // outside the plugin area. This can happen if the plugin has been resized since | 492 // outside the plugin area. This can happen if the plugin has been resized since |
| 493 // PaintImageData verified the image is within the plugin size. | 493 // PaintImageData verified the image is within the plugin size. |
| 494 void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas, | 494 void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas, |
| 495 const gfx::Rect& plugin_rect, | 495 const gfx::Rect& plugin_rect, |
| 496 const gfx::Rect& paint_rect) { | 496 const gfx::Rect& paint_rect) { |
| 497 ImageDataAutoMapper auto_mapper(image_data_); | 497 ImageDataAutoMapper auto_mapper(image_data_); |
| 498 const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap(); | 498 const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap(); |
| 499 | 499 |
| 500 #if defined(OS_MACOSX) | 500 #if defined(OS_MACOSX) && !defined(USE_SKIA) |
| 501 SkAutoLockPixels lock(backing_bitmap); | 501 SkAutoLockPixels lock(backing_bitmap); |
| 502 | 502 |
| 503 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( | 503 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( |
| 504 CGDataProviderCreateWithData( | 504 CGDataProviderCreateWithData( |
| 505 NULL, backing_bitmap.getAddr32(0, 0), | 505 NULL, backing_bitmap.getAddr32(0, 0), |
| 506 backing_bitmap.rowBytes() * backing_bitmap.height(), NULL)); | 506 backing_bitmap.rowBytes() * backing_bitmap.height(), NULL)); |
| 507 base::mac::ScopedCFTypeRef<CGImageRef> image( | 507 base::mac::ScopedCFTypeRef<CGImageRef> image( |
| 508 CGImageCreate( | 508 CGImageCreate( |
| 509 backing_bitmap.width(), backing_bitmap.height(), | 509 backing_bitmap.width(), backing_bitmap.height(), |
| 510 8, 32, backing_bitmap.rowBytes(), | 510 8, 32, backing_bitmap.rowBytes(), |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } | 677 } |
| 678 | 678 |
| 679 bool PPB_Graphics2D_Impl::HasPendingFlush() const { | 679 bool PPB_Graphics2D_Impl::HasPendingFlush() const { |
| 680 return !unpainted_flush_callback_.is_null() || | 680 return !unpainted_flush_callback_.is_null() || |
| 681 !painted_flush_callback_.is_null() || | 681 !painted_flush_callback_.is_null() || |
| 682 offscreen_flush_pending_; | 682 offscreen_flush_pending_; |
| 683 } | 683 } |
| 684 | 684 |
| 685 } // namespace ppapi | 685 } // namespace ppapi |
| 686 } // namespace webkit | 686 } // namespace webkit |
| OLD | NEW |