Changeset 252136 in webkit
- Timestamp:
- Nov 6, 2019 5:13:10 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252134 r252136 1 2019-11-06 Chris Lord <clord@igalia.com> 2 3 [Cairo] Cairo graphics backend uses ImageBuffer::copyImage just to access native image buffer handles 4 https://bugs.webkit.org/show_bug.cgi?id=203884 5 6 Reviewed by Carlos Garcia Campos. 7 8 The Cairo graphics backend uses ImageBuffer::copyImage(DontCopyBackingStore) frequently just to access 9 the native image pointer. This makes several functions unusable off-main-thread, so add an accessor 10 function to avoid doing this. 11 12 No new tests -- no change in behavior. 13 14 * platform/graphics/ImageBuffer.h: 15 * platform/graphics/cairo/CairoOperations.cpp: 16 (WebCore::Cairo::drawShadowLayerBuffer): 17 (WebCore::Cairo::drawShadowImage): 18 (WebCore::Cairo::fillShadowBuffer): 19 * platform/graphics/cairo/GraphicsContextCairo.cpp: 20 (WebCore::GraphicsContext::clipToImageBuffer): 21 * platform/graphics/cairo/GraphicsContextImplCairo.cpp: 22 (WebCore::GraphicsContextImplCairo::clipToImageBuffer): 23 * platform/graphics/cairo/ImageBufferCairo.cpp: 24 (WebCore::ImageBuffer::nativeImage const): 25 1 26 2019-11-06 Philippe Normand <philn@igalia.com> 2 27 -
trunk/Source/WebCore/platform/graphics/ImageBuffer.h
r249217 r252136 117 117 Vector<uint8_t> toBGRAData() const; 118 118 119 #if USE(CAIRO) 120 NativeImagePtr nativeImage() const; 121 #endif 122 119 123 #if !USE(CG) 120 124 AffineTransform baseTransform() const { return AffineTransform(); } -
trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp
r249937 r252136 175 175 static void drawShadowLayerBuffer(PlatformContextCairo& platformContext, ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize, const ShadowState& shadowState) 176 176 { 177 RefPtr<Image> image = layerImage.copyImage(DontCopyBackingStore); 178 if (!image) 179 return; 180 181 if (auto surface = image->nativeImageForCurrentFrame()) { 177 if (auto surface = layerImage.nativeImage()) { 182 178 drawNativeImage(platformContext, surface.get(), FloatRect(roundedIntPoint(layerOrigin), layerSize), FloatRect(FloatPoint(), layerSize), { shadowState.globalCompositeOperator }, shadowState.globalAlpha, ShadowState()); 183 179 } … … 187 183 static void drawShadowImage(PlatformContextCairo& platformContext, ImageBuffer& layerImage, const FloatRect& destRect, const FloatRect& srcRect, const ShadowState& shadowState) 188 184 { 189 RefPtr<Image> image = layerImage.copyImage(DontCopyBackingStore); 190 if (!image) 191 return; 192 193 if (auto surface = image->nativeImageForCurrentFrame()) { 185 if (auto surface = layerImage.nativeImage()) { 194 186 drawNativeImage(platformContext, surface.get(), destRect, srcRect, { shadowState.globalCompositeOperator }, shadowState.globalAlpha, ShadowState()); 195 187 } … … 200 192 save(platformContext); 201 193 202 RefPtr<Image> image = layerImage.copyImage(DontCopyBackingStore); 203 if (image) { 204 if (auto surface = image->nativeImageForCurrentFrame()) 205 clipToImageBuffer(platformContext, surface.get(), FloatRect(layerOrigin, expandedIntSize(layerSize))); 206 } 194 if (auto surface = layerImage.nativeImage()) 195 clipToImageBuffer(platformContext, surface.get(), FloatRect(layerOrigin, expandedIntSize(layerSize))); 207 196 208 197 FillSource fillSource; -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r249217 r252136 268 268 } 269 269 270 RefPtr<Image> image = buffer.copyImage(DontCopyBackingStore); 271 if (!image) 272 return; 273 274 ASSERT(hasPlatformContext()); 275 if (auto surface = image->nativeImageForCurrentFrame()) 270 ASSERT(hasPlatformContext()); 271 if (auto surface = buffer.nativeImage()) 276 272 Cairo::clipToImageBuffer(*platformContext(), surface.get(), destRect); 277 273 } -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp
r249217 r252136 412 412 void GraphicsContextImplCairo::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& destRect) 413 413 { 414 RefPtr<Image> image = buffer.copyImage(DontCopyBackingStore); 415 if (!image) 416 return; 417 418 if (auto surface = image->nativeImageForCurrentFrame()) 414 if (auto surface = buffer.nativeImage()) 419 415 Cairo::clipToImageBuffer(m_platformContext, surface.get(), destRect); 420 416 } -
trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
r249217 r252136 260 260 } 261 261 262 NativeImagePtr ImageBuffer::nativeImage() const 263 { 264 return m_data.m_surface.get(); 265 } 266 262 267 ImageBuffer::ImageBuffer(const FloatSize& size, float resolutionScale, ColorSpace, RenderingMode renderingMode, const HostWindow*, bool& success) 263 268 : m_data(IntSize(size), renderingMode)
Note: See TracChangeset
for help on using the changeset viewer.