Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2371)

Unified Diff: src/gpu/GrGpu.h

Issue 1534123003: More framework support for TransferBuffers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address more comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrTypesPriv.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGpu.h
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index d1b0802721e97e8005f3491238da1c295eeb429e..3eaa3fc035e27ebc821b16825f26d24443e02f8c 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -129,11 +129,6 @@ public:
*/
GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic);
- enum TransferType {
- kCpuToGpu_TransferType,
- kGpuToCpu_TransferType
- };
-
/**
* Creates a transfer buffer.
*
@@ -266,6 +261,25 @@ public:
size_t rowBytes);
/**
+ * Updates the pixels in a rectangle of a surface using a GrTransferBuffer
+ *
+ * @param surface The surface to write to.
+ * @param left left edge of the rectangle to write (inclusive)
+ * @param top top edge of the rectangle to write (inclusive)
+ * @param width width of rectangle to write in pixels.
+ * @param height height of rectangle to write in pixels.
+ * @param config the pixel config of the source buffer
+ * @param buffer GrTransferBuffer to read pixels from
+ * @param offset offset from the start of the buffer
+ * @param rowBytes number of bytes between consecutive rows. Zero
+ * means rows are tightly packed.
+ */
+ bool transferPixels(GrSurface* surface,
+ int left, int top, int width, int height,
+ GrPixelConfig config, GrTransferBuffer* buffer,
+ size_t offset, size_t rowBytes);
+
+ /**
* Clear the passed in render target. Ignores the draw state and clip.
*/
void clear(const SkIRect& rect, GrColor color, GrRenderTarget* renderTarget);
@@ -344,6 +358,7 @@ public:
fShaderCompilations = 0;
fTextureCreates = 0;
fTextureUploads = 0;
+ fTransfersToTexture = 0;
fStencilAttachmentCreates = 0;
fNumDraws = 0;
}
@@ -356,6 +371,8 @@ public:
void incTextureCreates() { fTextureCreates++; }
int textureUploads() const { return fTextureUploads; }
void incTextureUploads() { fTextureUploads++; }
+ int transfersToTexture() const { return fTransfersToTexture; }
+ void incTransfersToTexture() { fTransfersToTexture++; }
void incStencilAttachmentCreates() { fStencilAttachmentCreates++; }
void incNumDraws() { fNumDraws++; }
void dump(SkString*);
@@ -366,6 +383,7 @@ public:
int fShaderCompilations;
int fTextureCreates;
int fTextureUploads;
+ int fTransfersToTexture;
int fStencilAttachmentCreates;
int fNumDraws;
#else
@@ -375,6 +393,7 @@ public:
void incShaderCompilations() {}
void incTextureCreates() {}
void incTextureUploads() {}
+ void incTransfersToTexture() {}
void incStencilAttachmentCreates() {}
void incNumDraws() {}
#endif
@@ -508,6 +527,12 @@ private:
GrPixelConfig config, const void* buffer,
size_t rowBytes) = 0;
+ // overridden by backend-specific derived class to perform the surface write
+ virtual bool onTransferPixels(GrSurface*,
+ int left, int top, int width, int height,
+ GrPixelConfig config, GrTransferBuffer* buffer,
+ size_t offset, size_t rowBytes) = 0;
+
// overridden by backend-specific derived class to perform the resolve
virtual void onResolveRenderTarget(GrRenderTarget* target) = 0;
« no previous file with comments | « include/gpu/GrTypesPriv.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698