Refactor FrameBuffer blit/flip source.
Pass a surface to the blit/flip functions, instead of a raw pointer.
This puts the FrameBuffer in control of locking and unlocking.
Change-Id: I55335b3beef8d7083aae7687bd25392964261bde
Reviewed-on: https://swiftshader-review.googlesource.com/4482
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Main/FrameBufferGDI.cpp b/src/Main/FrameBufferGDI.cpp
index 2668e10..90a469e 100644
--- a/src/Main/FrameBufferGDI.cpp
+++ b/src/Main/FrameBufferGDI.cpp
@@ -71,14 +71,14 @@
{
}
- void FrameBufferGDI::flip(void *source, Format sourceFormat, size_t sourceStride)
+ void FrameBufferGDI::flip(sw::Surface *source)
{
- blit(source, 0, 0, sourceFormat, sourceStride);
+ blit(source, nullptr, nullptr);
}
- void FrameBufferGDI::blit(void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride)
+ void FrameBufferGDI::blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
{
- copy(source, sourceFormat, sourceStride);
+ copy(source);
int sourceLeft = sourceRect ? sourceRect->x0 : 0;
int sourceTop = sourceRect ? sourceRect->y0 : 0;
@@ -92,12 +92,12 @@
StretchBlt(windowContext, destLeft, destTop, destWidth, destHeight, bitmapContext, sourceLeft, sourceTop, sourceWidth, sourceHeight, SRCCOPY);
}
- void FrameBufferGDI::flip(HWND windowOverride, void *source, Format sourceFormat, size_t sourceStride)
+ void FrameBufferGDI::flip(HWND windowOverride, sw::Surface *source)
{
- blit(windowOverride, source, 0, 0, sourceFormat, sourceStride);
+ blit(windowOverride, source, nullptr, nullptr);
}
- void FrameBufferGDI::blit(HWND windowOverride, void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride)
+ void FrameBufferGDI::blit(HWND windowOverride, sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
{
if(windowed && windowOverride != 0 && windowOverride != bitmapWindow)
{
@@ -105,7 +105,7 @@
init(windowOverride);
}
- blit(source, sourceRect, destRect, sourceFormat, sourceStride);
+ blit(source, sourceRect, destRect);
}
void FrameBufferGDI::setGammaRamp(GammaRamp *gammaRamp, bool calibrate)