| 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 bool PluginInstance::PrintRasterOutput(PP_Resource print_output, | 1508 bool PluginInstance::PrintRasterOutput(PP_Resource print_output, |
| 1509 WebKit::WebCanvas* canvas) { | 1509 WebKit::WebCanvas* canvas) { |
| 1510 EnterResourceNoLock<PPB_ImageData_API> enter(print_output, true); | 1510 EnterResourceNoLock<PPB_ImageData_API> enter(print_output, true); |
| 1511 if (enter.failed()) | 1511 if (enter.failed()) |
| 1512 return false; | 1512 return false; |
| 1513 PPB_ImageData_Impl* image = | 1513 PPB_ImageData_Impl* image = |
| 1514 static_cast<PPB_ImageData_Impl*>(enter.object()); | 1514 static_cast<PPB_ImageData_Impl*>(enter.object()); |
| 1515 | 1515 |
| 1516 // TODO(brettw) this should not require the image to be mapped. It should | 1516 if (!image->Map()) |
| 1517 // instead map on demand. The DCHECK here is to remind you if you see the | |
| 1518 // assert fire, fix the bug rather than mapping the data. | |
| 1519 DCHECK(image->is_mapped()); | |
| 1520 if (!image->is_mapped()) | |
| 1521 return false; | 1517 return false; |
| 1522 | 1518 |
| 1523 const SkBitmap* bitmap = image->GetMappedBitmap(); | 1519 const SkBitmap* bitmap = image->GetMappedBitmap(); |
| 1524 if (!bitmap) | 1520 if (!bitmap) |
| 1525 return false; | 1521 return false; |
| 1526 | 1522 |
| 1527 // Draw the printed image into the supplied canvas. | 1523 // Draw the printed image into the supplied canvas. |
| 1528 SkIRect src_rect; | 1524 SkIRect src_rect; |
| 1529 src_rect.set(0, 0, bitmap->width(), bitmap->height()); | 1525 src_rect.set(0, 0, bitmap->width(), bitmap->height()); |
| 1530 SkRect dest_rect; | 1526 SkRect dest_rect; |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 screen_size_for_fullscreen_ = gfx::Size(); | 2115 screen_size_for_fullscreen_ = gfx::Size(); |
| 2120 WebElement element = container_->element(); | 2116 WebElement element = container_->element(); |
| 2121 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2117 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2122 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2118 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2123 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2119 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2124 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2120 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2125 } | 2121 } |
| 2126 | 2122 |
| 2127 } // namespace ppapi | 2123 } // namespace ppapi |
| 2128 } // namespace webkit | 2124 } // namespace webkit |
| OLD | NEW |