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/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bit_cast.h" | 10 #include "base/bit_cast.h" |
(...skipping 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2997 image_skia_rep.pixel_width(), | 2997 image_skia_rep.pixel_width(), |
2998 image_skia_rep.pixel_height(), | 2998 image_skia_rep.pixel_height(), |
2999 false)) { | 2999 false)) { |
3000 return 0; | 3000 return 0; |
3001 } | 3001 } |
3002 | 3002 |
3003 ImageDataAutoMapper mapper(image_data.get()); | 3003 ImageDataAutoMapper mapper(image_data.get()); |
3004 if (!mapper.is_valid()) | 3004 if (!mapper.is_valid()) |
3005 return 0; | 3005 return 0; |
3006 | 3006 |
3007 skia::PlatformCanvas* canvas = image_data->GetPlatformCanvas(); | 3007 SkCanvas* canvas = image_data->GetPlatformCanvas(); |
3008 // Note: Do not SkBitmap::copyTo the canvas bitmap directly because it will | 3008 // Note: Do not SkBitmap::copyTo the canvas bitmap directly because it will |
3009 // ignore the allocated pixels in shared memory and re-allocate a new buffer. | 3009 // ignore the allocated pixels in shared memory and re-allocate a new buffer. |
3010 canvas->writePixels(image_skia_rep.sk_bitmap(), 0, 0); | 3010 canvas->writePixels(image_skia_rep.sk_bitmap(), 0, 0); |
3011 | 3011 |
3012 return image_data->GetReference(); | 3012 return image_data->GetReference(); |
3013 } | 3013 } |
3014 | 3014 |
3015 PP_ExternalPluginResult PepperPluginInstanceImpl::SwitchToOutOfProcessProxy( | 3015 PP_ExternalPluginResult PepperPluginInstanceImpl::SwitchToOutOfProcessProxy( |
3016 const base::FilePath& file_path, | 3016 const base::FilePath& file_path, |
3017 ppapi::PpapiPermissions permissions, | 3017 ppapi::PpapiPermissions permissions, |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3331 } | 3331 } |
3332 | 3332 |
3333 void PepperPluginInstanceImpl::ConvertDIPToViewport(gfx::Rect* rect) const { | 3333 void PepperPluginInstanceImpl::ConvertDIPToViewport(gfx::Rect* rect) const { |
3334 rect->set_x(rect->x() / viewport_to_dip_scale_); | 3334 rect->set_x(rect->x() / viewport_to_dip_scale_); |
3335 rect->set_y(rect->y() / viewport_to_dip_scale_); | 3335 rect->set_y(rect->y() / viewport_to_dip_scale_); |
3336 rect->set_width(rect->width() / viewport_to_dip_scale_); | 3336 rect->set_width(rect->width() / viewport_to_dip_scale_); |
3337 rect->set_height(rect->height() / viewport_to_dip_scale_); | 3337 rect->set_height(rect->height() / viewport_to_dip_scale_); |
3338 } | 3338 } |
3339 | 3339 |
3340 } // namespace content | 3340 } // namespace content |
OLD | NEW |