| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/plugin/webplugin_proxy.h" | 5 #include "chrome/plugin/webplugin_proxy.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 windowless_canvas_->restore(); | 415 windowless_canvas_->restore(); |
| 416 #elif defined(OS_MACOSX) | 416 #elif defined(OS_MACOSX) |
| 417 CGContextSaveGState(windowless_context_); | 417 CGContextSaveGState(windowless_context_); |
| 418 if (!background_context_.get()) { | 418 if (!background_context_.get()) { |
| 419 CGContextSetFillColorWithColor(windowless_context_, | 419 CGContextSetFillColorWithColor(windowless_context_, |
| 420 CGColorGetConstantColor(kCGColorBlack)); | 420 CGColorGetConstantColor(kCGColorBlack)); |
| 421 CGContextFillRect(windowless_context_, rect.ToCGRect()); | 421 CGContextFillRect(windowless_context_, rect.ToCGRect()); |
| 422 } else { | 422 } else { |
| 423 scoped_cftyperef<CGImageRef> image( | 423 scoped_cftyperef<CGImageRef> image( |
| 424 CGBitmapContextCreateImage(background_context_)); | 424 CGBitmapContextCreateImage(background_context_)); |
| 425 CGRect source_rect = rect.ToCGRect(); |
| 426 // Flip the rect we use to pull from the canvas, since it's upside-down. |
| 427 source_rect.origin.y = CGImageGetHeight(image) - rect.y() - rect.height(); |
| 425 scoped_cftyperef<CGImageRef> sub_image( | 428 scoped_cftyperef<CGImageRef> sub_image( |
| 426 CGImageCreateWithImageInRect(image, rect.ToCGRect())); | 429 CGImageCreateWithImageInRect(image, source_rect)); |
| 427 CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image); | 430 CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image); |
| 428 } | 431 } |
| 429 CGContextClipToRect(windowless_context_, rect.ToCGRect()); | 432 CGContextClipToRect(windowless_context_, rect.ToCGRect()); |
| 430 delegate_->Paint(windowless_context_, rect); | 433 delegate_->Paint(windowless_context_, rect); |
| 431 CGContextRestoreGState(windowless_context_); | 434 CGContextRestoreGState(windowless_context_); |
| 432 #endif | 435 #endif |
| 433 } | 436 } |
| 434 | 437 |
| 435 void WebPluginProxy::UpdateGeometry( | 438 void WebPluginProxy::UpdateGeometry( |
| 436 const gfx::Rect& window_rect, | 439 const gfx::Rect& window_rect, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 while (index != resource_clients_.end()) { | 589 while (index != resource_clients_.end()) { |
| 587 WebPluginResourceClient* client = (*index).second; | 590 WebPluginResourceClient* client = (*index).second; |
| 588 | 591 |
| 589 if (client == resource_client) { | 592 if (client == resource_client) { |
| 590 resource_clients_.erase(index++); | 593 resource_clients_.erase(index++); |
| 591 } else { | 594 } else { |
| 592 index++; | 595 index++; |
| 593 } | 596 } |
| 594 } | 597 } |
| 595 } | 598 } |
| OLD | NEW |