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

Side by Side Diff: webkit/glue/plugins/quickdraw_drawing_manager_mac.h

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_GLUE_QUICKDRAW_DRAWING_MANAGER_MAC_H_
6 #define WEBKIT_GLUE_QUICKDRAW_DRAWING_MANAGER_MAC_H_
7
8 #ifndef NP_NO_QUICKDRAW
9
10 #import <Carbon/Carbon.h>
11
12 #include "gfx/rect.h"
13
14 // Plugin helper class encapsulating the details of capturing what a QuickDraw
15 // drawing model plugin draws, then drawing it into a CGContext.
16 class QuickDrawDrawingManager {
17 public:
18 QuickDrawDrawingManager();
19 ~QuickDrawDrawingManager();
20
21 // Sets the mode used for plugin drawing. If enabled is true the plugin draws
22 // into a GWorld that's not connected to a window, otherwise the plugin draws
23 // into our the plugin's dummy window (which is slower, since the call we use
24 // to scrape the window contents is much more expensive than copying between
25 // GWorlds).
26 void SetFastPathEnabled(bool enabled);
27
28 // Returns true if the fast path is currently enabled.
29 bool IsFastPathEnabled();
30
31 // Sets the context that the plugin bits should be copied into when
32 // UpdateContext is called. This object does not retain |context|, so the
33 // caller must call SetTargetContext again if the context changes.
34 // If the fast path is currently enabled, this call will cause the port to
35 // change.
36 void SetTargetContext(CGContextRef context, const gfx::Size& plugin_size);
37
38 // Sets the window that is used by the plugin. This object does not own the
39 // window, so the caler must call SetPluginWindow again if the window changes.
40 void SetPluginWindow(WindowRef window);
41
42 // Updates the target context with the current plugin bits.
43 void UpdateContext();
44
45 // Returns the port that the plugin should draw into. This returned port is
46 // only valid until the next call to SetFastPathEnabled (or SetTargetContext
47 // while the fast path is enabled).
48 CGrafPtr port() { return current_port_; }
49
50 // Makes the QuickDraw port current; should be called before calls where the
51 // plugin might draw.
52 void MakePortCurrent();
53
54 private:
55 // Updates the GWorlds used by the faster path.
56 void UpdateGWorlds();
57
58 // Deletes the GWorlds used by the faster path.
59 void DestroyGWorlds();
60
61 // Scrapes the contents of the window into the given context.
62 // Used for the slower path.
63 static void ScrapeWindow(WindowRef window, CGContextRef target_context,
64 const gfx::Size& plugin_size);
65
66 // Copies the source GWorld's bits into the target GWorld.
67 // Used for the faster path.
68 static void CopyGWorldBits(GWorldPtr source, GWorldPtr dest,
69 const gfx::Size& plugin_size);
70
71 WindowRef plugin_window_; // Weak reference.
72 CGContextRef target_context_; // Weak reference.
73 gfx::Size plugin_size_;
74 bool fast_path_enabled_;
75 CGrafPtr current_port_;
76 // Variables used for the faster path:
77 GWorldPtr target_world_; // Created lazily; may be NULL.
78 GWorldPtr plugin_world_; // Created lazily; may be NULL.
79 };
80
81 #endif // !NP_NO_QUICKDRAW
82
83 #endif // QUICKDRAW_DRAWING_MANAGER_MAC
OLDNEW
« no previous file with comments | « webkit/glue/plugins/plugin_web_event_converter_mac.mm ('k') | webkit/glue/plugins/quickdraw_drawing_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698