| Index: src/gpu/GrGpu.h
|
| diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
|
| index 3eaa3fc035e27ebc821b16825f26d24443e02f8c..3361ab2263a20ecaf3e39dcbcd1756ded85c550d 100644
|
| --- a/src/gpu/GrGpu.h
|
| +++ b/src/gpu/GrGpu.h
|
| @@ -13,7 +13,9 @@
|
| #include "GrStencil.h"
|
| #include "GrTextureParamsAdjuster.h"
|
| #include "GrXferProcessor.h"
|
| +#include "SkMipMapLevel.h"
|
| #include "SkPath.h"
|
| +#include "SkTArray.h"
|
|
|
| class GrBatchTracker;
|
| class GrContext;
|
| @@ -81,18 +83,32 @@ 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.
|
| + *
|
| + * @param srcData texel data to load texture. Begins with full-size
|
| + * palette data for paletted texture. 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 pixel formats.
|
| + * @return The texture object if successful, otherwise, nullptr.
|
| + */
|
| + GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted,
|
| const void* srcData, size_t rowBytes);
|
|
|
| /**
|
| @@ -194,7 +210,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
|
| @@ -216,7 +232,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*);
|
|
|
| /**
|
| @@ -251,9 +267,20 @@ 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.
|
| + *
|
| + * @param buffer memory to read pixels from.
|
| + * @param rowBytes number of bytes between consecutive rows. Zero
|
| + * means rows are tightly packed.
|
| */
|
| bool writePixels(GrSurface* surface,
|
| int left, int top, int width, int height,
|
| @@ -484,10 +511,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;
|
| @@ -509,7 +537,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;
|
|
|
| @@ -524,8 +552,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 surface write
|
| virtual bool onTransferPixels(GrSurface*,
|
|
|