Skip to content

Commit

Permalink
REGRESSION(267604@main) Tiles sometimes render upside down
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=261157
rdar://114966792

Reviewed by Simon Fraser.

Remove the double setup for the ImageBufferBackend base transform.
These hunks were missing from 267604@main.

* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::context const):
(WebCore::ImageBuffer::releaseGraphicsContext):
* Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::applyBaseTransform const): Deleted.
* Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.h:
* Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::ImageBufferCGBitmapBackend):
* Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::context):
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBitmapBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBitmapBackend::ImageBufferShareableMappedIOSurfaceBitmapBackend):
(WebKit::ImageBufferShareableMappedIOSurfaceBitmapBackend::context):

Canonical link: https://commits.webkit.org/267632@main
  • Loading branch information
kkinnunen-apple committed Sep 5, 2023
1 parent 7ca5a9d commit da0741f
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 15 deletions.
6 changes: 4 additions & 2 deletions Source/WebCore/platform/graphics/ImageBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ GraphicsContext& ImageBuffer::context() const
ASSERT(volatilityState() == VolatilityState::NonVolatile);
auto& context = m_backend->context();
if (!m_hasInitializedContext) {
context.applyDeviceScaleFactor(m_parameters.resolutionScale);
context.setCTM(m_backendInfo.baseTransform);
m_hasInitializedContext = true;
}
Expand Down Expand Up @@ -552,9 +553,10 @@ bool ImageBuffer::isInUse() const

void ImageBuffer::releaseGraphicsContext()
{
if (auto* backend = ensureBackendCreated())
if (auto* backend = ensureBackendCreated()) {
m_hasInitializedContext = false;
return backend->releaseGraphicsContext();
m_hasInitializedContext = false;
}
}

bool ImageBuffer::setVolatile()
Expand Down
5 changes: 0 additions & 5 deletions Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ std::unique_ptr<ThreadSafeImageBufferFlusher> ImageBufferCGBackend::createFlushe

ImageBufferCGBackend::~ImageBufferCGBackend() = default;

void ImageBufferCGBackend::applyBaseTransform(GraphicsContextCG& context) const
{
context.applyDeviceScaleFactor(m_parameters.resolutionScale);
}

String ImageBufferCGBackend::debugDescription() const
{
TextStream stream;
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class WEBCORE_EXPORT ImageBufferCGBackend : public ImageBufferBackend {

protected:
using ImageBufferBackend::ImageBufferBackend;
void applyBaseTransform(GraphicsContextCG&) const;

std::unique_ptr<ThreadSafeImageBufferFlusher> createFlusher() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ ImageBufferCGBitmapBackend::ImageBufferCGBitmapBackend(const Parameters& paramet
ASSERT(m_dataProvider);
m_context = WTFMove(context);
ASSERT(m_context);
applyBaseTransform(*m_context);
}

ImageBufferCGBitmapBackend::~ImageBufferCGBitmapBackend() = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ ImageBufferIOSurfaceBackend::~ImageBufferIOSurfaceBackend()

GraphicsContext& ImageBufferIOSurfaceBackend::context()
{
if (!m_context) {
if (!m_context)
m_context = makeUnique<GraphicsContextCG>(ensurePlatformContext());
applyBaseTransform(*m_context);
}
return *m_context;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ ImageBufferShareableMappedIOSurfaceBitmapBackend::ImageBufferShareableMappedIOSu
, m_ioSurfacePool(ioSurfacePool)
{
m_context = makeUnique<GraphicsContextCG>(lockAndContext.context.get());
applyBaseTransform(*m_context);
}

ImageBufferShareableMappedIOSurfaceBitmapBackend::~ImageBufferShareableMappedIOSurfaceBitmapBackend()
Expand Down Expand Up @@ -102,15 +101,13 @@ GraphicsContext& ImageBufferShareableMappedIOSurfaceBitmapBackend::context()
if (lockAndContext) {
m_lock = WTFMove(lockAndContext->lock);
m_context = makeUnique<GraphicsContextCG>(lockAndContext->context.get());
applyBaseTransform(*m_context);
return *m_context;
}
}
// For some reason we ran into an error. Construct an invalid context, with current API we must
// return an object.
RELEASE_LOG(RemoteLayerBuffers, "ImageBufferShareableMappedIOSurfaceBitmapBackend::context() - failed to create or update the context");
m_context = makeUnique<GraphicsContextCG>(nullptr);
applyBaseTransform(*m_context);
return *m_context;
}

Expand Down

0 comments on commit da0741f

Please sign in to comment.