| Index: src/gpu/GrGpu.h
|
| diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
|
| index d8e5681de150eca89714c9d9a8a831772f1b5b35..ffcdd5b9e723597ff9244690d6b52414b5f5a492 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,27 @@ 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 Pointer to the pixel values (optional).
|
| + * @param rowBytes The number of bytes between rows for the texture. Zero
|
| + * implies tightly packed rows. For compressed pixel configs, this
|
| + * field is ignored.
|
| + */
|
| + GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted,
|
| const void* srcData, size_t rowBytes);
|
|
|
| /**
|
| @@ -181,7 +192,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 +214,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 +249,21 @@ 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 Pointer to the pixel values (optional).
|
| + * @param rowBytes The number of bytes between rows of the texture. Zero
|
| + * implies tightly packed rows. For compressed pixel configs, this
|
| + * field is ignored.
|
| */
|
| bool writePixels(GrSurface* surface,
|
| int left, int top, int width, int height,
|
| @@ -421,10 +444,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 +469,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 +484,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;
|
|
|