| Index: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
|
| diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
|
| index 3a6a1a8c57d3e9ed682be98bde62388af62b34a4..c2ba9b959beff682f68be7f8f0c85945323624d4 100644
|
| --- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
|
| +++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
|
| @@ -159,6 +159,7 @@ PPB_Graphics2D_Impl::PPB_Graphics2D_Impl(PP_Instance instance)
|
| bound_instance_(NULL),
|
| offscreen_flush_pending_(false),
|
| is_always_opaque_(false),
|
| + scale_(1.0f),
|
| weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
|
| }
|
|
|
| @@ -171,17 +172,21 @@ PPB_Graphics2D_Impl::~PPB_Graphics2D_Impl() {
|
| // static
|
| PP_Resource PPB_Graphics2D_Impl::Create(PP_Instance instance,
|
| const PP_Size& size,
|
| - PP_Bool is_always_opaque) {
|
| + PP_Bool is_always_opaque,
|
| + float scale) {
|
| scoped_refptr<PPB_Graphics2D_Impl> graphics_2d(
|
| new PPB_Graphics2D_Impl(instance));
|
| if (!graphics_2d->Init(size.width, size.height,
|
| - PPBoolToBool(is_always_opaque))) {
|
| + PPBoolToBool(is_always_opaque), scale)) {
|
| return 0;
|
| }
|
| return graphics_2d->GetReference();
|
| }
|
|
|
| -bool PPB_Graphics2D_Impl::Init(int width, int height, bool is_always_opaque) {
|
| +bool PPB_Graphics2D_Impl::Init(int width,
|
| + int height,
|
| + bool is_always_opaque,
|
| + float scale) {
|
| // The underlying PPB_ImageData_Impl will validate the dimensions.
|
| image_data_ = new PPB_ImageData_Impl(pp_instance());
|
| if (!image_data_->Init(PPB_ImageData_Impl::GetNativeImageDataFormat(),
|
| @@ -191,6 +196,7 @@ bool PPB_Graphics2D_Impl::Init(int width, int height, bool is_always_opaque) {
|
| return false;
|
| }
|
| is_always_opaque_ = is_always_opaque;
|
| + scale_ = scale;
|
| return true;
|
| }
|
|
|
| @@ -567,10 +573,15 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
|
| // more optimized painting.
|
| paint.setXfermodeMode(SkXfermode::kSrc_Mode);
|
| }
|
| - canvas->drawBitmap(image,
|
| - SkIntToScalar(plugin_rect.x()),
|
| - SkIntToScalar(plugin_rect.y()),
|
| - &paint);
|
| +
|
| + SkPoint origin;
|
| + origin.set(SkIntToScalar(plugin_rect.x()), SkIntToScalar(plugin_rect.y()));
|
| + if (scale_ != 1.0f && scale_ > 0.0f) {
|
| + float inverse_scale = 1.0f / scale_;
|
| + origin.scale(scale_);
|
| + canvas->scale(inverse_scale, inverse_scale);
|
| + }
|
| + canvas->drawBitmap(image, origin.x(), origin.y(), &paint);
|
| canvas->restore();
|
| #endif
|
| }
|
|
|