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

Side by Side Diff: Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp

Issue 14298018: This CL implements the first draft of Canvas 2D Context Attributes, aka getContext('2d', { alpha: f… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixes from review comments; remove WebPreferences.h changes; fix comment. Created 7 years, 8 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 26 matching lines...) Expand all
37 #include <public/Platform.h> 37 #include <public/Platform.h>
38 #include <public/WebCompositorSupport.h> 38 #include <public/WebCompositorSupport.h>
39 #include <public/WebGraphicsContext3D.h> 39 #include <public/WebGraphicsContext3D.h>
40 40
41 using WebKit::WebExternalTextureLayer; 41 using WebKit::WebExternalTextureLayer;
42 using WebKit::WebGraphicsContext3D; 42 using WebKit::WebGraphicsContext3D;
43 using WebKit::WebTextureUpdater; 43 using WebKit::WebTextureUpdater;
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, const IntSize& size, ThreadMode threadMode, unsigned textureId) 47 Canvas2DLayerBridge::Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D> context, const IntSize& size, OpacityMode opacityMode, ThreadMode threadMode, unsigned te xtureId)
48 : m_backBufferTexture(textureId) 48 : m_backBufferTexture(textureId)
49 , m_size(size) 49 , m_size(size)
50 , m_canvas(0) 50 , m_canvas(0)
51 , m_context(context) 51 , m_context(context)
52 , m_bytesAllocated(0) 52 , m_bytesAllocated(0)
53 , m_didRecordDrawCommand(false) 53 , m_didRecordDrawCommand(false)
54 , m_framesPending(0) 54 , m_framesPending(0)
55 , m_next(0) 55 , m_next(0)
56 , m_prev(0) 56 , m_prev(0)
57 { 57 {
58 // Used by browser tests to detect the use of a Canvas2DLayerBridge. 58 // Used by browser tests to detect the use of a Canvas2DLayerBridge.
59 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation"); 59 TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation");
60 60
61 m_layer = adoptPtr(WebKit::Platform::current()->compositorSupport()->createE xternalTextureLayer(this)); 61 m_layer = adoptPtr(WebKit::Platform::current()->compositorSupport()->createE xternalTextureLayer(this));
62 m_layer->setTextureId(textureId); 62 m_layer->setTextureId(textureId);
63 m_layer->setRateLimitContext(threadMode == SingleThread); 63 m_layer->setRateLimitContext(threadMode == SingleThread);
64 m_layer->setOpaque(opacityMode == Opaque);
64 GraphicsLayerChromium::registerContentsLayer(m_layer->layer()); 65 GraphicsLayerChromium::registerContentsLayer(m_layer->layer());
65 } 66 }
66 67
67 Canvas2DLayerBridge::~Canvas2DLayerBridge() 68 Canvas2DLayerBridge::~Canvas2DLayerBridge()
68 { 69 {
69 GraphicsLayerChromium::unregisterContentsLayer(m_layer->layer()); 70 GraphicsLayerChromium::unregisterContentsLayer(m_layer->layer());
70 Canvas2DLayerManager::get().layerToBeDestroyed(this); 71 Canvas2DLayerManager::get().layerToBeDestroyed(this);
71 if (m_canvas) 72 if (m_canvas)
72 m_canvas->setNotificationClient(0); 73 m_canvas->setNotificationClient(0);
73 m_layer->setTextureId(0); 74 m_layer->setTextureId(0);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 unsigned Canvas2DLayerBridge::backBufferTexture() 176 unsigned Canvas2DLayerBridge::backBufferTexture()
176 { 177 {
177 contextAcquired(); 178 contextAcquired();
178 if (m_canvas) 179 if (m_canvas)
179 m_canvas->flush(); 180 m_canvas->flush();
180 m_context->flush(); 181 m_context->flush();
181 return m_backBufferTexture; 182 return m_backBufferTexture;
182 } 183 }
183 184
184 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698