| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <atlbase.h> | 10 #include <atlbase.h> |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 if (sad_plugin_) { | 925 if (sad_plugin_) { |
| 926 canvas.DrawBitmapInt(*sad_plugin_, | 926 canvas.DrawBitmapInt(*sad_plugin_, |
| 927 std::max(0, (width - sad_plugin_->width())/2), | 927 std::max(0, (width - sad_plugin_->width())/2), |
| 928 std::max(0, (height - sad_plugin_->height())/2)); | 928 std::max(0, (height - sad_plugin_->height())/2)); |
| 929 } | 929 } |
| 930 | 930 |
| 931 #if defined(OS_WIN) | 931 #if defined(OS_WIN) |
| 932 skia::PlatformDevice& device = canvas.getTopPlatformDevice(); | 932 skia::PlatformDevice& device = canvas.getTopPlatformDevice(); |
| 933 device.drawToHDC(context, plugin_rect_.x(), plugin_rect_.y(), NULL); | 933 device.drawToHDC(context, plugin_rect_.x(), plugin_rect_.y(), NULL); |
| 934 #elif defined(OS_LINUX) | 934 #elif defined(OS_LINUX) |
| 935 // Though conceptually we've been handed a cairo_surface_t* and we | 935 cairo_t* cairo = canvas.getTopPlatformDevice().beginPlatformPaint(); |
| 936 // could've just hooked up the canvas to draw directly onto it, our | 936 cairo_set_source_surface(cairo, cairo_get_target(context), |
| 937 // canvas implementation currently uses cairo as a dumb pixel buffer | 937 plugin_rect_.x(), plugin_rect_.y()); |
| 938 // and would have done the following copy anyway. | |
| 939 // TODO(evanm): revisit when we have printing hooked up, as that might | |
| 940 // change our usage of cairo. | |
| 941 skia::PlatformDevice& device = canvas.getTopPlatformDevice(); | |
| 942 cairo_t* cairo = cairo_create(context); | |
| 943 cairo_surface_t* source_surface = device.beginPlatformPaint(); | |
| 944 cairo_set_source_surface(cairo, source_surface, plugin_rect_.x(), plugin_rect_
.y()); | |
| 945 cairo_paint(cairo); | 938 cairo_paint(cairo); |
| 946 // We have no endPlatformPaint() on the Linux PlatformDevice. | 939 // We have no endPlatformPaint() on the Linux PlatformDevice. |
| 947 // The cairo_t* is owned by the device. | 940 // The cairo_t* is owned by the device. |
| 948 #elif defined(OS_MACOSX) | 941 #elif defined(OS_MACOSX) |
| 949 canvas.getTopPlatformDevice().DrawToContext( | 942 canvas.getTopPlatformDevice().DrawToContext( |
| 950 context, plugin_rect_.x(), plugin_rect_.y(), NULL); | 943 context, plugin_rect_.x(), plugin_rect_.y(), NULL); |
| 951 #else | 944 #else |
| 952 NOTIMPLEMENTED(); | 945 NOTIMPLEMENTED(); |
| 953 #endif | 946 #endif |
| 954 } | 947 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 plugin_->CancelDocumentLoad(); | 1011 plugin_->CancelDocumentLoad(); |
| 1019 } | 1012 } |
| 1020 | 1013 |
| 1021 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( | 1014 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( |
| 1022 const std::string& url, const std::string& range_info, | 1015 const std::string& url, const std::string& range_info, |
| 1023 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { | 1016 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { |
| 1024 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), | 1017 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), |
| 1025 existing_stream, notify_needed, | 1018 existing_stream, notify_needed, |
| 1026 notify_data); | 1019 notify_data); |
| 1027 } | 1020 } |
| OLD | NEW |