Prepare sRGB encoding conversion for the removal of GrPixelConfig
Standardizes that GrGpu subclass's onRead/WritePixels never do sRGB<->linear conversion. This means that they can eventually take a color type rather than config. It also means direct callers of GrGpu::read/writePixels can never expect conversion (which in practice is no change).
Consolidate logic about whether to do sRGB<->linear encoding conversions in GrContext::read/writeSurfacePixels helpers. No change in when conversions are done (yet). This prepares this logic to operate on SkColorSpace and color type rather than config WRT the CPU data.
Bug: skia:6718
Change-Id: I346d669624861578f1bb9ea465a7ab4b549117fa
Reviewed-on: https://skia-review.googlesource.com/105286
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index 6221d91..4cbd49c 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -25,25 +25,6 @@
~GrMockGpu() override {}
- bool onGetReadPixelsInfo(GrSurface* srcSurface, GrSurfaceOrigin srcOrigin,
- int readWidth, int readHeight, size_t rowBytes,
- GrPixelConfig readConfig, DrawPreference*,
- ReadPixelTempDrawInfo*) override { return true; }
-
- bool onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin dstOrigin,
- int width, int height,
- GrPixelConfig srcConfig, DrawPreference*,
- WritePixelTempDrawInfo*) override { return true; }
-
- bool onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin,
- GrSurface* src, GrSurfaceOrigin srcOrigin,
- const SkIRect& srcRect, const SkIPoint& dstPoint) override { return true; }
-
- void onQueryMultisampleSpecs(GrRenderTarget* rt, GrSurfaceOrigin, const GrStencilSettings&,
- int* effectiveSampleCnt, SamplePattern*) override {
- *effectiveSampleCnt = rt->numStencilSamples();
- }
-
GrGpuRTCommandBuffer* createCommandBuffer(
GrRenderTarget*, GrSurfaceOrigin,
const GrGpuRTCommandBuffer::LoadAndStoreInfo&,
@@ -99,6 +80,18 @@
GrBuffer* onCreateBuffer(size_t sizeInBytes, GrBufferType, GrAccessPattern,
const void*) override;
+ bool onGetReadPixelsInfo(GrSurface*, GrSurfaceOrigin, int width, int height,
+ size_t rowBytes, GrPixelConfig, DrawPreference*,
+ ReadPixelTempDrawInfo*) override {
+ return true;
+ }
+
+ bool onGetWritePixelsInfo(GrSurface* dstSurface, GrSurfaceOrigin, int width,
+ int height, GrPixelConfig, DrawPreference*,
+ WritePixelTempDrawInfo*) override {
+ return true;
+ }
+
bool onReadPixels(GrSurface* surface, GrSurfaceOrigin,
int left, int top, int width, int height,
GrPixelConfig,
@@ -121,6 +114,17 @@
return true;
}
+ bool onCopySurface(GrSurface* dst, GrSurfaceOrigin dstOrigin, GrSurface* src,
+ GrSurfaceOrigin srcOrigin, const SkIRect& srcRect,
+ const SkIPoint& dstPoint) override {
+ return true;
+ }
+
+ void onQueryMultisampleSpecs(GrRenderTarget* rt, GrSurfaceOrigin, const GrStencilSettings&,
+ int* effectiveSampleCnt, SamplePattern*) override {
+ *effectiveSampleCnt = rt->numStencilSamples();
+ }
+
void onResolveRenderTarget(GrRenderTarget* target) override { return; }
void onFinishFlush(bool insertedSemaphores) override {}