summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorraymes@google.com <raymes@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-03 00:39:47 +0000
committerraymes@google.com <raymes@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-03 00:39:47 +0000
commitbd51beb3940f2b5a0523f6aab95a83a1e3e1d8cc (patch)
treeeabfa32c5fb347cade36fd0ddd288db49022761b /content
parent5b8a865c45fd7758e2b82af4f8e3f75e57686eac (diff)
downloadchromium_src-bd51beb3940f2b5a0523f6aab95a83a1e3e1d8cc.zip
chromium_src-bd51beb3940f2b5a0523f6aab95a83a1e3e1d8cc.tar.gz
chromium_src-bd51beb3940f2b5a0523f6aab95a83a1e3e1d8cc.tar.bz2
Remove unused PPB_Graphics2D_Dev interface
This may be revived later to implement fast PDF scrolling but that's too far out so get rid of it for the time being. BUG=303491 R=jschuh@chromium.org, piman@chromium.org, teravest@chromium.org Review URL: https://codereview.chromium.org/216213002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/renderer/pepper/pepper_graphics_2d_host.cc98
-rw-r--r--content/renderer/pepper/pepper_graphics_2d_host.h36
-rw-r--r--content/renderer/pepper/pepper_graphics_2d_host_unittest.cc229
-rw-r--r--content/renderer/pepper/plugin_module.cc1
4 files changed, 17 insertions, 347 deletions
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.cc b/content/renderer/pepper/pepper_graphics_2d_host.cc
index 9657d82..6ddc796 100644
--- a/content/renderer/pepper/pepper_graphics_2d_host.cc
+++ b/content/renderer/pepper/pepper_graphics_2d_host.cc
@@ -137,7 +137,6 @@ struct PepperGraphics2DHost::QueuedOperation {
PAINT,
SCROLL,
REPLACE,
- SET_OFFSET
};
QueuedOperation(Type t)
@@ -161,9 +160,6 @@ struct PepperGraphics2DHost::QueuedOperation {
// Valid when type == REPLACE.
scoped_refptr<PPB_ImageData_Impl> replace_image;
-
- // Valid when type == SET_OFFSET.
- gfx::Point offset;
};
// static
@@ -196,8 +192,7 @@ PepperGraphics2DHost::PepperGraphics2DHost(RendererPpapiHost* host,
is_always_opaque_(false),
scale_(1.0f),
is_running_in_process_(host->IsRunningInProcess()),
- texture_mailbox_modified_(true),
- resize_mode_(PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT) {}
+ texture_mailbox_modified_(true) {}
PepperGraphics2DHost::~PepperGraphics2DHost() {
// Unbind from the instance when destroyed if we're still bound.
@@ -236,19 +231,13 @@ int32_t PepperGraphics2DHost::OnResourceMessageReceived(
PPAPI_DISPATCH_HOST_RESOURCE_CALL(
PpapiHostMsg_Graphics2D_ReplaceContents,
OnHostMsgReplaceContents)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
PpapiHostMsg_Graphics2D_Flush,
OnHostMsgFlush)
PPAPI_DISPATCH_HOST_RESOURCE_CALL(
- PpapiHostMsg_Graphics2D_Dev_SetScale,
+ PpapiHostMsg_Graphics2D_SetScale,
OnHostMsgSetScale)
PPAPI_DISPATCH_HOST_RESOURCE_CALL(
- PpapiHostMsg_Graphics2D_SetOffset,
- OnHostMsgSetOffset)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(
- PpapiHostMsg_Graphics2D_SetResizeMode,
- OnHostMsgSetResizeMode)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(
PpapiHostMsg_Graphics2D_ReadImageData,
OnHostMsgReadImageData)
IPC_END_MESSAGE_MAP()
@@ -397,16 +386,11 @@ void PepperGraphics2DHost::Paint(blink::WebCanvas* canvas,
SkPoint pixel_origin = origin;
- gfx::PointF resize_scale(GetResizeScale());
- gfx::PointF scale(ScalePoint(resize_scale, scale_));
- if ((scale.x() != 1.0f || scale.y() != 1.0f) &&
- scale.x() > 0.0f && scale.y() > 0.0f) {
- canvas->scale(scale.x(), scale.y());
- pixel_origin.set(pixel_origin.x() * (1.0f / scale.x()),
- pixel_origin.y() * (1.0f / scale.y()));
+ if (scale_ != 1.0f && scale_ > 0.0f) {
+ canvas->scale(scale_, scale_);
+ pixel_origin.set(pixel_origin.x() * (1.0f / scale_),
+ pixel_origin.y() * (1.0f / scale_));
}
- pixel_origin.offset(SkIntToScalar(plugin_offset_.x()),
- SkIntToScalar(plugin_offset_.y()));
canvas->drawBitmap(image, pixel_origin.x(), pixel_origin.y(), &paint);
}
@@ -421,11 +405,6 @@ void PepperGraphics2DHost::ViewFlushedPaint() {
}
}
-void PepperGraphics2DHost::DidChangeView(const ppapi::ViewData& view_data) {
- gfx::Size old_plugin_size = current_plugin_size_;
- current_plugin_size_ = PP_ToGfxSize(view_data.rect.size);
-}
-
void PepperGraphics2DHost::SetScale(float scale) {
scale_ = scale;
}
@@ -448,21 +427,6 @@ gfx::Size PepperGraphics2DHost::Size() const {
return gfx::Size(image_data_->width(), image_data_->height());
}
-gfx::PointF PepperGraphics2DHost::GetResizeScale() const {
- switch (resize_mode_) {
- case PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT:
- return gfx::PointF(1.0f, 1.0f);
- case PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH:
- if (flushed_plugin_size_.IsEmpty())
- return gfx::PointF(1.0f, 1.0f);
- return gfx::PointF(
- 1.0f * current_plugin_size_.width() / flushed_plugin_size_.width(),
- 1.0f * current_plugin_size_.height() / flushed_plugin_size_.height());
- }
- NOTREACHED();
- return gfx::PointF(1.0f, 1.0f);
-}
-
int32_t PepperGraphics2DHost::OnHostMsgPaintImageData(
ppapi::host::HostMessageContext* context,
const ppapi::HostResource& image_data,
@@ -555,8 +519,7 @@ int32_t PepperGraphics2DHost::OnHostMsgReplaceContents(
}
int32_t PepperGraphics2DHost::OnHostMsgFlush(
- ppapi::host::HostMessageContext* context,
- const ppapi::ViewData& view_data) {
+ ppapi::host::HostMessageContext* context) {
// Don't allow more than one pending flush at a time.
if (HasPendingFlush())
return PP_ERROR_INPROGRESS;
@@ -564,10 +527,10 @@ int32_t PepperGraphics2DHost::OnHostMsgFlush(
PP_Resource old_image_data = 0;
flush_reply_context_ = context->MakeReplyMessageContext();
if (is_running_in_process_)
- return Flush(NULL, PP_ToGfxSize(view_data.rect.size));
+ return Flush(NULL);
// Reuse image data when running out of process.
- int32_t result = Flush(&old_image_data, PP_ToGfxSize(view_data.rect.size));
+ int32_t result = Flush(&old_image_data);
if (old_image_data) {
// If the Graphics2D has an old image data it's not using any more, send
@@ -593,22 +556,6 @@ int32_t PepperGraphics2DHost::OnHostMsgSetScale(
return PP_ERROR_BADARGUMENT;
}
-int32_t PepperGraphics2DHost::OnHostMsgSetOffset(
- ppapi::host::HostMessageContext* context,
- const PP_Point& offset) {
- QueuedOperation operation(QueuedOperation::SET_OFFSET);
- operation.offset = PP_ToGfxPoint(offset);
- queued_operations_.push_back(operation);
- return PP_OK;
-}
-
-int32_t PepperGraphics2DHost::OnHostMsgSetResizeMode(
- ppapi::host::HostMessageContext* context,
- PP_Graphics2D_Dev_ResizeMode resize_mode) {
- resize_mode_ = resize_mode;
- return PP_OK;
-}
-
int32_t PepperGraphics2DHost::OnHostMsgReadImageData(
ppapi::host::HostMessageContext* context,
PP_Resource image,
@@ -648,15 +595,13 @@ void PepperGraphics2DHost::AttachedToNewLayer() {
texture_mailbox_modified_ = true;
}
-int32_t PepperGraphics2DHost::Flush(PP_Resource* old_image_data,
- const gfx::Size& flushed_plugin_size) {
+int32_t PepperGraphics2DHost::Flush(PP_Resource* old_image_data) {
bool done_replace_contents = false;
bool no_update_visible = true;
bool is_plugin_visible = true;
for (size_t i = 0; i < queued_operations_.size(); i++) {
QueuedOperation& operation = queued_operations_[i];
gfx::Rect op_rect;
- gfx::Rect old_op_rect;
switch (operation.type) {
case QueuedOperation::PAINT:
ExecutePaintImageData(operation.paint_image.get(),
@@ -680,28 +625,16 @@ int32_t PepperGraphics2DHost::Flush(PP_Resource* old_image_data,
done_replace_contents ? NULL : old_image_data);
done_replace_contents = true;
break;
- case QueuedOperation::SET_OFFSET:
- old_op_rect = gfx::Rect(plugin_offset_.x(), plugin_offset_.y(),
- image_data_->width(), image_data_->height());
- plugin_offset_ = operation.offset;
- // The offset is applied below for |op_rect|.
- op_rect = gfx::Rect(image_data_->width(), image_data_->height());
- break;
}
- op_rect.Offset(plugin_offset_.x(), plugin_offset_.y());
-
// For correctness with accelerated compositing, we must issue an invalidate
// on the full op_rect even if it is partially or completely off-screen.
// However, if we issue an invalidate for a clipped-out region, WebKit will
// do nothing and we won't get any ViewFlushedPaint calls, leaving our
// callback stranded. So we still need to check whether the repainted area
// is visible to determine how to deal with the callback.
- if (bound_instance_ && (!op_rect.IsEmpty() || !old_op_rect.IsEmpty())) {
+ if (bound_instance_ && !op_rect.IsEmpty()) {
gfx::Point scroll_delta(operation.scroll_dx, operation.scroll_dy);
- if (!ConvertToLogicalPixels(scale_, &old_op_rect, NULL)) {
- NOTREACHED();
- }
if (!ConvertToLogicalPixels(scale_,
&op_rect,
operation.type == QueuedOperation::SCROLL ?
@@ -715,8 +648,7 @@ int32_t PepperGraphics2DHost::Flush(PP_Resource* old_image_data,
// Set |no_update_visible| to false if the change overlaps the visible
// area.
- if (!gfx::IntersectRects(clip, op_rect).IsEmpty() ||
- !gfx::IntersectRects(clip, old_op_rect).IsEmpty()) {
+ if (!gfx::IntersectRects(clip, op_rect).IsEmpty()) {
no_update_visible = false;
}
@@ -725,19 +657,15 @@ int32_t PepperGraphics2DHost::Flush(PP_Resource* old_image_data,
if (operation.type == QueuedOperation::SCROLL) {
bound_instance_->ScrollRect(scroll_delta.x(), scroll_delta.y(),
op_rect);
- DCHECK(old_op_rect.IsEmpty());
} else {
if (!op_rect.IsEmpty())
bound_instance_->InvalidateRect(op_rect);
- if (!old_op_rect.IsEmpty())
- bound_instance_->InvalidateRect(old_op_rect);
}
texture_mailbox_modified_ = true;
}
}
queued_operations_.clear();
- flushed_plugin_size_ = flushed_plugin_size;
if (!bound_instance_) {
// As promised in the API, we always schedule callback when unbound.
ScheduleOffscreenFlushAck();
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.h b/content/renderer/pepper/pepper_graphics_2d_host.h
index cda286a..ce5a1af 100644
--- a/content/renderer/pepper/pepper_graphics_2d_host.h
+++ b/content/renderer/pepper/pepper_graphics_2d_host.h
@@ -11,7 +11,6 @@
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
-#include "ppapi/c/dev/ppb_graphics_2d_dev.h"
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/resource_host.h"
@@ -33,7 +32,7 @@ struct ViewData;
}
namespace content {
-
+
class PepperPluginInstanceImpl;
class PPB_ImageData_Impl;
class RendererPpapiHost;
@@ -80,20 +79,12 @@ class CONTENT_EXPORT PepperGraphics2DHost
void ViewInitiatedPaint();
void ViewFlushedPaint();
- void DidChangeView(const ppapi::ViewData& view_data);
-
void SetScale(float scale);
float GetScale() const;
bool IsAlwaysOpaque() const;
PPB_ImageData_Impl* ImageData();
gfx::Size Size() const;
- // The amount to resize the backing store by when painting to the canvas.
- // This is used to stretch the backing store when resizing the plugin element.
- gfx::PointF GetResizeScale() const;
- // The offset of the backing store into the plugin element.
- gfx::Point plugin_offset() const { return plugin_offset_; }
-
private:
PepperGraphics2DHost(RendererPpapiHost* host,
PP_Instance instance,
@@ -115,22 +106,16 @@ class CONTENT_EXPORT PepperGraphics2DHost
const PP_Point& amount);
int32_t OnHostMsgReplaceContents(ppapi::host::HostMessageContext* context,
const ppapi::HostResource& image_data);
- int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context,
- const ppapi::ViewData& view_data);
+ int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context);
int32_t OnHostMsgSetScale(ppapi::host::HostMessageContext* context,
float scale);
- int32_t OnHostMsgSetOffset(ppapi::host::HostMessageContext* context,
- const PP_Point& offset);
- int32_t OnHostMsgSetResizeMode(ppapi::host::HostMessageContext* context,
- PP_Graphics2D_Dev_ResizeMode resize_mode);
int32_t OnHostMsgReadImageData(ppapi::host::HostMessageContext* context,
PP_Resource image,
const PP_Point& top_left);
// If |old_image_data| is not NULL, a previous used ImageData object will be
// reused. This is used by ReplaceContents.
- int32_t Flush(PP_Resource* old_image_data,
- const gfx::Size& flushed_plugin_size);
+ int32_t Flush(PP_Resource* old_image_data);
// Called internally to execute the different queued commands. The
// parameters to these functions will have already been validated. The last
@@ -204,21 +189,6 @@ class CONTENT_EXPORT PepperGraphics2DHost
bool texture_mailbox_modified_;
bool is_using_texture_layer_;
- // The offset into the plugin area at which to draw the contents of the
- // graphics context.
- gfx::Point plugin_offset_;
-
- // The size of the plugin element from the plugin's perspective at the last
- // time Flush() was called. Because the plugin runs in a separate process and
- // the size of the plugin element in the renderer is updated asynchronously,
- // it may believe that the plugin element is a different size to what it
- // actually is.
- gfx::Size flushed_plugin_size_;
- // The current size of the plugin element.
- gfx::Size current_plugin_size_;
-
- PP_Graphics2D_Dev_ResizeMode resize_mode_;
-
friend class PepperGraphics2DHostTest;
DISALLOW_COPY_AND_ASSIGN(PepperGraphics2DHost);
};
diff --git a/content/renderer/pepper/pepper_graphics_2d_host_unittest.cc b/content/renderer/pepper/pepper_graphics_2d_host_unittest.cc
index e143aa7..902d21d 100644
--- a/content/renderer/pepper/pepper_graphics_2d_host_unittest.cc
+++ b/content/renderer/pepper/pepper_graphics_2d_host_unittest.cc
@@ -41,7 +41,6 @@ class PepperGraphics2DHostTest : public testing::Test {
const PP_Size& backing_store_size,
const PP_Rect& plugin_rect) {
renderer_view_data_.rect = plugin_rect;
- PluginViewUpdated();
test_globals_.GetResourceTracker()->DidCreateInstance(instance);
scoped_refptr<PPB_ImageData_Impl> backing_store(
new PPB_ImageData_Impl(instance, PPB_ImageData_Impl::ForTest()));
@@ -59,14 +58,10 @@ class PepperGraphics2DHostTest : public testing::Test {
PP_Point(), false, PP_Rect());
}
- void SetOffset(const PP_Point& point) {
- host_->OnHostMsgSetOffset(NULL, point);
- }
-
void Flush() {
ppapi::host::HostMessageContext context(
ppapi::proxy::ResourceMessageCallParams(host_->pp_resource(), 0));
- host_->OnHostMsgFlush(&context, plugin_view_data_);
+ host_->OnHostMsgFlush(&context);
host_->ViewFlushedPaint();
host_->SendOffscreenFlushAck();
}
@@ -78,19 +73,6 @@ class PepperGraphics2DHostTest : public testing::Test {
gfx::Rect(0, 0, plugin_rect.width(), plugin_rect.height()));
}
- void DidChangeView(const PP_Rect& plugin_rect) {
- renderer_view_data_.rect = plugin_rect;
- host_->DidChangeView(renderer_view_data_);
- }
-
- void PluginViewUpdated() {
- plugin_view_data_ = renderer_view_data_;
- }
-
- void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) {
- host_->OnHostMsgSetResizeMode(NULL, resize_mode);
- }
-
void ResetPageBitmap(SkBitmap* bitmap) {
PP_Rect plugin_rect = renderer_view_data_.rect;
int width = plugin_rect.point.x + plugin_rect.size.width;
@@ -105,7 +87,6 @@ class PepperGraphics2DHostTest : public testing::Test {
private:
ppapi::ViewData renderer_view_data_;
- ppapi::ViewData plugin_view_data_;
scoped_ptr<PepperGraphics2DHost> host_;
base::MessageLoop message_loop_;
MockRendererPpapiHost renderer_ppapi_host_;
@@ -181,212 +162,4 @@ TEST_F(PepperGraphics2DHostTest, ConvertToLogicalPixels) {
}
}
-TEST_F(PepperGraphics2DHostTest, SetOffset) {
- ppapi::ProxyAutoLock proxy_lock;
-
- // Initialize the backing store.
- PP_Instance instance = 12345;
- PP_Size backing_store_size = { 300, 300 };
- PP_Rect plugin_rect = PP_MakeRectFromXYWH(0, 0, 500, 500);
- Init(instance, backing_store_size, plugin_rect);
-
- // Paint the entire backing store red.
- scoped_refptr<PPB_ImageData_Impl> image_data(
- new PPB_ImageData_Impl(instance, PPB_ImageData_Impl::ForTest()));
- image_data->Init(PPB_ImageData_Impl::GetNativeImageDataFormat(),
- backing_store_size.width,
- backing_store_size.height,
- true);
- {
- ImageDataAutoMapper auto_mapper(image_data.get());
- image_data->GetMappedBitmap()->eraseColor(
- SkColorSetARGBMacro(255, 255, 0, 0));
- }
- PaintImageData(image_data.get());
- Flush();
-
- // Set up the actual and expected bitmaps/canvas.
- SkBitmap actual_bitmap;
- ResetPageBitmap(&actual_bitmap);
- SkBitmap expected_bitmap;
- ResetPageBitmap(&expected_bitmap);
-
- // Paint the backing store to the canvas.
- PaintToWebCanvas(&actual_bitmap);
- expected_bitmap.eraseArea(
- SkIRect::MakeWH(backing_store_size.width, backing_store_size.height),
- SkColorSetARGBMacro(255, 255, 0, 0));
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-
- // Set the offset.
- PP_Point offset = { 20, 20 };
- SetOffset(offset);
- ResetPageBitmap(&actual_bitmap);
- PaintToWebCanvas(&actual_bitmap);
- // No flush has occurred so the result should be the same.
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-
- // Flush the offset and the location of the rectangle should have shifted.
- Flush();
- ResetPageBitmap(&actual_bitmap);
- PaintToWebCanvas(&actual_bitmap);
- ResetPageBitmap(&expected_bitmap);
- expected_bitmap.eraseArea(
- SkIRect::MakeXYWH(offset.x, offset.y,
- backing_store_size.width, backing_store_size.height),
- SkColorSetARGBMacro(255, 255, 0, 0));
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-}
-
-TEST_F(PepperGraphics2DHostTest, ResizeModeDefault) {
- ppapi::ProxyAutoLock proxy_lock;
-
- // Initialize the backing store.
- PP_Instance instance = 12345;
- PP_Size backing_store_size = { 300, 300 };
- PP_Rect plugin_rect = PP_MakeRectFromXYWH(0, 0, 300, 300);
- Init(instance, backing_store_size, plugin_rect);
-
- // Paint the entire backing store red.
- scoped_refptr<PPB_ImageData_Impl> image_data(
- new PPB_ImageData_Impl(instance, PPB_ImageData_Impl::ForTest()));
- image_data->Init(PPB_ImageData_Impl::GetNativeImageDataFormat(),
- backing_store_size.width,
- backing_store_size.height,
- true);
- {
- ImageDataAutoMapper auto_mapper(image_data.get());
- image_data->GetMappedBitmap()->eraseColor(
- SkColorSetARGBMacro(255, 255, 0, 0));
- }
- PaintImageData(image_data.get());
- Flush();
-
- // Set up the actual and expected bitmaps/canvas.
- SkBitmap actual_bitmap;
- ResetPageBitmap(&actual_bitmap);
- SkBitmap expected_bitmap;
- ResetPageBitmap(&expected_bitmap);
-
- // Paint the backing store to the canvas.
- PaintToWebCanvas(&actual_bitmap);
- expected_bitmap.eraseArea(
- SkIRect::MakeWH(backing_store_size.width, backing_store_size.height),
- SkColorSetARGBMacro(255, 255, 0, 0));
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-
- // Resize the plugin.
- DidChangeView(PP_MakeRectFromXYWH(0, 0, 500, 500));
- // Paint the backing store again, it shouldn't have changed.
- ResetPageBitmap(&actual_bitmap);
- PaintToWebCanvas(&actual_bitmap);
- ResetPageBitmap(&expected_bitmap);
- expected_bitmap.eraseArea(
- SkIRect::MakeWH(backing_store_size.width, backing_store_size.height),
- SkColorSetARGBMacro(255, 255, 0, 0));
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-
- // Let the plugin know about the updated view and reflush the original image.
- PluginViewUpdated();
- PaintImageData(image_data.get());
- Flush();
- // Paint the backing store again, it shouldn't have changed.
- ResetPageBitmap(&actual_bitmap);
- PaintToWebCanvas(&actual_bitmap);
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-}
-
-TEST_F(PepperGraphics2DHostTest, ResizeModeStretch) {
- ppapi::ProxyAutoLock proxy_lock;
-
- // Initialize the backing store.
- PP_Instance instance = 12345;
- PP_Size backing_store_size = { 300, 300 };
- PP_Rect plugin_rect = PP_MakeRectFromXYWH(0, 0, 300, 300);
- Init(instance, backing_store_size, plugin_rect);
- SetResizeMode(PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH);
-
- // Paint the entire backing store red.
- scoped_refptr<PPB_ImageData_Impl> image_data(
- new PPB_ImageData_Impl(instance, PPB_ImageData_Impl::ForTest()));
- image_data->Init(PPB_ImageData_Impl::GetNativeImageDataFormat(),
- backing_store_size.width,
- backing_store_size.height,
- true);
- {
- ImageDataAutoMapper auto_mapper(image_data.get());
- image_data->GetMappedBitmap()->eraseColor(
- SkColorSetARGBMacro(255, 255, 0, 0));
- }
- PaintImageData(image_data.get());
- Flush();
-
- // Set up the actual and expected bitmaps/canvas.
- SkBitmap actual_bitmap;
- ResetPageBitmap(&actual_bitmap);
- SkBitmap expected_bitmap;
- ResetPageBitmap(&expected_bitmap);
-
- // Paint the backing store to the canvas.
- PaintToWebCanvas(&actual_bitmap);
- expected_bitmap.eraseArea(
- SkIRect::MakeWH(backing_store_size.width, backing_store_size.height),
- SkColorSetARGBMacro(255, 255, 0, 0));
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-
- // Resize the plugin.
- plugin_rect = PP_MakeRectFromXYWH(0, 0, 500, 500);
- DidChangeView(plugin_rect);
- ResetPageBitmap(&actual_bitmap);
- ResetPageBitmap(&expected_bitmap);
-
- // Paint the backing store again, it should be stretched even though no new
- // image has been flushed.
- PaintToWebCanvas(&actual_bitmap);
- expected_bitmap.eraseColor(SkColorSetARGBMacro(255, 255, 0, 0));
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-
- // Re-flush the original image data and paint it, it should be stretched as
- // well.
- PaintImageData(image_data.get());
- Flush();
- ResetPageBitmap(&actual_bitmap);
- PaintToWebCanvas(&actual_bitmap);
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-
- // Let the plugin know about the updated view.
- PluginViewUpdated();
-
- // Now flush the image data again, it should be at the original size.
- PaintImageData(image_data.get());
- Flush();
- ResetPageBitmap(&actual_bitmap);
- PaintToWebCanvas(&actual_bitmap);
- ResetPageBitmap(&expected_bitmap);
- expected_bitmap.eraseArea(
- SkIRect::MakeWH(backing_store_size.width, backing_store_size.height),
- SkColorSetARGBMacro(255, 255, 0, 0));
- EXPECT_EQ(memcmp(expected_bitmap.getAddr(0, 0),
- actual_bitmap.getAddr(0, 0),
- expected_bitmap.getSize()), 0);
-}
-
} // namespace content
diff --git a/content/renderer/pepper/plugin_module.cc b/content/renderer/pepper/plugin_module.cc
index 7c722d5..a460515 100644
--- a/content/renderer/pepper/plugin_module.cc
+++ b/content/renderer/pepper/plugin_module.cc
@@ -39,7 +39,6 @@
#include "ppapi/c/dev/ppb_file_chooser_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
-#include "ppapi/c/dev/ppb_graphics_2d_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_opengles2ext_dev.h"
#include "ppapi/c/dev/ppb_printing_dev.h"