Changeset 152307 in webkit
- Timestamp:
- Jul 2, 2013 12:17:14 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152306 r152307 1 2013-07-02 Jae Hyun Park <jae.park@company100.net> 2 3 Implement CoordinatedSurface for Threaded Coordinated Graphics 4 https://bugs.webkit.org/show_bug.cgi?id=109661 5 6 Reviewed by Noam Rosenthal. 7 8 This is a preparation patch for Threaded Coordianted Graphics. 9 10 This patch implements ThreadSafeCoordinatedSurface using ImageBuffer as a 11 backend. Also, this patch moves common implementation to CoordinatedSurface to 12 prevent duplication of code. 13 14 * platform/graphics/texmap/coordinated/CoordinatedSurface.cpp: 15 (WebCore::CoordinatedSurface::CoordinatedSurface): 16 * platform/graphics/texmap/coordinated/CoordinatedSurface.h: 17 (WebCore::CoordinatedSurface::size): 18 (WebCore::CoordinatedSurface::flags): 19 * platform/graphics/texmap/coordinated/ThreadSafeCoordinatedSurface.cpp: Added. 20 (WebCore::ThreadSafeCoordinatedSurface::create): 21 (WebCore::ThreadSafeCoordinatedSurface::ThreadSafeCoordinatedSurface): 22 (WebCore::ThreadSafeCoordinatedSurface::~ThreadSafeCoordinatedSurface): 23 (WebCore::ThreadSafeCoordinatedSurface::paintToSurface): 24 (WebCore::ThreadSafeCoordinatedSurface::copyToTexture): 25 * platform/graphics/texmap/coordinated/ThreadSafeCoordinatedSurface.h: Added. 26 1 27 2013-07-02 Geoffrey Garen <ggaren@apple.com> 2 28 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.cpp
r141543 r152307 44 44 } 45 45 46 CoordinatedSurface::CoordinatedSurface(const IntSize& size, Flags flags) 47 : m_size(size) 48 , m_flags(flags) 49 { 50 } 51 46 52 } // namespace WebCore 47 53 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h
r151262 r152307 24 24 #if USE(COORDINATED_GRAPHICS) 25 25 #include "IntRect.h" 26 #include <wtf/PassOwnPtr.h>27 26 #include <wtf/PassRefPtr.h> 28 27 #include <wtf/ThreadSafeRefCounted.h> … … 53 52 54 53 bool supportsAlpha() const { return flags() & SupportsAlpha; } 55 virtual IntSize size() const = 0;54 IntSize size() const { return m_size; } 56 55 57 56 virtual void paintToSurface(const IntRect&, Client*) = 0; … … 62 61 63 62 protected: 64 virtual Flags flags() const = 0; 63 CoordinatedSurface(const IntSize&, Flags); 64 Flags flags() const { return m_flags; } 65 66 IntSize m_size; 67 Flags m_flags; 65 68 66 69 private: -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/ThreadSafeCoordinatedSurface.cpp
r152306 r152307 25 25 26 26 #include "config.h" 27 #include " CoordinatedSurface.h"27 #include "ThreadSafeCoordinatedSurface.h" 28 28 29 29 #if USE(COORDINATED_GRAPHICS) 30 30 31 #include "TextureMapper.h" 32 31 33 namespace WebCore { 32 34 33 CoordinatedSurface::Factory* CoordinatedSurface::s_factory = 0; 34 35 void CoordinatedSurface::setFactory(CoordinatedSurface::Factory factory) 35 PassRefPtr<ThreadSafeCoordinatedSurface> ThreadSafeCoordinatedSurface::create(const IntSize& size, CoordinatedSurface::Flags flags) 36 36 { 37 s_factory = factory;37 return adoptRef(new ThreadSafeCoordinatedSurface(size, flags, ImageBuffer::create(size))); 38 38 } 39 39 40 PassRefPtr<CoordinatedSurface> CoordinatedSurface::create(const IntSize& size, Flags flags) 40 ThreadSafeCoordinatedSurface::ThreadSafeCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags, PassOwnPtr<ImageBuffer> buffer) 41 : CoordinatedSurface(size, flags) 42 , m_imageBuffer(buffer) 41 43 { 42 ASSERT(s_factory); 43 return s_factory(size, flags); 44 } 45 46 ThreadSafeCoordinatedSurface::~ThreadSafeCoordinatedSurface() 47 { 48 } 49 50 void ThreadSafeCoordinatedSurface::paintToSurface(const IntRect& rect, CoordinatedSurface::Client* client) 51 { 52 ASSERT(client); 53 ASSERT(m_imageBuffer); 54 55 GraphicsContext* context = m_imageBuffer->context(); 56 context->save(); 57 context->clip(rect); 58 context->translate(rect.x(), rect.y()); 59 60 client->paintToSurfaceContext(context); 61 62 context->restore(); 63 } 64 65 void ThreadSafeCoordinatedSurface::copyToTexture(PassRefPtr<BitmapTexture> passTexture, const IntRect& target, const IntPoint& sourceOffset) 66 { 67 RefPtr<BitmapTexture> texture(passTexture); 68 69 ASSERT(m_imageBuffer); 70 RefPtr<Image> image = m_imageBuffer->copyImage(DontCopyBackingStore); 71 texture->updateContents(image.get(), target, sourceOffset, BitmapTexture::UpdateCanModifyOriginalImageData); 44 72 } 45 73 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/ThreadSafeCoordinatedSurface.h
r152306 r152307 24 24 */ 25 25 26 #i nclude "config.h"27 # include "CoordinatedSurface.h"26 #ifndef ThreadSafeCoordinatedSurface_h 27 #define ThreadSafeCoordinatedSurface_h 28 28 29 29 #if USE(COORDINATED_GRAPHICS) 30 #include "CoordinatedSurface.h" 31 #include "ImageBuffer.h" 30 32 31 33 namespace WebCore { 32 34 33 CoordinatedSurface::Factory* CoordinatedSurface::s_factory = 0; 35 class ThreadSafeCoordinatedSurface : public CoordinatedSurface { 36 public: 37 virtual ~ThreadSafeCoordinatedSurface(); 34 38 35 void CoordinatedSurface::setFactory(CoordinatedSurface::Factory factory) 36 { 37 s_factory = factory; 38 } 39 static PassRefPtr<ThreadSafeCoordinatedSurface> create(const IntSize&, Flags); 39 40 40 PassRefPtr<CoordinatedSurface> CoordinatedSurface::create(const IntSize& size, Flags flags) 41 { 42 ASSERT(s_factory); 43 return s_factory(size, flags); 44 } 41 virtual void paintToSurface(const IntRect&, CoordinatedSurface::Client*) OVERRIDE; 42 virtual void copyToTexture(PassRefPtr<BitmapTexture>, const IntRect& target, const IntPoint& sourceOffset) OVERRIDE; 43 44 private: 45 ThreadSafeCoordinatedSurface(const IntSize&, Flags, PassOwnPtr<ImageBuffer>); 46 47 OwnPtr<ImageBuffer> m_imageBuffer; 48 }; 45 49 46 50 } // namespace WebCore 47 51 48 52 #endif // USE(COORDINATED_GRAPHICS) 53 54 #endif // ThreadSafeCoordinatedSurface_h -
trunk/Source/WebKit2/ChangeLog
r152273 r152307 1 2013-07-02 Jae Hyun Park <jae.park@company100.net> 2 3 Implement CoordinatedSurface for Threaded Coordinated Graphics 4 https://bugs.webkit.org/show_bug.cgi?id=109661 5 6 Reviewed by Noam Rosenthal. 7 8 This is a preparation patch for Threaded Coordianted Graphics. 9 10 This patch implements ThreadSafeCoordinatedSurface using ImageBuffer as a 11 backend. Also, this patch moves common implementation to CoordinatedSurface to 12 prevent duplication of code. 13 14 * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp: 15 (WebKit::WebCoordinatedSurface::WebCoordinatedSurface): 16 * Shared/CoordinatedGraphics/WebCoordinatedSurface.h: 17 1 18 2013-07-01 Alexey Proskuryakov <ap@apple.com> 2 19 -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp
r151353 r152307 124 124 125 125 WebCoordinatedSurface::WebCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags, PassRefPtr<ShareableBitmap> bitmap) 126 : m_size(size) 127 , m_flags(flags) 126 : CoordinatedSurface(size, flags) 128 127 , m_bitmap(bitmap) 129 128 { … … 132 131 #if USE(GRAPHICS_SURFACE) 133 132 WebCoordinatedSurface::WebCoordinatedSurface(const WebCore::IntSize& size, CoordinatedSurface::Flags flags, PassRefPtr<WebCore::GraphicsSurface> surface) 134 : m_size(size) 135 , m_flags(flags) 133 : CoordinatedSurface(size, flags) 136 134 , m_graphicsSurface(surface) 137 135 { -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h
r151262 r152307 72 72 virtual ~WebCoordinatedSurface(); 73 73 74 virtual WebCore::IntSize size() const OVERRIDE { return m_size; }75 76 74 virtual void paintToSurface(const WebCore::IntRect&, WebCore::CoordinatedSurface::Client*) OVERRIDE; 77 75 … … 82 80 private: 83 81 WebCoordinatedSurface(const WebCore::IntSize&, Flags, PassRefPtr<ShareableBitmap>); 84 85 virtual Flags flags() const OVERRIDE { return m_flags; }86 82 87 83 // Create a WebCoordinatedSurface referencing an existing ShareableBitmap. … … 99 95 #endif 100 96 101 WebCore::IntSize m_size;102 Flags m_flags;103 97 RefPtr<ShareableBitmap> m_bitmap; 104 98
Note: See TracChangeset
for help on using the changeset viewer.