| 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 #include "chrome/renderer/chrome_ppb_pdf_impl.h" | 5 #include "chrome/renderer/chrome_ppb_pdf_impl.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (!image_data->Init( | 171 if (!image_data->Init( |
| 172 webkit::ppapi::PPB_ImageData_Impl::GetNativeImageDataFormat(), | 172 webkit::ppapi::PPB_ImageData_Impl::GetNativeImageDataFormat(), |
| 173 res_bitmap->width(), res_bitmap->height(), false)) { | 173 res_bitmap->width(), res_bitmap->height(), false)) { |
| 174 return 0; | 174 return 0; |
| 175 } | 175 } |
| 176 | 176 |
| 177 webkit::ppapi::ImageDataAutoMapper mapper(image_data); | 177 webkit::ppapi::ImageDataAutoMapper mapper(image_data); |
| 178 if (!mapper.is_valid()) | 178 if (!mapper.is_valid()) |
| 179 return 0; | 179 return 0; |
| 180 | 180 |
| 181 skia::PlatformCanvas* canvas = image_data->mapped_canvas(); | 181 skia::PlatformCanvas* canvas = image_data->GetPlatformCanvas(); |
| 182 // Note: Do not skBitmap::copyTo the canvas bitmap directly because it will | 182 // Note: Do not skBitmap::copyTo the canvas bitmap directly because it will |
| 183 // ignore the allocated pixels in shared memory and re-allocate a new buffer. | 183 // ignore the allocated pixels in shared memory and re-allocate a new buffer. |
| 184 canvas->writePixels(*res_bitmap, 0, 0); | 184 canvas->writePixels(*res_bitmap, 0, 0); |
| 185 | 185 |
| 186 return image_data->GetReference(); | 186 return image_data->GetReference(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 PP_Resource GetFontFileWithFallback( | 189 PP_Resource GetFontFileWithFallback( |
| 190 PP_Instance instance_id, | 190 PP_Instance instance_id, |
| 191 const PP_FontDescription_Dev* description, | 191 const PP_FontDescription_Dev* description, |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 &Print | 374 &Print |
| 375 }; | 375 }; |
| 376 | 376 |
| 377 // static | 377 // static |
| 378 const PPB_PDF* PPB_PDF_Impl::GetInterface() { | 378 const PPB_PDF* PPB_PDF_Impl::GetInterface() { |
| 379 return &ppb_pdf; | 379 return &ppb_pdf; |
| 380 } | 380 } |
| 381 | 381 |
| 382 } // namespace chrome | 382 } // namespace chrome |
| 383 | 383 |
| OLD | NEW |