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

Side by Side Diff: Source/platform/graphics/Canvas2DLayerBridge.h

Issue 1297663002: Eliminate deferral overhead with canvas to canvas draws (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: git cl web Created 5 years, 4 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // WebExternalTextureLayerClient implementation. 58 // WebExternalTextureLayerClient implementation.
59 bool prepareMailbox(WebExternalTextureMailbox*, WebExternalBitmap*) override ; 59 bool prepareMailbox(WebExternalTextureMailbox*, WebExternalBitmap*) override ;
60 void mailboxReleased(const WebExternalTextureMailbox&, bool lostResource) ov erride; 60 void mailboxReleased(const WebExternalTextureMailbox&, bool lostResource) ov erride;
61 61
62 // ImageBufferSurface implementation 62 // ImageBufferSurface implementation
63 void finalizeFrame(const FloatRect &dirtyRect); 63 void finalizeFrame(const FloatRect &dirtyRect);
64 void willWritePixels(); 64 void willWritePixels();
65 void willOverwriteAllPixels(); 65 void willOverwriteAllPixels();
66 void willOverwriteCanvas(); 66 void willOverwriteCanvas();
67 SkCanvas* canvas(); 67 SkCanvas* canvas();
68 SkCanvas* immediateCanvas(); 68 void disableDeferral();
69 bool checkSurfaceValid(); 69 bool checkSurfaceValid();
70 bool restoreSurface(); 70 bool restoreSurface();
71 WebLayer* layer() const; 71 WebLayer* layer() const;
72 bool isAccelerated() const { return true; } 72 bool isAccelerated() const { return true; }
73 void setFilterQuality(SkFilterQuality); 73 void setFilterQuality(SkFilterQuality);
74 void setIsHidden(bool); 74 void setIsHidden(bool);
75 void setImageBuffer(ImageBuffer*); 75 void setImageBuffer(ImageBuffer*);
76 void didDraw(); 76 void didDraw();
77 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y); 77 bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, in t x, int y);
78 void flush(); 78 void flush();
(...skipping 22 matching lines...) Expand all
101 ImageBuffer* m_imageBuffer; 101 ImageBuffer* m_imageBuffer;
102 int m_msaaSampleCount; 102 int m_msaaSampleCount;
103 size_t m_bytesAllocated; 103 size_t m_bytesAllocated;
104 bool m_haveRecordedDrawCommands; 104 bool m_haveRecordedDrawCommands;
105 int m_framesPending; 105 int m_framesPending;
106 int m_framesSinceMailboxRelease; 106 int m_framesSinceMailboxRelease;
107 bool m_destructionInProgress; 107 bool m_destructionInProgress;
108 bool m_rateLimitingEnabled; 108 bool m_rateLimitingEnabled;
109 SkFilterQuality m_filterQuality; 109 SkFilterQuality m_filterQuality;
110 bool m_isHidden; 110 bool m_isHidden;
111 bool m_isDeferralEnabled;
111 112
112 friend class Canvas2DLayerBridgeTest; 113 friend class Canvas2DLayerBridgeTest;
113 114
114 struct MailboxInfo { 115 struct MailboxInfo {
115 WebExternalTextureMailbox m_mailbox; 116 WebExternalTextureMailbox m_mailbox;
116 RefPtr<SkImage> m_image; 117 RefPtr<SkImage> m_image;
117 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; 118 RefPtr<Canvas2DLayerBridge> m_parentLayerBridge;
118 119
119 MailboxInfo(const MailboxInfo&); 120 MailboxInfo(const MailboxInfo&);
120 MailboxInfo() {} 121 MailboxInfo() {}
121 }; 122 };
122 123
123 uint32_t m_lastImageId; 124 uint32_t m_lastImageId;
124 125
125 enum { 126 enum {
126 // We should normally not have more that two active mailboxes at a time, 127 // We should normally not have more that two active mailboxes at a time,
127 // but sometime we may have three due to the async nature of mailbox han dling. 128 // but sometime we may have three due to the async nature of mailbox han dling.
128 MaxActiveMailboxes = 3, 129 MaxActiveMailboxes = 3,
129 }; 130 };
130 131
131 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes; 132 Deque<MailboxInfo, MaxActiveMailboxes> m_mailboxes;
132 GLenum m_lastFilter; 133 GLenum m_lastFilter;
133 OpacityMode m_opacityMode; 134 OpacityMode m_opacityMode;
134 IntSize m_size; 135 IntSize m_size;
135 }; 136 };
136 137
137 } // namespace blink 138 } // namespace blink
138 139
139 #endif 140 #endif
OLDNEW
« no previous file with comments | « Source/platform/graphics/Canvas2DImageBufferSurface.h ('k') | Source/platform/graphics/Canvas2DLayerBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698