Changeset 251654 in webkit
- Timestamp:
- Oct 28, 2019 8:06:07 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r251651 r251654 1 2019-10-28 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r251651. 4 https://bugs.webkit.org/show_bug.cgi?id=203488 5 6 It's causing crashes in several tests (Requested by KaL on 7 #webkit). 8 9 Reverted changeset: 10 11 "ImageDecoders: use a thread safe data buffer for Cairo 12 backing store" 13 https://bugs.webkit.org/show_bug.cgi?id=201727 14 https://trac.webkit.org/changeset/251651 15 1 16 2019-10-28 Charlie Turner <cturner@igalia.com> 2 17 -
trunk/Source/WebCore/platform/graphics/ImageBackingStore.h
r251651 r251654 60 60 return false; 61 61 62 m_pixels = RGBAPixelBufferThreadSafeRefCounted::create(size); 63 64 if (!m_pixels->isValid()) 62 Vector<char> buffer; 63 size_t bufferSize = size.area().unsafeGet() * sizeof(RGBA32); 64 65 if (!buffer.tryReserveCapacity(bufferSize)) 65 66 return false; 66 67 68 buffer.grow(bufferSize); 69 m_pixels = SharedBuffer::create(WTFMove(buffer)); 70 m_pixelsPtr = reinterpret_cast<RGBA32*>(const_cast<char*>(m_pixels->data())); 67 71 m_size = size; 68 72 m_frameRect = IntRect(IntPoint(), m_size); … … 83 87 void clear() 84 88 { 85 m _pixels->zeroPixelData();89 memset(m_pixelsPtr, 0, (m_size.area() * sizeof(RGBA32)).unsafeGet()); 86 90 } 87 91 … … 130 134 { 131 135 ASSERT(inBounds(IntPoint(x, y))); 132 return m_pixels ->pixelAt(x, y);136 return m_pixelsPtr + y * m_size.width() + x; 133 137 } 134 138 … … 186 190 187 191 private: 188 class RGBAPixelBufferThreadSafeRefCounted : public ThreadSafeRefCounted<RGBAPixelBufferThreadSafeRefCounted> {189 public:190 static Ref<RGBAPixelBufferThreadSafeRefCounted> create(const IntSize& initialSize) { return adoptRef(*new RGBAPixelBufferThreadSafeRefCounted(initialSize)); }191 void zeroPixelData() { m_pixels.fill(0); }192 RGBA32* pixelAt(int x, int y) const { return const_cast<unsigned*>(&m_pixels.data()[y * m_size.width() + x]); }193 const RGBA32* data() const { return m_pixels.data(); }194 bool isValid() const { return m_isValid; }195 private:196 RGBAPixelBufferThreadSafeRefCounted(const IntSize& initialSize)197 : m_size(initialSize)198 {199 unsigned bufferSize = initialSize.area().unsafeGet();200 m_isValid = m_pixels.tryReserveCapacity(bufferSize);201 if (m_isValid)202 m_pixels.resize(bufferSize);203 }204 IntSize m_size;205 Vector<RGBA32> m_pixels;206 bool m_isValid { false };207 };208 209 192 ImageBackingStore(const IntSize& size, bool premultiplyAlpha = true) 210 193 : m_premultiplyAlpha(premultiplyAlpha) … … 219 202 { 220 203 ASSERT(!m_size.isEmpty() && !isOverSize(m_size)); 204 m_pixels = SharedBuffer::create(other.m_pixels->data(), other.m_pixels->size()); 205 m_pixelsPtr = reinterpret_cast<RGBA32*>(const_cast<char*>(m_pixels->data())); 221 206 } 222 207 … … 242 227 } 243 228 244 RefPtr< RGBAPixelBufferThreadSafeRefCounted> m_pixels;245 229 RefPtr<SharedBuffer> m_pixels; 230 RGBA32* m_pixelsPtr { nullptr }; 246 231 IntSize m_size; 247 232 IntRect m_frameRect; // This will always just be the entire buffer except for GIF and PNG frames -
trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp
r251651 r251654 35 35 m_pixels->ref(); 36 36 RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data( 37 reinterpret_cast<unsigned char*>(const_cast<uint32_t*>(m_pixels ->data())),37 reinterpret_cast<unsigned char*>(const_cast<uint32_t*>(m_pixelsPtr)), 38 38 CAIRO_FORMAT_ARGB32, size().width(), size().height(), size().width() * sizeof(uint32_t))); 39 39 static cairo_user_data_key_t s_surfaceDataKey; 40 cairo_surface_set_user_data(surface.get(), &s_surfaceDataKey, m_pixels.get(), [](void* data) { static_cast< RGBAPixelBufferThreadSafeRefCounted*>(data)->deref(); });40 cairo_surface_set_user_data(surface.get(), &s_surfaceDataKey, m_pixels.get(), [](void* data) { static_cast<SharedBuffer*>(data)->deref(); }); 41 41 42 42 return surface;
Note: See TracChangeset
for help on using the changeset viewer.