| 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 "chrome/renderer/pepper/pepper_flash_renderer_host.h" | 5 #include "chrome/renderer/pepper/pepper_flash_renderer_host.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 if (!typeface) | 214 if (!typeface) |
| 215 return PP_ERROR_FAILED; | 215 return PP_ERROR_FAILED; |
| 216 | 216 |
| 217 EnterResourceNoLock<PPB_ImageData_API> enter( | 217 EnterResourceNoLock<PPB_ImageData_API> enter( |
| 218 params.image_data.host_resource(), true); | 218 params.image_data.host_resource(), true); |
| 219 if (enter.failed()) | 219 if (enter.failed()) |
| 220 return PP_ERROR_FAILED; | 220 return PP_ERROR_FAILED; |
| 221 | 221 |
| 222 // Set up the canvas. | 222 // Set up the canvas. |
| 223 PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(enter.object()); | 223 PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(enter.object()); |
| 224 SkCanvas* canvas = image->GetPlatformCanvas(); | 224 SkCanvas* canvas = image->GetCanvas(); |
| 225 bool needs_unmapping = false; | 225 bool needs_unmapping = false; |
| 226 if (!canvas) { | 226 if (!canvas) { |
| 227 needs_unmapping = true; | 227 needs_unmapping = true; |
| 228 image->Map(); | 228 image->Map(); |
| 229 canvas = image->GetPlatformCanvas(); | 229 canvas = image->GetCanvas(); |
| 230 if (!canvas) | 230 if (!canvas) |
| 231 return PP_ERROR_FAILED; // Failure mapping. | 231 return PP_ERROR_FAILED; // Failure mapping. |
| 232 } | 232 } |
| 233 | 233 |
| 234 SkAutoCanvasRestore acr(canvas, true); | 234 SkAutoCanvasRestore acr(canvas, true); |
| 235 | 235 |
| 236 // Clip is applied in pixels before the transform. | 236 // Clip is applied in pixels before the transform. |
| 237 SkRect clip_rect = { | 237 SkRect clip_rect = { |
| 238 SkIntToScalar(params.clip.point.x), SkIntToScalar(params.clip.point.y), | 238 SkIntToScalar(params.clip.point.x), SkIntToScalar(params.clip.point.y), |
| 239 SkIntToScalar(params.clip.point.x + params.clip.size.width), | 239 SkIntToScalar(params.clip.point.x + params.clip.size.width), |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 rect.point.x, rect.point.y, rect.size.width, rect.size.height))) | 373 rect.point.x, rect.point.y, rect.size.width, rect.size.height))) |
| 374 return PP_OK; | 374 return PP_OK; |
| 375 return PP_ERROR_FAILED; | 375 return PP_ERROR_FAILED; |
| 376 } | 376 } |
| 377 | 377 |
| 378 int32_t PepperFlashRendererHost::OnInvokePrinting( | 378 int32_t PepperFlashRendererHost::OnInvokePrinting( |
| 379 ppapi::host::HostMessageContext* host_context) { | 379 ppapi::host::HostMessageContext* host_context) { |
| 380 pdf::PPB_PDF_Impl::InvokePrintingForInstance(pp_instance()); | 380 pdf::PPB_PDF_Impl::InvokePrintingForInstance(pp_instance()); |
| 381 return PP_OK; | 381 return PP_OK; |
| 382 } | 382 } |
| OLD | NEW |