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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #import <QuartzCore/QuartzCore.h> | 6 #import <QuartzCore/QuartzCore.h> |
7 | 7 |
8 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 8 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 19 matching lines...) Expand all Loading... | |
30 #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" | 30 #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" |
31 | 31 |
32 #ifndef NP_NO_CARBON | 32 #ifndef NP_NO_CARBON |
33 #include "webkit/plugins/npapi/carbon_plugin_window_tracker_mac.h" | 33 #include "webkit/plugins/npapi/carbon_plugin_window_tracker_mac.h" |
34 #endif | 34 #endif |
35 | 35 |
36 #ifndef NP_NO_QUICKDRAW | 36 #ifndef NP_NO_QUICKDRAW |
37 #include "webkit/plugins/npapi/quickdraw_drawing_manager_mac.h" | 37 #include "webkit/plugins/npapi/quickdraw_drawing_manager_mac.h" |
38 #endif | 38 #endif |
39 | 39 |
40 #if defined(USE_SKIA) | |
41 #include "skia/ext/skia_utils_mac.h" | |
42 #endif | |
43 | |
40 using WebKit::WebCursorInfo; | 44 using WebKit::WebCursorInfo; |
41 using WebKit::WebKeyboardEvent; | 45 using WebKit::WebKeyboardEvent; |
42 using WebKit::WebInputEvent; | 46 using WebKit::WebInputEvent; |
43 using WebKit::WebMouseEvent; | 47 using WebKit::WebMouseEvent; |
44 using WebKit::WebMouseWheelEvent; | 48 using WebKit::WebMouseWheelEvent; |
45 | 49 |
46 // Important implementation notes: The Mac definition of NPAPI, particularly | 50 // Important implementation notes: The Mac definition of NPAPI, particularly |
47 // the distinction between windowed and windowless modes, differs from the | 51 // the distinction between windowed and windowless modes, differs from the |
48 // Windows and Linux definitions. Most of those differences are | 52 // Windows and Linux definitions. Most of those differences are |
49 // accomodated by the WebPluginDelegate class. | 53 // accomodated by the WebPluginDelegate class. |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 np_cg_context_.context = context; | 454 np_cg_context_.context = context; |
451 } | 455 } |
452 #endif | 456 #endif |
453 #ifndef NP_NO_QUICKDRAW | 457 #ifndef NP_NO_QUICKDRAW |
454 if (instance()->drawing_model() == NPDrawingModelQuickDraw) | 458 if (instance()->drawing_model() == NPDrawingModelQuickDraw) |
455 qd_manager_->SetTargetContext(context, window_rect.size()); | 459 qd_manager_->SetTargetContext(context, window_rect.size()); |
456 #endif | 460 #endif |
457 UpdateGeometry(window_rect, clip_rect); | 461 UpdateGeometry(window_rect, clip_rect); |
458 } | 462 } |
459 | 463 |
460 void WebPluginDelegateImpl::Paint(CGContextRef context, const gfx::Rect& rect) { | 464 void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas, |
465 const gfx::Rect& rect) { | |
brettw
2011/05/18 20:15:46
This should be indented to be aligned with the fir
_cary
2011/05/19 12:28:38
Done.
| |
466 #if defined(USE_SKIA) | |
467 gfx::SkiaBitLocker bitLocker(canvas); | |
brettw
2011/05/18 20:15:46
Don't use camelCase for variable names:
bitLocke
_cary
2011/05/19 12:28:38
Done.
| |
468 CGContextRef context = bitLocker.cgContext(); | |
469 #else | |
470 CGContextRef context = canvas; | |
471 #endif | |
472 CGPaint(context, rect); | |
473 } | |
474 | |
475 void WebPluginDelegateImpl::CGPaint(CGContextRef context, | |
476 const gfx::Rect& rect) { | |
brettw
2011/05/18 20:15:46
Align args.
_cary
2011/05/19 12:28:38
Done.
| |
461 WindowlessPaint(context, rect); | 477 WindowlessPaint(context, rect); |
462 | 478 |
463 #ifndef NP_NO_QUICKDRAW | 479 #ifndef NP_NO_QUICKDRAW |
464 // Paint events are our cue to dump the current plugin bits into the buffer | 480 // Paint events are our cue to dump the current plugin bits into the buffer |
465 // context if we are dealing with a QuickDraw plugin. | 481 // context if we are dealing with a QuickDraw plugin. |
466 if (instance()->drawing_model() == NPDrawingModelQuickDraw) { | 482 if (instance()->drawing_model() == NPDrawingModelQuickDraw) { |
467 qd_manager_->UpdateContext(); | 483 qd_manager_->UpdateContext(); |
468 } | 484 } |
469 #endif | 485 #endif |
470 } | 486 } |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1174 qd_manager_->SetFastPathEnabled(enabled); | 1190 qd_manager_->SetFastPathEnabled(enabled); |
1175 qd_port_.port = qd_manager_->port(); | 1191 qd_port_.port = qd_manager_->port(); |
1176 WindowlessSetWindow(); | 1192 WindowlessSetWindow(); |
1177 // Send a paint event so that the new buffer gets updated immediately. | 1193 // Send a paint event so that the new buffer gets updated immediately. |
1178 WindowlessPaint(buffer_context_, clip_rect_); | 1194 WindowlessPaint(buffer_context_, clip_rect_); |
1179 } | 1195 } |
1180 #endif // !NP_NO_QUICKDRAW | 1196 #endif // !NP_NO_QUICKDRAW |
1181 | 1197 |
1182 } // namespace npapi | 1198 } // namespace npapi |
1183 } // namespace webkit | 1199 } // namespace webkit |
OLD | NEW |