summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-11 19:19:13 +0000
committersehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-11 19:19:13 +0000
commita74eb25bab32dd190b4c925cdf27ffa1fca2b37a (patch)
treecccb8088b1300beeb2ae32b4b2d66583409da874
parent0d8d68a20710150191742373bad22e439b942f39 (diff)
downloadchromium_src-a74eb25bab32dd190b4c925cdf27ffa1fca2b37a.zip
chromium_src-a74eb25bab32dd190b4c925cdf27ffa1fca2b37a.tar.gz
chromium_src-a74eb25bab32dd190b4c925cdf27ffa1fca2b37a.tar.bz2
The union and first level nested struct were vestiges of the previous
device context design. Remove them and shorten the paths to 2D members. Also add "reserved" void* to allow quick access to implementation data. Review URL: http://codereview.chromium.org/490009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34359 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.cc34
-rw-r--r--third_party/npapi/bindings/npapi_extensions.h34
-rw-r--r--webkit/tools/pepper_test_plugin/plugin_object.cc2
3 files changed, 34 insertions, 36 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index 0364e8f..1cc5358 100644
--- a/chrome/renderer/webplugin_delegate_pepper.cc
+++ b/chrome/renderer/webplugin_delegate_pepper.cc
@@ -272,13 +272,13 @@ NPError WebPluginDelegatePepper::Device2DInitializeContext(
// Save the canvas to the output context structure and save the
// OpenPaintContext for future reference.
- context->u.graphicsRgba.region = plugin_bitmap.getAddr32(0, 0);
- context->u.graphicsRgba.stride = width * kBytesPerPixel;
- context->u.graphicsRgba.dirty.left = 0;
- context->u.graphicsRgba.dirty.top = 0;
- context->u.graphicsRgba.dirty.right = width;
- context->u.graphicsRgba.dirty.bottom = height;
- open_paint_contexts_[context->u.graphicsRgba.region] =
+ context->region = plugin_bitmap.getAddr32(0, 0);
+ context->stride = width * kBytesPerPixel;
+ context->dirty.left = 0;
+ context->dirty.top = 0;
+ context->dirty.right = width;
+ context->dirty.bottom = height;
+ open_paint_contexts_[context->region] =
linked_ptr<OpenPaintContext>(paint_context.release());
return NPERR_NO_ERROR;
}
@@ -304,7 +304,7 @@ NPError WebPluginDelegatePepper::Device2DFlushContext(
void* user_data) {
// Get the bitmap data associated with the incoming context.
OpenPaintContextMap::iterator found = open_paint_contexts_.find(
- context->u.graphicsRgba.region);
+ context->region);
if (found == open_paint_contexts_.end())
return NPERR_INVALID_PARAM; // TODO(brettw) call callback.
@@ -316,14 +316,14 @@ NPError WebPluginDelegatePepper::Device2DFlushContext(
// updated by actually taking ownership of the buffer and not telling the
// plugin we're done using it. This wat we can avoid the copy when the entire
// canvas has been updated.
- SkIRect src_rect = { context->u.graphicsRgba.dirty.left,
- context->u.graphicsRgba.dirty.top,
- context->u.graphicsRgba.dirty.right,
- context->u.graphicsRgba.dirty.bottom };
- SkRect dest_rect = { SkIntToScalar(context->u.graphicsRgba.dirty.left),
- SkIntToScalar(context->u.graphicsRgba.dirty.top),
- SkIntToScalar(context->u.graphicsRgba.dirty.right),
- SkIntToScalar(context->u.graphicsRgba.dirty.bottom) };
+ SkIRect src_rect = { context->dirty.left,
+ context->dirty.top,
+ context->dirty.right,
+ context->dirty.bottom };
+ SkRect dest_rect = { SkIntToScalar(context->dirty.left),
+ SkIntToScalar(context->dirty.top),
+ SkIntToScalar(context->dirty.right),
+ SkIntToScalar(context->dirty.bottom) };
SkCanvas committed_canvas(committed_bitmap_);
// We want to replace the contents of the bitmap rather than blend.
@@ -350,7 +350,7 @@ NPError WebPluginDelegatePepper::Device2DFlushContext(
NPError WebPluginDelegatePepper::Device2DDestroyContext(
NPDeviceContext2D* context) {
OpenPaintContextMap::iterator found = open_paint_contexts_.find(
- context->u.graphicsRgba.region);
+ context->region);
if (found == open_paint_contexts_.end())
return NPERR_INVALID_PARAM;
diff --git a/third_party/npapi/bindings/npapi_extensions.h b/third_party/npapi/bindings/npapi_extensions.h
index f93a9e9..67c8ca9 100644
--- a/third_party/npapi/bindings/npapi_extensions.h
+++ b/third_party/npapi/bindings/npapi_extensions.h
@@ -203,24 +203,21 @@ typedef struct _NPDeviceContext2DConfig {
typedef struct _NPDeviceContext2D
{
- union {
- struct {
- void* region;
- int32 stride;
-
- /* The dirty region that the plugin has painted into the buffer. This
- * will be initialized to the size of the plugin image in
- * initializeRenderContextPtr. The plugin can change the values to only
- * update portions of the image.
- */
- struct {
- int32 left;
- int32 top;
- int32 right;
- int32 bottom;
- } dirty;
- } graphicsRgba;
- } u;
+ void* reserved;
+ void* region;
+ int32 stride;
+
+ /* The dirty region that the plugin has painted into the buffer. This
+ * will be initialized to the size of the plugin image in
+ * initializeContextPtr. The plugin can change the values to only
+ * update portions of the image.
+ */
+ struct {
+ int32 left;
+ int32 top;
+ int32 right;
+ int32 bottom;
+ } dirty;
} NPDeviceContext2D;
/* 3D -----------------------------------------------------------------------*/
@@ -232,6 +229,7 @@ typedef struct _NPDeviceContext3DConfig {
typedef struct _NPDeviceContext3D
{
+ void* reserved;
void* buffer;
int32 bufferLength;
} NPDeviceContext3D;
diff --git a/webkit/tools/pepper_test_plugin/plugin_object.cc b/webkit/tools/pepper_test_plugin/plugin_object.cc
index 5b001da..d7eaa09 100644
--- a/webkit/tools/pepper_test_plugin/plugin_object.cc
+++ b/webkit/tools/pepper_test_plugin/plugin_object.cc
@@ -276,7 +276,7 @@ void PluginObject::SetWindow(const NPWindow& window) {
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, window.width, window.height);
- bitmap.setPixels(context.u.graphicsRgba.region);
+ bitmap.setPixels(context.region);
SkCanvas canvas(bitmap);
DrawSampleBitmap(canvas, window.width, window.height);