summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-14 22:56:30 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-14 22:56:30 +0000
commitdf59dd4238593e58b7d68928a43d0eaf8283c50d (patch)
treecec32ed5a58fb4c8d8b57022578f86cb44749d6a /webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
parent3ff58e7107e5f5be943bb5e323cb3d7f4896cbba (diff)
downloadchromium_src-df59dd4238593e58b7d68928a43d0eaf8283c50d.zip
chromium_src-df59dd4238593e58b7d68928a43d0eaf8283c50d.tar.gz
chromium_src-df59dd4238593e58b7d68928a43d0eaf8283c50d.tar.bz2
Pepper Flash Mac: Fix fullscreen drawing with 3d disabled
If flash 3d is disabled then fullscreen flash would only occupy a quart of the screen. In the 3D case we scale the view port in RenderWidgetFullscreenPepper::InitContext(). If 3D is disabled we draw using PepperWidget::paint() which doesn't take into account the scale factor. This CL updates PepperWidget::paint() to scale the canvas if necessary. BUG=146479 TEST= Tested the following cases in normal mode and fullscreen: - GPU compositing disabled, gpu black list disabled - GPU compositing enable, gpu black list disabled - GPU compositing disabled, gpu black list enabled - GPU compositing enabled, gpu black list enabled Also tested the above 4 scenarios with a version of the flash plugin with HiDPI support. I verified that everything looks correct on chatroulette.com and youtube.com. (Note, youtube.com has an issue in HiDPI mode where the player controls are not scaled up, ihf@ is looking into this separately.) Review URL: https://chromiumcodereview.appspot.com/10919272 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156915 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/ppb_graphics_2d_impl.cc')
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_2d_impl.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
index 5c37b95..a838f1f 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -22,6 +22,7 @@
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
+#include "ui/gfx/skia_util.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/gfx_conversion.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
@@ -557,13 +558,11 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
CGContextDrawImage(canvas, bitmap_rect, image);
#else
gfx::Rect invalidate_rect = plugin_rect.Intersect(paint_rect);
- SkRect sk_invalidate_rect = SkRect::MakeXYWH(
- SkIntToScalar(invalidate_rect.origin().x()),
- SkIntToScalar(invalidate_rect.origin().y()),
- SkIntToScalar(invalidate_rect.width()),
- SkIntToScalar(invalidate_rect.height()));
+ SkRect sk_invalidate_rect = gfx::RectToSkRect(invalidate_rect);
SkAutoCanvasRestore auto_restore(canvas, true);
canvas->clipRect(sk_invalidate_rect);
+ gfx::Size pixel_image_size(image_data_->width(), image_data_->height());
+ gfx::Size image_size = pixel_image_size.Scale(scale_);
PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
if (!plugin_instance)
@@ -576,11 +575,8 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
// We don't do this for non-full-frame plugins since we specifically want
// the page background to show through.
SkAutoCanvasRestore auto_restore(canvas, true);
- SkRect image_data_rect = SkRect::MakeXYWH(
- SkIntToScalar(plugin_rect.origin().x()),
- SkIntToScalar(plugin_rect.origin().y()),
- SkIntToScalar(image_data_->width()),
- SkIntToScalar(image_data_->height()));
+ SkRect image_data_rect =
+ gfx::RectToSkRect(gfx::Rect(plugin_rect.origin(), image_size));
canvas->clipRect(image_data_rect, SkRegion::kDifference_Op);
SkPaint paint;
@@ -606,12 +602,14 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
SkPoint origin;
origin.set(SkIntToScalar(plugin_rect.x()), SkIntToScalar(plugin_rect.y()));
+
+ SkPoint pixel_origin = origin;
if (scale_ != 1.0f && scale_ > 0.0f) {
float inverse_scale = 1.0f / scale_;
- origin.scale(inverse_scale);
+ pixel_origin.scale(inverse_scale);
canvas->scale(scale_, scale_);
}
- canvas->drawBitmap(image, origin.x(), origin.y(), &paint);
+ canvas->drawBitmap(image, pixel_origin.x(), pixel_origin.y(), &paint);
#endif
}