Index: src/gpu/GrGpu.h |
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h |
index d8e5681de150eca89714c9d9a8a831772f1b5b35..92ee6dadf237ad664f4ee5325c9693366289ec2b 100644 |
--- a/src/gpu/GrGpu.h |
+++ b/src/gpu/GrGpu.h |
@@ -12,7 +12,9 @@ |
#include "GrProgramDesc.h" |
#include "GrStencil.h" |
#include "GrXferProcessor.h" |
+#include "SkMipMapLevel.h" |
#include "SkPath.h" |
+#include "SkTArray.h" |
class GrBatchTracker; |
class GrContext; |
@@ -79,18 +81,24 @@ public: |
* |
* @param desc describes the texture to be created. |
* @param budgeted does this texture count against the resource cache budget? |
- * @param srcData texel data to load texture. Begins with full-size |
- * palette data for paletted textures. For compressed |
- * formats it contains the compressed pixel data. Otherwise, |
- * it contains width*height texels. If nullptr texture data |
- * is uninitialized. |
- * @param rowBytes the number of bytes between consecutive rows. Zero |
- * means rows are tightly packed. This field is ignored |
- * for compressed formats. |
- * |
+ * @param texels array of mipmap levels containing texel data to load. |
+ * Begins with full-size palette data for paletted textures. |
+ * For compressed formats it contains the compressed pixel data. |
+ * Otherwise, it contains width*height texels. If there is only one |
+ * element and it contains nullptr fTexels, texture data is |
+ * uninitialized. |
* @return The texture object if successful, otherwise nullptr. |
*/ |
GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, |
+ const SkTArray<SkMipMapLevel>& texels); |
+ |
+ /** |
+ * This function is a shim which creates a SkTArray<SkMipMapLevel> of size 1. |
+ * It then calls createTexture() with that SkTArray. |
+ * This is so older code which currently uses this function signature will |
bsalomon
2015/09/15 13:14:11
-older
|
+ * continue to work. |
+ */ |
+ GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, |
const void* srcData, size_t rowBytes); |
/** |
@@ -181,7 +189,7 @@ public: |
bool getReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes, |
GrPixelConfig readConfig, DrawPreference*, ReadPixelTempDrawInfo*); |
- /** Info struct returned by getWritePixelsInfo about performing an intermediate draw in order |
+ /** Info struct returned by getWritePixelsInfo about performing an intermediate draw in order |
to write pixels to a GrSurface for either performance or correctness reasons. */ |
struct WritePixelTempDrawInfo { |
/** If the GrGpu is requesting that the caller upload to an intermediate surface and draw |
@@ -203,7 +211,7 @@ public: |
* that would allow a successful transfer of the src pixels to the dst. The passed width, |
* height, and rowBytes, must be non-zero and already reflect clipping to the dst bounds. |
*/ |
- bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes, |
+ bool getWritePixelsInfo(GrSurface* dstSurface, int width, int height, |
GrPixelConfig srcConfig, DrawPreference*, WritePixelTempDrawInfo*); |
/** |
@@ -238,9 +246,18 @@ public: |
* @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 memory to read pixels from |
- * @param rowBytes number of bytes between consecutive rows. Zero |
- * means rows are tightly packed. |
+ * @param texels array of mipmap levels containing texture data |
+ */ |
+ bool writePixels(GrSurface* surface, |
+ int left, int top, int width, int height, |
+ GrPixelConfig config, |
+ const SkTArray<SkMipMapLevel>& texels); |
+ |
+ /** |
+ * This function is a shim which creates a SkTArray<SkMipMapLevel> of size 1. |
+ * It then calls writePixels() with that SkTArray. |
+ * This is so older code which currently uses this function signature will |
bsalomon
2015/09/15 13:14:11
-older
|
+ * continue to work. |
*/ |
bool writePixels(GrSurface* surface, |
int left, int top, int width, int height, |
@@ -421,10 +438,11 @@ private: |
// onCreateTexture/CompressedTexture are called. |
virtual GrTexture* onCreateTexture(const GrSurfaceDesc& desc, |
GrGpuResource::LifeCycle lifeCycle, |
- const void* srcData, size_t rowBytes) = 0; |
+ const SkTArray<SkMipMapLevel>& texels) = 0; |
virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
GrGpuResource::LifeCycle lifeCycle, |
- const void* srcData) = 0; |
+ const SkTArray<SkMipMapLevel>& texels) = 0; |
+ |
virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) = 0; |
virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
GrWrapOwnership) = 0; |
@@ -445,7 +463,7 @@ private: |
virtual bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, |
size_t rowBytes, GrPixelConfig readConfig, DrawPreference*, |
ReadPixelTempDrawInfo*) = 0; |
- virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes, |
+ virtual bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, |
GrPixelConfig srcConfig, DrawPreference*, |
WritePixelTempDrawInfo*) = 0; |
@@ -460,8 +478,8 @@ private: |
// overridden by backend-specific derived class to perform the surface write |
virtual bool onWritePixels(GrSurface*, |
int left, int top, int width, int height, |
- GrPixelConfig config, const void* buffer, |
- size_t rowBytes) = 0; |
+ GrPixelConfig config, |
+ const SkTArray<SkMipMapLevel>& texels) = 0; |
// overridden by backend-specific derived class to perform the resolve |
virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |