diff options
author | raymes@google.com <raymes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 00:39:47 +0000 |
---|---|---|
committer | raymes@google.com <raymes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 00:39:47 +0000 |
commit | bd51beb3940f2b5a0523f6aab95a83a1e3e1d8cc (patch) | |
tree | eabfa32c5fb347cade36fd0ddd288db49022761b | |
parent | 5b8a865c45fd7758e2b82af4f8e3f75e57686eac (diff) | |
download | chromium_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
21 files changed, 28 insertions, 841 deletions
diff --git a/chrome/browser/component_updater/ppapi_utils.cc b/chrome/browser/component_updater/ppapi_utils.cc index ec18493..e41bbb6 100644 --- a/chrome/browser/component_updater/ppapi_utils.cc +++ b/chrome/browser/component_updater/ppapi_utils.cc @@ -16,7 +16,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_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_opengles2ext_dev.h" 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" diff --git a/ppapi/api/dev/ppb_graphics_2d_dev.idl b/ppapi/api/dev/ppb_graphics_2d_dev.idl deleted file mode 100644 index 28a8444..0000000 --- a/ppapi/api/dev/ppb_graphics_2d_dev.idl +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 2012 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* This file contains the <code>PPB_Graphics2D_Dev</code> interface. */ - -[generate_thunk] - -label Chrome { - M22 = 0.1, - M32 = 0.2 -}; - -/** - * These options affect how the existing graphics context is displayed when a - * plugin is resized. - */ -[assert_size(4)] -enum PP_Graphics2D_Dev_ResizeMode { - /** - * In this mode, the context does not change size or offset. If the backing - * store is the same size as the plugin element, this will result in the - * pixels on the right side of the plugin element being unavailable, revealing - * the contents underneath it. - */ - PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT, - /** - * In this mode, the context and its offset are scaled relative to how much - * the plugin element has been resized. - */ - PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH -}; - -/* PPB_Graphics2D_Dev interface */ -interface PPB_Graphics2D_Dev { - /** - * SetScale() sets the scale factor that will be applied when painting the - * graphics context onto the output device. Typically, if rendering at device - * resolution is desired, the context would be created with the width and - * height scaled up by the view's GetDeviceScale and SetScale called with a - * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed - * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of - * 2.0, one would call Create with a size of (w=400, h=200) and then call - * SetScale with 0.5. One would then treat each pixel in the context as a - * single device pixel. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] scale The scale to apply when painting. - * - * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if - * the resource is invalid or the scale factor is 0 or less. - */ - PP_Bool SetScale( - [in] PP_Resource resource, - [in] float_t scale); - - /*** - * GetScale() gets the scale factor that will be applied when painting the - * graphics context onto the output device. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * - * @return Returns the scale factor for the graphics context. If the resource - * is not a valid <code>Graphics2D</code> context, this will return 0.0. - */ - float_t GetScale( - [in] PP_Resource resource); - - /*** - * Sets the offset into the plugin element at which the graphics context is - * painted. This allows a portion of the plugin element to be painted to. - * The new offset will only be applied after Flush() has been called. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] offset The offset at which the context should be painted. - */ - [version=0.2] - void SetOffset( - [in] PP_Resource resource, - [in] PP_Point offset); - - /*** - * Sets the resize mode for the graphics context. When a plugin element is - * resized in the DOM, it takes time for the plugin to update the graphics - * context in the renderer. These options affect how the existing context is - * displayed until the backing store is updated by the plugin. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] resize_mode The resize mode to change this context to. - */ - void SetResizeMode( - [in] PP_Resource resource, - [in] PP_Graphics2D_Dev_ResizeMode resize_mode); -}; - diff --git a/ppapi/c/dev/ppb_graphics_2d_dev.h b/ppapi/c/dev/ppb_graphics_2d_dev.h deleted file mode 100644 index 245ae58..0000000 --- a/ppapi/c/dev/ppb_graphics_2d_dev.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (c) 2012 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* From dev/ppb_graphics_2d_dev.idl modified Tue Nov 12 11:22:26 2013. */ - -#ifndef PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ -#define PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ - -#include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_point.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/pp_stdint.h" - -#define PPB_GRAPHICS2D_DEV_INTERFACE_0_1 "PPB_Graphics2D(Dev);0.1" -#define PPB_GRAPHICS2D_DEV_INTERFACE_0_2 "PPB_Graphics2D(Dev);0.2" -#define PPB_GRAPHICS2D_DEV_INTERFACE PPB_GRAPHICS2D_DEV_INTERFACE_0_2 - -/** - * @file - * This file contains the <code>PPB_Graphics2D_Dev</code> interface. */ - - -/** - * @addtogroup Enums - * @{ - */ -/** - * These options affect how the existing graphics context is displayed when a - * plugin is resized. - */ -typedef enum { - /** - * In this mode, the context does not change size or offset. If the backing - * store is the same size as the plugin element, this will result in the - * pixels on the right side of the plugin element being unavailable, revealing - * the contents underneath it. - */ - PP_GRAPHICS2D_DEV_RESIZEMODE_DEFAULT, - /** - * In this mode, the context and its offset are scaled relative to how much - * the plugin element has been resized. - */ - PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH -} PP_Graphics2D_Dev_ResizeMode; -PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Graphics2D_Dev_ResizeMode, 4); -/** - * @} - */ - -/** - * @addtogroup Interfaces - * @{ - */ -/* PPB_Graphics2D_Dev interface */ -struct PPB_Graphics2D_Dev_0_2 { - /** - * SetScale() sets the scale factor that will be applied when painting the - * graphics context onto the output device. Typically, if rendering at device - * resolution is desired, the context would be created with the width and - * height scaled up by the view's GetDeviceScale and SetScale called with a - * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed - * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of - * 2.0, one would call Create with a size of (w=400, h=200) and then call - * SetScale with 0.5. One would then treat each pixel in the context as a - * single device pixel. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] scale The scale to apply when painting. - * - * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if - * the resource is invalid or the scale factor is 0 or less. - */ - PP_Bool (*SetScale)(PP_Resource resource, float scale); - /*** - * GetScale() gets the scale factor that will be applied when painting the - * graphics context onto the output device. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * - * @return Returns the scale factor for the graphics context. If the resource - * is not a valid <code>Graphics2D</code> context, this will return 0.0. - */ - float (*GetScale)(PP_Resource resource); - /*** - * Sets the offset into the plugin element at which the graphics context is - * painted. This allows a portion of the plugin element to be painted to. - * The new offset will only be applied after Flush() has been called. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] offset The offset at which the context should be painted. - */ - void (*SetOffset)(PP_Resource resource, const struct PP_Point* offset); - /*** - * Sets the resize mode for the graphics context. When a plugin element is - * resized in the DOM, it takes time for the plugin to update the graphics - * context in the renderer. These options affect how the existing context is - * displayed until the backing store is updated by the plugin. - * - * @param[in] resource A <code>Graphics2D</code> context resource. - * @param[in] resize_mode The resize mode to change this context to. - */ - void (*SetResizeMode)(PP_Resource resource, - PP_Graphics2D_Dev_ResizeMode resize_mode); -}; - -typedef struct PPB_Graphics2D_Dev_0_2 PPB_Graphics2D_Dev; - -struct PPB_Graphics2D_Dev_0_1 { - PP_Bool (*SetScale)(PP_Resource resource, float scale); - float (*GetScale)(PP_Resource resource); - void (*SetResizeMode)(PP_Resource resource, - PP_Graphics2D_Dev_ResizeMode resize_mode); -}; -/** - * @} - */ - -#endif /* PPAPI_C_DEV_PPB_GRAPHICS_2D_DEV_H_ */ - diff --git a/ppapi/cpp/dev/graphics_2d_dev.cc b/ppapi/cpp/dev/graphics_2d_dev.cc deleted file mode 100644 index 3fd000c..0000000 --- a/ppapi/cpp/dev/graphics_2d_dev.cc +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ppapi/cpp/dev/graphics_2d_dev.h" - -#include "ppapi/cpp/module_impl.h" -#include "ppapi/cpp/point.h" - -namespace pp { - -namespace { - -template <> const char* interface_name<PPB_Graphics2D_Dev_0_1>() { - return PPB_GRAPHICS2D_DEV_INTERFACE_0_1; -} - -template <> const char* interface_name<PPB_Graphics2D_Dev_0_2>() { - return PPB_GRAPHICS2D_DEV_INTERFACE_0_2; -} - -} // namespace - -// static -bool Graphics2D_Dev::SupportsScale() { - return has_interface<PPB_Graphics2D_Dev_0_1>() || - has_interface<PPB_Graphics2D_Dev_0_2>(); -} - -bool Graphics2D_Dev::SetScale(float scale) { - if (has_interface<PPB_Graphics2D_Dev_0_2>()) { - return PP_ToBool(get_interface<PPB_Graphics2D_Dev_0_2>()->SetScale( - pp_resource(), scale)); - } - if (has_interface<PPB_Graphics2D_Dev_0_1>()) { - return PP_ToBool(get_interface<PPB_Graphics2D_Dev_0_1>()->SetScale( - pp_resource(), scale)); - } - return false; -} - -float Graphics2D_Dev::GetScale() { - if (has_interface<PPB_Graphics2D_Dev_0_2>()) - return get_interface<PPB_Graphics2D_Dev_0_2>()->GetScale(pp_resource()); - if (has_interface<PPB_Graphics2D_Dev_0_1>()) - return get_interface<PPB_Graphics2D_Dev_0_1>()->GetScale(pp_resource()); - return 1.0f; -} - -void Graphics2D_Dev::SetOffset(const pp::Point& offset) { - if (!has_interface<PPB_Graphics2D_Dev_0_2>()) - return; - get_interface<PPB_Graphics2D_Dev_0_2>()->SetOffset(pp_resource(), - &offset.pp_point()); -} - -void Graphics2D_Dev::SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) { - if (!has_interface<PPB_Graphics2D_Dev_0_2>()) - return; - get_interface<PPB_Graphics2D_Dev_0_2>()->SetResizeMode(pp_resource(), - resize_mode); -} - -} // namespace pp diff --git a/ppapi/cpp/dev/graphics_2d_dev.h b/ppapi/cpp/dev/graphics_2d_dev.h deleted file mode 100644 index 52c2e66..0000000 --- a/ppapi/cpp/dev/graphics_2d_dev.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ -#define PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ - -#include "ppapi/cpp/graphics_2d.h" - -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" - -namespace pp { - -class Point; - -// Graphics2DDev is a version of Graphics2D that exposes under-development APIs -// for HiDPI -class Graphics2D_Dev : public Graphics2D { - public: - /// Default constructor for creating an is_null() - /// <code>Graphics2D_Dev</code> object. - Graphics2D_Dev() : Graphics2D() {} - - // Constructor for creating a <code>Graphics2DDev</code> object from an - // existing <code>Graphics2D</code> object. - Graphics2D_Dev(const Graphics2D& other) : Graphics2D(other) {} - - virtual ~Graphics2D_Dev() {} - - /// Returns true if SetScale and GetScale are supported. False if not. - static bool SupportsScale(); - - /// SetScale() sets the scale factor that will be applied when painting the - /// graphics context onto the output device. Typically, if rendering at device - /// resolution is desired, the context would be created with the width and - /// height scaled up by the view's GetDeviceScale and SetScale called with a - /// scale of 1.0 / GetDeviceScale(). For example, if the view resource passed - /// to DidChangeView has a rectangle of (w=200, h=100) and a device scale of - /// 2.0, one would call Create with a size of (w=400, h=200) and then call - /// SetScale with 0.5. One would then treat each pixel in the context as a - /// single device pixel. - /// - /// @param[in] scale The scale to apply when painting. - /// - /// @return Returns <code>true</code> on success or <code>false</code> - /// if the resource is invalid or the scale factor is 0 or less. - bool SetScale(float scale); - - /// GetScale() gets the scale factor that will be applied when painting the - /// graphics context onto the output device. - /// - /// @return Returns the scale factor for the graphics context. If the resource - /// is invalid, 0.0 will be returned. - float GetScale(); - - /// Set the offset into the plugin element at which the graphics context is - /// painted. This allows a portion of the plugin element to be painted to. - /// The new offset will only be applied after Flush() has been called. - /// - /// @param[in] resource A <code>Graphics2D</code> context resource. - /// @param[in] offset The offset at which the context should be painted. - void SetOffset(const pp::Point& offset); - - /// Sets the resize mode for the graphics context. When a plugin element is - /// resized in the DOM, it takes time for the plugin to update the graphics - /// context in the renderer. These options affect how the existing context is - /// displayed until the backing store is updated by the plugin. - /// - ///@param[in] resource A <code>Graphics2D</code> context resource. - ///@param[in] resize_mode The resize mode to change this context to. - void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode); -}; - -} // namespace pp - -#endif // PPAPI_CPP_DEV_GRAPHICS_2D_DEV_H_ diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 1a96e12..03ad1cc 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -195,7 +195,6 @@ 'thunk/ppb_gamepad_thunk.cc', 'thunk/ppb_gles_chromium_texture_mapping_thunk.cc', 'thunk/ppb_graphics_2d_api.h', - 'thunk/ppb_graphics_2d_dev_thunk.cc', 'thunk/ppb_graphics_2d_thunk.cc', 'thunk/ppb_graphics_3d_api.h', 'thunk/ppb_graphics_3d_thunk.cc', diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index 600f36b..bc88654 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -264,8 +264,6 @@ 'cpp/dev/file_chooser_dev.h', 'cpp/dev/font_dev.cc', 'cpp/dev/font_dev.h', - 'cpp/dev/graphics_2d_dev.cc', - 'cpp/dev/graphics_2d_dev.h', 'cpp/dev/ime_input_event_dev.cc', 'cpp/dev/ime_input_event_dev.h', 'cpp/dev/may_own_ptr_dev.h', diff --git a/ppapi/proxy/graphics_2d_resource.cc b/ppapi/proxy/graphics_2d_resource.cc index f545364..0cf7465 100644 --- a/ppapi/proxy/graphics_2d_resource.cc +++ b/ppapi/proxy/graphics_2d_resource.cc @@ -103,7 +103,7 @@ void Graphics2DResource::ReplaceContents(PP_Resource image_data) { PP_Bool Graphics2DResource::SetScale(float scale) { if (scale <= 0.0f) return PP_FALSE; - Post(RENDERER, PpapiHostMsg_Graphics2D_Dev_SetScale(scale)); + Post(RENDERER, PpapiHostMsg_Graphics2D_SetScale(scale)); scale_ = scale; return PP_TRUE; } @@ -112,15 +112,6 @@ float Graphics2DResource::GetScale() { return scale_; } -void Graphics2DResource::SetOffset(const PP_Point* offset) { - Post(RENDERER, PpapiHostMsg_Graphics2D_SetOffset(*offset)); -} - -void Graphics2DResource::SetResizeMode( - PP_Graphics2D_Dev_ResizeMode resize_mode) { - Post(RENDERER, PpapiHostMsg_Graphics2D_SetResizeMode(resize_mode)); -} - int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { // If host is not even created, return failure immediately. This can happen // when failed to initialize (in constructor). @@ -131,20 +122,9 @@ int32_t Graphics2DResource::Flush(scoped_refptr<TrackedCallback> callback) { return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. current_flush_callback_ = callback; - // Send the current view data with the Flush() message. This allows the - // renderer to know what the plugin's view of the renderer is at the time - // Flush was called. - PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance( - pp_instance()); - ppapi::ViewData view_data; - if (dispatcher) { - InstanceData* data = dispatcher->GetInstanceData(pp_instance()); - if (data) - view_data = data->view; - } Call<PpapiPluginMsg_Graphics2D_FlushAck>( RENDERER, - PpapiHostMsg_Graphics2D_Flush(view_data), + PpapiHostMsg_Graphics2D_Flush(), base::Bind(&Graphics2DResource::OnPluginMsgFlushACK, this)); return PP_OK_COMPLETIONPENDING; } diff --git a/ppapi/proxy/graphics_2d_resource.h b/ppapi/proxy/graphics_2d_resource.h index 93d182b..b7ec30c 100644 --- a/ppapi/proxy/graphics_2d_resource.h +++ b/ppapi/proxy/graphics_2d_resource.h @@ -40,8 +40,6 @@ class PPAPI_PROXY_EXPORT Graphics2DResource virtual void ReplaceContents(PP_Resource image_data) OVERRIDE; virtual PP_Bool SetScale(float scale) OVERRIDE; virtual float GetScale() OVERRIDE; - virtual void SetOffset(const PP_Point* offset) OVERRIDE; - virtual void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) OVERRIDE; virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE; virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) OVERRIDE; diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index a5f58d3..dd350c4 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -16,7 +16,6 @@ #include "ppapi/c/dev/ppb_device_ref_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_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_opengles2ext_dev.h" diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 3c666df..5c9f067 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -22,7 +22,6 @@ #include "ipc/ipc_platform_file.h" #include "ppapi/c/dev/pp_video_capture_dev.h" #include "ppapi/c/dev/pp_video_dev.h" -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/dev/ppp_printing_dev.h" @@ -90,8 +89,6 @@ IPC_ENUM_TRAITS_MAX_VALUE(PP_FileType, PP_FILETYPE_OTHER) IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_Permission) IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_SettingType) IPC_ENUM_TRAITS(PP_FlashSetting) -IPC_ENUM_TRAITS_MAX_VALUE(PP_Graphics2D_Dev_ResizeMode, - PP_GRAPHICS2D_DEV_RESIZEMODE_STRETCH) IPC_ENUM_TRAITS(PP_ImageDataFormat) IPC_ENUM_TRAITS(PP_InputEvent_MouseButton) IPC_ENUM_TRAITS(PP_InputEvent_Type) @@ -1413,16 +1410,11 @@ IPC_MESSAGE_CONTROL3(PpapiHostMsg_Graphics2D_Scroll, PP_Point /* amount */) IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_ReplaceContents, ppapi::HostResource /* image_data */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Dev_SetScale, +IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetScale, float /* scale */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetOffset, - PP_Point /* offset */) -IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_SetResizeMode, - PP_Graphics2D_Dev_ResizeMode /* resize_mode */) // Graphics2D, plugin -> host -> plugin -IPC_MESSAGE_CONTROL1(PpapiHostMsg_Graphics2D_Flush, - ppapi::ViewData /* view_data */) +IPC_MESSAGE_CONTROL0(PpapiHostMsg_Graphics2D_Flush) IPC_MESSAGE_CONTROL0(PpapiPluginMsg_Graphics2D_FlushAck) IPC_MESSAGE_CONTROL2(PpapiHostMsg_Graphics2D_ReadImageData, diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index b74675c..9444a2a 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -20,7 +20,6 @@ #include "ppapi/c/dev/ppb_device_ref_dev.h" #include "ppapi/c/dev/ppb_file_chooser_dev.h" #include "ppapi/c/dev/ppb_font_dev.h" -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/c/dev/ppb_ime_input_event_dev.h" #include "ppapi/c/dev/ppb_memory_dev.h" #include "ppapi/c/dev/ppb_printing_dev.h" diff --git a/ppapi/tests/all_cpp_includes.h b/ppapi/tests/all_cpp_includes.h index dcb907c..cae2083 100644 --- a/ppapi/tests/all_cpp_includes.h +++ b/ppapi/tests/all_cpp_includes.h @@ -19,7 +19,6 @@ #include "ppapi/cpp/dev/device_ref_dev.h" #include "ppapi/cpp/dev/file_chooser_dev.h" #include "ppapi/cpp/dev/font_dev.h" -#include "ppapi/cpp/dev/graphics_2d_dev.h" #include "ppapi/cpp/dev/ime_input_event_dev.h" #include "ppapi/cpp/dev/may_own_ptr_dev.h" #include "ppapi/cpp/dev/memory_dev.h" diff --git a/ppapi/tests/test_graphics_2d.cc b/ppapi/tests/test_graphics_2d.cc index 5bb66d7..dfc10a6 100644 --- a/ppapi/tests/test_graphics_2d.cc +++ b/ppapi/tests/test_graphics_2d.cc @@ -12,8 +12,6 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/graphics_2d_dev.h" -#include "ppapi/cpp/dev/graphics_2d_dev.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/graphics_3d.h" #include "ppapi/cpp/image_data.h" @@ -721,15 +719,14 @@ std::string TestGraphics2D::TestDev() { const float scale = 1.0f/2.0f; pp::Graphics2D dc(instance_, pp::Size(w, h), false); ASSERT_FALSE(dc.is_null()); - pp::Graphics2D_Dev dc_dev(dc); - ASSERT_EQ(1.0f, dc_dev.GetScale()); - ASSERT_TRUE(dc_dev.SetScale(scale)); - ASSERT_EQ(scale, dc_dev.GetScale()); + ASSERT_EQ(1.0f, dc.GetScale()); + ASSERT_TRUE(dc.SetScale(scale)); + ASSERT_EQ(scale, dc.GetScale()); // Try setting a few invalid scale factors. Ensure that we catch these errors // and don't change the actual scale - ASSERT_FALSE(dc_dev.SetScale(-1.0f)); - ASSERT_FALSE(dc_dev.SetScale(0.0f)); - ASSERT_EQ(scale, dc_dev.GetScale()); + ASSERT_FALSE(dc.SetScale(-1.0f)); + ASSERT_FALSE(dc.SetScale(0.0f)); + ASSERT_EQ(scale, dc.GetScale()); // Verify that the context has the specified number of pixels, despite the // non-identity scale @@ -737,7 +734,7 @@ std::string TestGraphics2D::TestDev() { size.width = -1; size.height = -1; PP_Bool is_always_opaque = PP_FALSE; - ASSERT_TRUE(graphics_2d_interface_->Describe(dc_dev.pp_resource(), &size, + ASSERT_TRUE(graphics_2d_interface_->Describe(dc.pp_resource(), &size, &is_always_opaque)); ASSERT_EQ(w, size.width); ASSERT_EQ(h, size.height); diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index 39855b9..6821b3a 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -38,8 +38,6 @@ PROXIED_IFACE(PPB_CRYPTO_DEV_INTERFACE_0_1, PPB_Crypto_Dev_0_1) PROXIED_IFACE(PPB_DEVICEREF_DEV_INTERFACE_0_1, PPB_DeviceRef_Dev_0_1) PROXIED_IFACE(PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE_0_1, PPB_GLESChromiumTextureMapping_Dev_0_1) -PROXIED_IFACE(PPB_GRAPHICS2D_DEV_INTERFACE_0_1, PPB_Graphics2D_Dev_0_1) -PROXIED_IFACE(PPB_GRAPHICS2D_DEV_INTERFACE_0_2, PPB_Graphics2D_Dev_0_2) PROXIED_IFACE(PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1, PPB_IMEInputEvent_Dev_0_1) PROXIED_IFACE(PPB_SCROLLBAR_DEV_INTERFACE_0_5, PPB_Scrollbar_Dev_0_5) PROXIED_IFACE(PPB_TEXTINPUT_DEV_INTERFACE_0_1, PPB_TextInput_Dev_0_1) diff --git a/ppapi/thunk/ppb_graphics_2d_api.h b/ppapi/thunk/ppb_graphics_2d_api.h index 0709a50..cdb07cc 100644 --- a/ppapi/thunk/ppb_graphics_2d_api.h +++ b/ppapi/thunk/ppb_graphics_2d_api.h @@ -6,7 +6,6 @@ #define PPAPI_THUNK_PPB_GRAPHICS_2D_API_H_ #include "base/memory/ref_counted.h" -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_point.h" @@ -33,12 +32,8 @@ class PPAPI_THUNK_EXPORT PPB_Graphics2D_API { const PP_Point* amount) = 0; virtual void ReplaceContents(PP_Resource image_data) = 0; virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) = 0; - - // Dev interface. virtual PP_Bool SetScale(float scale) = 0; virtual float GetScale() = 0; - virtual void SetOffset(const PP_Point* offset) = 0; - virtual void SetResizeMode(PP_Graphics2D_Dev_ResizeMode resize_mode) = 0; // Test only virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0; diff --git a/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc b/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc deleted file mode 100644 index 8e9a07c..0000000 --- a/ppapi/thunk/ppb_graphics_2d_dev_thunk.cc +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// From dev/ppb_graphics_2d_dev.idl modified Mon Nov 25 11:02:23 2013. - -#include "ppapi/c/dev/ppb_graphics_2d_dev.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/shared_impl/tracked_callback.h" -#include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppapi_thunk_export.h" -#include "ppapi/thunk/ppb_graphics_2d_api.h" - -namespace ppapi { -namespace thunk { - -namespace { - -PP_Bool SetScale(PP_Resource resource, float scale) { - VLOG(4) << "PPB_Graphics2D_Dev::SetScale()"; - EnterResource<PPB_Graphics2D_API> enter(resource, true); - if (enter.failed()) - return PP_FALSE; - return enter.object()->SetScale(scale); -} - -float GetScale(PP_Resource resource) { - VLOG(4) << "PPB_Graphics2D_Dev::GetScale()"; - EnterResource<PPB_Graphics2D_API> enter(resource, true); - if (enter.failed()) - return 0.0f; - return enter.object()->GetScale(); -} - -void SetOffset(PP_Resource resource, const struct PP_Point* offset) { - VLOG(4) << "PPB_Graphics2D_Dev::SetOffset()"; - EnterResource<PPB_Graphics2D_API> enter(resource, true); - if (enter.failed()) - return; - enter.object()->SetOffset(offset); -} - -void SetResizeMode(PP_Resource resource, - PP_Graphics2D_Dev_ResizeMode resize_mode) { - VLOG(4) << "PPB_Graphics2D_Dev::SetResizeMode()"; - EnterResource<PPB_Graphics2D_API> enter(resource, true); - if (enter.failed()) - return; - enter.object()->SetResizeMode(resize_mode); -} - -const PPB_Graphics2D_Dev_0_1 g_ppb_graphics2d_dev_thunk_0_1 = { - &SetScale, - &GetScale, - &SetResizeMode -}; - -const PPB_Graphics2D_Dev_0_2 g_ppb_graphics2d_dev_thunk_0_2 = { - &SetScale, - &GetScale, - &SetOffset, - &SetResizeMode -}; - -} // namespace - -PPAPI_THUNK_EXPORT const PPB_Graphics2D_Dev_0_1* - GetPPB_Graphics2D_Dev_0_1_Thunk() { - return &g_ppb_graphics2d_dev_thunk_0_1; -} - -PPAPI_THUNK_EXPORT const PPB_Graphics2D_Dev_0_2* - GetPPB_Graphics2D_Dev_0_2_Thunk() { - return &g_ppb_graphics2d_dev_thunk_0_2; -} - -} // namespace thunk -} // namespace ppapi |