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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 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
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 18 matching lines...) Expand all
29 #include "cc/layers/texture_layer_client.h" 29 #include "cc/layers/texture_layer_client.h"
30 #include "cc/resources/texture_mailbox.h" 30 #include "cc/resources/texture_mailbox.h"
31 #include "platform/PlatformExport.h" 31 #include "platform/PlatformExport.h"
32 #include "platform/geometry/IntSize.h" 32 #include "platform/geometry/IntSize.h"
33 #include "platform/graphics/ImageBufferSurface.h" 33 #include "platform/graphics/ImageBufferSurface.h"
34 #include "public/platform/WebExternalTextureLayer.h" 34 #include "public/platform/WebExternalTextureLayer.h"
35 #include "public/platform/WebThread.h" 35 #include "public/platform/WebThread.h"
36 #include "third_party/khronos/GLES2/gl2.h" 36 #include "third_party/khronos/GLES2/gl2.h"
37 #include "third_party/skia/include/core/SkRefCnt.h" 37 #include "third_party/skia/include/core/SkRefCnt.h"
38 #include "third_party/skia/include/core/SkSurface.h" 38 #include "third_party/skia/include/core/SkSurface.h"
39 #include "skia/ext/cdl_common.h"
39 #include "wtf/Allocator.h" 40 #include "wtf/Allocator.h"
40 #include "wtf/Deque.h" 41 #include "wtf/Deque.h"
41 #include "wtf/RefCounted.h" 42 #include "wtf/RefCounted.h"
42 #include "wtf/RefPtr.h" 43 #include "wtf/RefPtr.h"
43 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
44 #include "wtf/WeakPtr.h" 45 #include "wtf/WeakPtr.h"
45 #include <memory> 46 #include <memory>
46 47
47 class SkImage; 48 class SkImage;
48 struct SkImageInfo; 49 struct SkImageInfo;
49 class SkPictureRecorder;
50 50
51 namespace gpu { 51 namespace gpu {
52 namespace gles2 { 52 namespace gles2 {
53 class GLES2Interface; 53 class GLES2Interface;
54 } 54 }
55 } 55 }
56 56
57 namespace blink { 57 namespace blink {
58 58
59 class Canvas2DLayerBridgeTest; 59 class Canvas2DLayerBridgeTest;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Callback for mailboxes given to the compositor from PrepareTextureMailbox. 107 // Callback for mailboxes given to the compositor from PrepareTextureMailbox.
108 void mailboxReleased(const gpu::Mailbox&, 108 void mailboxReleased(const gpu::Mailbox&,
109 const gpu::SyncToken&, 109 const gpu::SyncToken&,
110 bool lostResource); 110 bool lostResource);
111 111
112 // ImageBufferSurface implementation 112 // ImageBufferSurface implementation
113 void finalizeFrame(const FloatRect& dirtyRect); 113 void finalizeFrame(const FloatRect& dirtyRect);
114 void willWritePixels(); 114 void willWritePixels();
115 void willOverwriteAllPixels(); 115 void willOverwriteAllPixels();
116 void willOverwriteCanvas(); 116 void willOverwriteCanvas();
117 SkCanvas* canvas(); 117 CdlCanvas* canvas();
118 void disableDeferral(DisableDeferralReason); 118 void disableDeferral(DisableDeferralReason);
119 bool checkSurfaceValid(); 119 bool checkSurfaceValid();
120 bool restoreSurface(); 120 bool restoreSurface();
121 WebLayer* layer() const; 121 WebLayer* layer() const;
122 bool isAccelerated() const; 122 bool isAccelerated() const;
123 void setFilterQuality(SkFilterQuality); 123 void setFilterQuality(SkFilterQuality);
124 void setIsHidden(bool); 124 void setIsHidden(bool);
125 void setImageBuffer(ImageBuffer*); 125 void setImageBuffer(ImageBuffer*);
126 void didDraw(const FloatRect&); 126 void didDraw(const FloatRect&);
127 bool writePixels(const SkImageInfo&, 127 bool writePixels(const SkImageInfo&,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void startRecording(); 200 void startRecording();
201 void skipQueuedDrawCommands(); 201 void skipQueuedDrawCommands();
202 void flushRecordingOnly(); 202 void flushRecordingOnly();
203 void unregisterTaskObserver(); 203 void unregisterTaskObserver();
204 void reportSurfaceCreationFailure(); 204 void reportSurfaceCreationFailure();
205 205
206 // WebThread::TaskOberver implementation 206 // WebThread::TaskOberver implementation
207 void willProcessTask() override; 207 void willProcessTask() override;
208 void didProcessTask() override; 208 void didProcessTask() override;
209 209
210 SkSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration); 210 CdlSurface* getOrCreateSurface(AccelerationHint = PreferAcceleration);
211 bool shouldAccelerate(AccelerationHint) const; 211 bool shouldAccelerate(AccelerationHint) const;
212 212
213 // Returns the GL filter associated with |m_filterQuality|. 213 // Returns the GL filter associated with |m_filterQuality|.
214 GLenum getGLFilter(); 214 GLenum getGLFilter();
215 215
216 #if USE_IOSURFACE_FOR_2D_CANVAS 216 #if USE_IOSURFACE_FOR_2D_CANVAS
217 // Creates an IOSurface-backed texture. Copies |image| into the texture. 217 // Creates an IOSurface-backed texture. Copies |image| into the texture.
218 // Prepares a mailbox from the texture. The caller must have created a new 218 // Prepares a mailbox from the texture. The caller must have created a new
219 // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the 219 // MailboxInfo, and prepended it to |m_mailboxs|. Returns whether the
220 // mailbox was successfully prepared. |mailbox| is an out parameter only 220 // mailbox was successfully prepared. |mailbox| is an out parameter only
(...skipping 15 matching lines...) Expand all
236 void createMailboxInfo(); 236 void createMailboxInfo();
237 237
238 // Returns whether the mailbox was successfully prepared from the SkImage. 238 // Returns whether the mailbox was successfully prepared from the SkImage.
239 // The mailbox is an out parameter only populated on success. 239 // The mailbox is an out parameter only populated on success.
240 bool prepareMailboxFromImage(sk_sp<SkImage>, cc::TextureMailbox*); 240 bool prepareMailboxFromImage(sk_sp<SkImage>, cc::TextureMailbox*);
241 241
242 // Resets Skia's texture bindings. This method should be called after 242 // Resets Skia's texture bindings. This method should be called after
243 // changing texture bindings. 243 // changing texture bindings.
244 void resetSkiaTextureBinding(); 244 void resetSkiaTextureBinding();
245 245
246 std::unique_ptr<SkPictureRecorder> m_recorder; 246 std::unique_ptr<CdlPictureRecorder> m_recorder;
247 sk_sp<SkSurface> m_surface; 247 sk_sp<CdlSurface> m_surface;
248 sk_sp<SkImage> m_hibernationImage; 248 sk_sp<SkImage> m_hibernationImage;
249 int m_initialSurfaceSaveCount; 249 int m_initialSurfaceSaveCount;
250 std::unique_ptr<WebExternalTextureLayer> m_layer; 250 std::unique_ptr<WebExternalTextureLayer> m_layer;
251 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; 251 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider;
252 std::unique_ptr<SharedContextRateLimiter> m_rateLimiter; 252 std::unique_ptr<SharedContextRateLimiter> m_rateLimiter;
253 std::unique_ptr<Logger> m_logger; 253 std::unique_ptr<Logger> m_logger;
254 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory; 254 WeakPtrFactory<Canvas2DLayerBridge> m_weakPtrFactory;
255 ImageBuffer* m_imageBuffer; 255 ImageBuffer* m_imageBuffer;
256 int m_msaaSampleCount; 256 int m_msaaSampleCount;
257 size_t m_bytesAllocated; 257 size_t m_bytesAllocated;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Each element in this vector represents an IOSurface backed texture that 293 // Each element in this vector represents an IOSurface backed texture that
294 // is ready to be reused. 294 // is ready to be reused.
295 // Elements in this vector can safely be purged in low memory conditions. 295 // Elements in this vector can safely be purged in low memory conditions.
296 Vector<RefPtr<ImageInfo>> m_imageInfoCache; 296 Vector<RefPtr<ImageInfo>> m_imageInfoCache;
297 #endif // USE_IOSURFACE_FOR_2D_CANVAS 297 #endif // USE_IOSURFACE_FOR_2D_CANVAS
298 }; 298 };
299 299
300 } // namespace blink 300 } // namespace blink
301 301
302 #endif 302 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698