OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/plugin/webplugin_proxy.h" | 5 #include "content/plugin/webplugin_proxy.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 CGContextClipToRect(windowless_context(), rect.ToCGRect()); | 298 CGContextClipToRect(windowless_context(), rect.ToCGRect()); |
299 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia | 299 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia |
300 // port to share code with the Darwin / CG port. All ports will eventually use | 300 // port to share code with the Darwin / CG port. All ports will eventually use |
301 // the common code below. | 301 // the common code below. |
302 delegate_->CGPaint(windowless_context(), rect); | 302 delegate_->CGPaint(windowless_context(), rect); |
303 if (windowless_contexts_[saved_index].get() == saved_context_weak) | 303 if (windowless_contexts_[saved_index].get() == saved_context_weak) |
304 CGContextRestoreGState(windowless_contexts_[saved_index]); | 304 CGContextRestoreGState(windowless_contexts_[saved_index]); |
305 #else | 305 #else |
306 // See above comment about windowless_context_ changing. | 306 // See above comment about windowless_context_ changing. |
307 // http::/crbug.com/139462 | 307 // http::/crbug.com/139462 |
308 skia::RefPtr<skia::PlatformCanvas> saved_canvas = windowless_canvas(); | 308 skia::RefPtr<SkCanvas> saved_canvas = windowless_canvas(); |
309 | 309 |
310 saved_canvas->save(); | 310 saved_canvas->save(); |
311 | 311 |
312 // The given clip rect is relative to the plugin coordinate system. | 312 // The given clip rect is relative to the plugin coordinate system. |
313 SkRect sk_rect = { SkIntToScalar(rect.x()), | 313 SkRect sk_rect = { SkIntToScalar(rect.x()), |
314 SkIntToScalar(rect.y()), | 314 SkIntToScalar(rect.y()), |
315 SkIntToScalar(rect.right()), | 315 SkIntToScalar(rect.right()), |
316 SkIntToScalar(rect.bottom()) }; | 316 SkIntToScalar(rect.bottom()) }; |
317 saved_canvas->clipRect(sk_rect); | 317 saved_canvas->clipRect(sk_rect); |
318 | 318 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 !damaged_rect_.IsEmpty()) { | 369 !damaged_rect_.IsEmpty()) { |
370 InvalidateRect(damaged_rect_); | 370 InvalidateRect(damaged_rect_); |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
374 #if defined(OS_WIN) | 374 #if defined(OS_WIN) |
375 | 375 |
376 void WebPluginProxy::CreateCanvasFromHandle( | 376 void WebPluginProxy::CreateCanvasFromHandle( |
377 const TransportDIB::Handle& dib_handle, | 377 const TransportDIB::Handle& dib_handle, |
378 const gfx::Rect& window_rect, | 378 const gfx::Rect& window_rect, |
379 skia::RefPtr<skia::PlatformCanvas>* canvas) { | 379 skia::RefPtr<SkCanvas>* canvas) { |
380 *canvas = skia::AdoptRef(skia::CreatePlatformCanvas( | 380 *canvas = skia::AdoptRef(skia::CreatePlatformCanvas( |
381 window_rect.width(), window_rect.height(), true, dib_handle.GetHandle(), | 381 window_rect.width(), window_rect.height(), true, dib_handle.GetHandle(), |
382 skia::RETURN_NULL_ON_FAILURE)); | 382 skia::RETURN_NULL_ON_FAILURE)); |
383 // The canvas does not own the section so we need to close it now. | 383 // The canvas does not own the section so we need to close it now. |
384 dib_handle.Close(); | 384 dib_handle.Close(); |
385 } | 385 } |
386 | 386 |
387 void WebPluginProxy::SetWindowlessBuffers( | 387 void WebPluginProxy::SetWindowlessBuffers( |
388 const TransportDIB::Handle& windowless_buffer0, | 388 const TransportDIB::Handle& windowless_buffer0, |
389 const TransportDIB::Handle& windowless_buffer1, | 389 const TransportDIB::Handle& windowless_buffer1, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 int input_type; | 550 int input_type; |
551 gfx::Rect caret_rect; | 551 gfx::Rect caret_rect; |
552 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) | 552 if (!delegate_->GetIMEStatus(&input_type, &caret_rect)) |
553 return; | 553 return; |
554 | 554 |
555 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); | 555 Send(new PluginHostMsg_NotifyIMEStatus(route_id_, input_type, caret_rect)); |
556 } | 556 } |
557 #endif | 557 #endif |
558 | 558 |
559 } // namespace content | 559 } // namespace content |
OLD | NEW |