Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.h

Issue 10704198: Scale to DIPs in ppb_graphics2d_impl for proper invalidation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix shared_lib build, simplify based on feedback and fix nits Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/ppb_graphics_2d.h" 13 #include "ppapi/c/ppb_graphics_2d.h"
14 #include "ppapi/shared_impl/resource.h" 14 #include "ppapi/shared_impl/resource.h"
15 #include "ppapi/shared_impl/tracked_callback.h" 15 #include "ppapi/shared_impl/tracked_callback.h"
16 #include "ppapi/thunk/ppb_graphics_2d_api.h" 16 #include "ppapi/thunk/ppb_graphics_2d_api.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h"
18 #include "webkit/plugins/webkit_plugins_export.h"
18 19
19 namespace gfx { 20 namespace gfx {
20 class Rect; 21 class Rect;
21 } 22 }
22 23
23 namespace webkit { 24 namespace webkit {
24 namespace ppapi { 25 namespace ppapi {
25 26
26 class PPB_ImageData_Impl; 27 class PPB_ImageData_Impl;
27 class PluginInstance; 28 class PluginInstance;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const gfx::Rect& paint_rect); 69 const gfx::Rect& paint_rect);
69 70
70 // Notifications about the view's progress painting. See PluginInstance. 71 // Notifications about the view's progress painting. See PluginInstance.
71 // These messages are used to send Flush callbacks to the plugin. 72 // These messages are used to send Flush callbacks to the plugin.
72 void ViewWillInitiatePaint(); 73 void ViewWillInitiatePaint();
73 void ViewInitiatedPaint(); 74 void ViewInitiatedPaint();
74 void ViewFlushedPaint(); 75 void ViewFlushedPaint();
75 76
76 PPB_ImageData_Impl* image_data() { return image_data_.get(); } 77 PPB_ImageData_Impl* image_data() { return image_data_.get(); }
77 78
79 // Scale the rectangle, taking care to round coordinates outward so a
80 // rectangle scaled down then scaled back up by the inverse scale would
81 // fully contain the entire area affected by the original rectangle.
82 WEBKIT_PLUGINS_EXPORT static gfx::Rect ScaleRectBounds(const gfx::Rect& rect,
83 float scale);
84
78 private: 85 private:
79 explicit PPB_Graphics2D_Impl(PP_Instance instance); 86 explicit PPB_Graphics2D_Impl(PP_Instance instance);
80 87
81 bool Init(int width, int height, bool is_always_opaque); 88 bool Init(int width, int height, bool is_always_opaque);
82 89
83 // Tracks a call to flush that requires a callback. 90 // Tracks a call to flush that requires a callback.
84 class FlushCallbackData { 91 class FlushCallbackData {
85 public: 92 public:
86 FlushCallbackData() { 93 FlushCallbackData() {
87 Clear(); 94 Clear();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 200
194 base::WeakPtrFactory<PPB_Graphics2D_Impl> weak_ptr_factory_; 201 base::WeakPtrFactory<PPB_Graphics2D_Impl> weak_ptr_factory_;
195 202
196 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl); 203 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics2D_Impl);
197 }; 204 };
198 205
199 } // namespace ppapi 206 } // namespace ppapi
200 } // namespace webkit 207 } // namespace webkit
201 208
202 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_ 209 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_2D_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('j') | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698