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 "chrome/renderer/webplugin_delegate_proxy.h" | 5 #include "chrome/renderer/webplugin_delegate_proxy.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 // Blitting the bits directly is much faster than going through CG, and since | 1334 // Blitting the bits directly is much faster than going through CG, and since |
1335 // since the goal is just to move the raw pixels between two bitmaps with the | 1335 // since the goal is just to move the raw pixels between two bitmaps with the |
1336 // same pixel format (no compositing, color correction, etc.), it's safe. | 1336 // same pixel format (no compositing, color correction, etc.), it's safe. |
1337 const size_t stride = | 1337 const size_t stride = |
1338 skia::PlatformCanvas::StrideForWidth(plugin_rect_.width()); | 1338 skia::PlatformCanvas::StrideForWidth(plugin_rect_.width()); |
1339 const size_t chunk_size = 4 * rect.width(); | 1339 const size_t chunk_size = 4 * rect.width(); |
1340 uint8* source_data = static_cast<uint8*>(transport_store_->memory()) + | 1340 uint8* source_data = static_cast<uint8*>(transport_store_->memory()) + |
1341 rect.y() * stride + 4 * rect.x(); | 1341 rect.y() * stride + 4 * rect.x(); |
1342 // The two bitmaps are flipped relative to each other. | 1342 // The two bitmaps are flipped relative to each other. |
1343 int dest_starting_row = plugin_rect_.height() - rect.y() - 1; | 1343 int dest_starting_row = plugin_rect_.height() - rect.y() - 1; |
1344 DCHECK(backing_store_.size() > 0); | 1344 DCHECK(!backing_store_.empty()); |
1345 uint8* target_data = &(backing_store_[0]) + dest_starting_row * stride + | 1345 uint8* target_data = &(backing_store_[0]) + dest_starting_row * stride + |
1346 4 * rect.x(); | 1346 4 * rect.x(); |
1347 for (int row = 0; row < rect.height(); ++row) { | 1347 for (int row = 0; row < rect.height(); ++row) { |
1348 memcpy(target_data, source_data, chunk_size); | 1348 memcpy(target_data, source_data, chunk_size); |
1349 source_data += stride; | 1349 source_data += stride; |
1350 target_data -= stride; | 1350 target_data -= stride; |
1351 } | 1351 } |
1352 #else | 1352 #else |
1353 BlitCanvasToCanvas(backing_store_canvas_.get(), rect, | 1353 BlitCanvasToCanvas(backing_store_canvas_.get(), rect, |
1354 transport_store_canvas_.get(), rect.origin()); | 1354 transport_store_canvas_.get(), rect.origin()); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 } | 1585 } |
1586 #endif | 1586 #endif |
1587 | 1587 |
1588 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1588 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1589 int resource_id) { | 1589 int resource_id) { |
1590 if (!plugin_) | 1590 if (!plugin_) |
1591 return; | 1591 return; |
1592 | 1592 |
1593 plugin_->URLRedirectResponse(allow, resource_id); | 1593 plugin_->URLRedirectResponse(allow, resource_id); |
1594 } | 1594 } |
OLD | NEW |