Changeset 238839 in webkit
- Timestamp:
- Dec 3, 2018 8:03:13 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238838 r238839 1 2018-12-03 Justin Michaud <justin_michaud@apple.com> 2 3 CSS Painting API should scale display list when drawing 4 https://bugs.webkit.org/show_bug.cgi?id=192217 5 6 Reviewed by Simon Fraser. 7 8 * fast/css-custom-paint/properties-expected.html: 9 * fast/css-custom-paint/registerPaintBindings-expected.html: 10 * fast/css-custom-paint/simple-hidpi-expected.html: Added. 11 * fast/css-custom-paint/simple-hidpi.html: Added. 12 * fast/css-custom-paint/worklet-expected.html: 13 1 14 2018-12-03 Myles C. Maxfield <mmaxfield@apple.com> 2 15 -
trunk/LayoutTests/fast/css-custom-paint/properties-expected.html
r237981 r238839 7 7 </style> 8 8 9 <canvas id="paint" width="150px" height="150px" ></canvas>10 <canvas id="paint2" width="150px" height="150px" ></canvas>9 <canvas id="paint" style="width: 150px; height: 150px;" ></canvas> 10 <canvas id="paint2" style="width: 150px; height: 150px;" ></canvas> 11 11 12 12 <script id="code"> 13 13 for (canvasID of ['paint', 'paint2']) { 14 var canvas = document.getElementById(canvasID); 15 var ctx = canvas.getContext('2d'); 14 const canvas = document.getElementById(canvasID); 15 canvas.width = 150 * window.devicePixelRatio; 16 canvas.height = 150 * window.devicePixelRatio; 17 18 const ctx = canvas.getContext('2d'); 19 ctx.scale(window.devicePixelRatio, window.devicePixelRatio); 16 20 17 21 for (var i = 0; i < 6; i++){ -
trunk/LayoutTests/fast/css-custom-paint/registerPaintBindings-expected.html
r237766 r238839 1 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] --> 2 2 3 <canvas id="paint" width="150px" height="150px" ></canvas>3 <canvas id="paint" style="width: 150px; height: 150px;" ></canvas> 4 4 5 5 <script id="code"> 6 var canvas = document.getElementById('paint'); 7 var ctx = canvas.getContext('2d'); 6 const canvas = document.getElementById('paint'); 7 canvas.width = 150 * window.devicePixelRatio; 8 canvas.height = 150 * window.devicePixelRatio; 9 10 const ctx = canvas.getContext('2d'); 11 ctx.scale(window.devicePixelRatio, window.devicePixelRatio); 8 12 9 13 for (var i = 0; i < 6; i++){ -
trunk/LayoutTests/fast/css-custom-paint/worklet-expected.html
r237766 r238839 1 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSPaintingAPIEnabled=true ] --> 2 2 3 <canvas id="paint" width="150px" height="150px" ></canvas>3 <canvas id="paint" style="width: 150px; height: 150px;" ></canvas> 4 4 5 5 <script id="code"> 6 var canvas = document.getElementById('paint'); 7 var ctx = canvas.getContext('2d'); 6 const canvas = document.getElementById('paint'); 7 canvas.width = 150 * window.devicePixelRatio; 8 canvas.height = 150 * window.devicePixelRatio; 9 10 const ctx = canvas.getContext('2d'); 11 ctx.scale(window.devicePixelRatio, window.devicePixelRatio); 8 12 9 13 for (var i = 0; i < 6; i++){ -
trunk/Source/WebCore/ChangeLog
r238838 r238839 1 2018-12-03 Justin Michaud <justin_michaud@apple.com> 2 3 CSS Painting API should scale display list when drawing 4 https://bugs.webkit.org/show_bug.cgi?id=192217 5 6 Reviewed by Simon Fraser. 7 8 When we replay the display list, fix the scaling. The separate buffer is needed to make sure that globalCompositeOperation functions correctly. 9 10 * html/CustomPaintCanvas.cpp: 11 (WebCore::CustomPaintCanvas::replayDisplayList const): 12 * html/CustomPaintCanvas.h: 13 * platform/graphics/CustomPaintImage.cpp: 14 (WebCore::CustomPaintImage::doCustomPaint): 15 1 16 2018-12-03 Myles C. Maxfield <mmaxfield@apple.com> 2 17 -
trunk/Source/WebCore/html/CustomPaintCanvas.cpp
r237409 r238839 94 94 } 95 95 96 void CustomPaintCanvas::replayDisplayList(GraphicsContext* ctx) const 97 { 98 ASSERT(!m_destinationGraphicsContext); 99 if (!width() || !height()) 100 return; 101 102 // FIXME: Using an intermediate buffer is not needed if there are no composite operations. 103 auto clipBounds = ctx->clipBounds(); 104 105 auto image = ImageBuffer::createCompatibleBuffer(clipBounds.size(), *ctx); 106 if (!image) 107 return; 108 109 m_destinationGraphicsContext = &image->context(); 110 m_destinationGraphicsContext->translate(-clipBounds.location()); 111 if (m_context) 112 m_context->paintRenderingResultsToCanvas(); 113 m_destinationGraphicsContext = nullptr; 114 115 ctx->drawImageBuffer(*image, clipBounds); 116 } 117 96 118 Image* CustomPaintCanvas::copiedImage() const 97 119 { -
trunk/Source/WebCore/html/CustomPaintCanvas.h
r237344 r238839 71 71 AffineTransform baseTransform() const final { ASSERT(m_destinationGraphicsContext && m_copiedBuffer); return m_copiedBuffer->baseTransform(); } 72 72 Image* copiedImage() const final; 73 void replayDisplayList(GraphicsContext*) const; 73 74 74 75 using RefCounted::ref; -
trunk/Source/WebCore/platform/graphics/CustomPaintImage.cpp
r238686 r238839 130 130 return ImageDrawResult::DidNothing; 131 131 132 auto image = canvas->copiedImage(); 133 if (!image) 134 return ImageDrawResult::DidNothing; 135 136 destContext.drawImage(*image, FloatPoint()); 132 canvas->replayDisplayList(&destContext); 137 133 138 134 return ImageDrawResult::DidDraw;
Note: See TracChangeset
for help on using the changeset viewer.