| 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/renderer/webplugin_delegate_proxy.h" | 5 #include "chrome/renderer/webplugin_delegate_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/gfx/blit.h" | 9 #include "app/gfx/blit.h" |
| 10 #include "app/gfx/canvas.h" | 10 #include "app/gfx/canvas.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 548 |
| 549 // We're using the native OS APIs from here on out. | 549 // We're using the native OS APIs from here on out. |
| 550 #if WEBKIT_USING_SKIA | 550 #if WEBKIT_USING_SKIA |
| 551 gfx::NativeDrawingContext context = canvas->beginPlatformPaint(); | 551 gfx::NativeDrawingContext context = canvas->beginPlatformPaint(); |
| 552 #elif WEBKIT_USING_CG | 552 #elif WEBKIT_USING_CG |
| 553 gfx::NativeDrawingContext context = canvas; | 553 gfx::NativeDrawingContext context = canvas; |
| 554 #endif | 554 #endif |
| 555 | 555 |
| 556 gfx::Rect offset_rect = rect; | 556 gfx::Rect offset_rect = rect; |
| 557 offset_rect.Offset(-plugin_rect_.x(), -plugin_rect_.y()); | 557 offset_rect.Offset(-plugin_rect_.x(), -plugin_rect_.y()); |
| 558 gfx::Rect canvas_rect = offset_rect; |
| 559 #if defined(OS_MACOSX) |
| 560 // The canvases are flipped relative to the context, so flip the rect too. |
| 561 FlipRectVerticallyWithHeight(&canvas_rect, plugin_rect_.height()); |
| 562 #endif |
| 558 | 563 |
| 559 bool background_changed = false; | 564 bool background_changed = false; |
| 560 if (background_store_canvas_.get() && BackgroundChanged(context, rect)) { | 565 if (background_store_canvas_.get() && BackgroundChanged(context, rect)) { |
| 561 background_changed = true; | 566 background_changed = true; |
| 562 BlitContextToCanvas(background_store_canvas_.get(), offset_rect, | 567 gfx::Rect flipped_offset_rect = offset_rect; |
| 568 BlitContextToCanvas(background_store_canvas_.get(), canvas_rect, |
| 563 context, rect.origin()); | 569 context, rect.origin()); |
| 564 } | 570 } |
| 565 | 571 |
| 566 if (background_changed || !backing_store_painted_.Contains(offset_rect)) { | 572 if (background_changed || !backing_store_painted_.Contains(offset_rect)) { |
| 567 Send(new PluginMsg_Paint(instance_id_, offset_rect)); | 573 Send(new PluginMsg_Paint(instance_id_, offset_rect)); |
| 568 CopyFromTransportToBacking(offset_rect); | 574 CopyFromTransportToBacking(offset_rect); |
| 569 } | 575 } |
| 570 | 576 |
| 571 #if defined(OS_MACOSX) | |
| 572 FlipRectVerticallyWithHeight(&offset_rect, plugin_rect_.height()); | |
| 573 #endif | |
| 574 BlitCanvasToContext(context, rect, backing_store_canvas_.get(), | 577 BlitCanvasToContext(context, rect, backing_store_canvas_.get(), |
| 575 offset_rect.origin()); | 578 canvas_rect.origin()); |
| 576 | 579 |
| 577 if (invalidate_pending_) { | 580 if (invalidate_pending_) { |
| 578 // Only send the PaintAck message if this paint is in response to an | 581 // Only send the PaintAck message if this paint is in response to an |
| 579 // invalidate from the plugin, since this message acts as an access token | 582 // invalidate from the plugin, since this message acts as an access token |
| 580 // to ensure only one process is using the transport dib at a time. | 583 // to ensure only one process is using the transport dib at a time. |
| 581 invalidate_pending_ = false; | 584 invalidate_pending_ = false; |
| 582 Send(new PluginMsg_DidPaint(instance_id_)); | 585 Send(new PluginMsg_DidPaint(instance_id_)); |
| 583 } | 586 } |
| 584 | 587 |
| 585 #if WEBKIT_USING_SKIA | 588 #if WEBKIT_USING_SKIA |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { | 1101 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { |
| 1099 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), | 1102 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), |
| 1100 existing_stream, notify_needed, | 1103 existing_stream, notify_needed, |
| 1101 notify_data); | 1104 notify_data); |
| 1102 } | 1105 } |
| 1103 | 1106 |
| 1104 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, | 1107 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, |
| 1105 bool defer) { | 1108 bool defer) { |
| 1106 plugin_->SetDeferResourceLoading(resource_id, defer); | 1109 plugin_->SetDeferResourceLoading(resource_id, defer); |
| 1107 } | 1110 } |
| OLD | NEW |