diff options
author | 2015-10-19 08:24:08 -0700 | |
---|---|---|
committer | 2015-10-19 08:24:09 -0700 | |
commit | 1a197ea31e0aac7ea312e9a6c0d9f5df626b0350 (patch) | |
tree | 0ca9a78db8e6e71b37fd9f25194fef1fb9e5ed94 /src/gpu/SkGrPriv.h | |
parent | cdf79dbf2f18aca733a1d33f8c5f32a8e85c142c (diff) |
Rewrite GrTextureMaker to disentangle bitmap case from base class and give GPU object a say in what copying needs to be done.
Committed: https://skia.googlesource.com/skia/+/fcffaf22d697f06f903c3193308f9dc54a959f79
Review URL: https://codereview.chromium.org/1409163002
Diffstat (limited to 'src/gpu/SkGrPriv.h')
-rw-r--r-- | src/gpu/SkGrPriv.h | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h index c92e580885..593530997f 100644 --- a/src/gpu/SkGrPriv.h +++ b/src/gpu/SkGrPriv.h @@ -26,34 +26,18 @@ class SkPaint; class SkPixelRef; struct SkIRect; -struct SkGrStretch { - enum Type { - kNone_Type, - kBilerp_Type, - kNearest_Type - } fType; - int fWidth; - int fHeight; -}; - /** * Our key includes the offset, width, and height so that bitmaps created by extractSubset() * are unique. * - * The imageID is in the shared namespace (see SkNextID::ImageID() + * The imageID is in the shared namespace (see SkNextID::ImageID()) * - SkBitmap/SkPixelRef * - SkImage * - SkImageGenerator * * Note: width/height must fit in 16bits for this impl. */ -void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& imageBounds, - const GrCaps&, const GrTextureParams&); - -/** - * Given an "unstretched" key, and a stretch rec, produce a stretched key. - */ -bool GrMakeStretchedKey(const GrUniqueKey& origKey, const SkGrStretch&, GrUniqueKey* stretchedKey); +void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& imageBounds); /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is required in order to convert the SkShader (if any) on the SkPaint. The primitive itself has no color. */ @@ -103,21 +87,24 @@ GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&); bool GrPixelConfig2ColorAndProfileType(GrPixelConfig, SkColorType*, SkColorProfileType*); /** -* If the compressed data in the SkData is supported (as a texture format, this returns -* the pixel-config that should be used, and sets outStartOfDataToUpload to the ptr into -* the data where the actual raw data starts (skipping any header bytes). -* -* If the compressed data is not supported, this returns kUnknown_GrPixelConfig, and -* ignores outStartOfDataToUpload. -*/ + * If the compressed data in the SkData is supported (as a texture format, this returns + * the pixel-config that should be used, and sets outStartOfDataToUpload to the ptr into + * the data where the actual raw data starts (skipping any header bytes). + * + * If the compressed data is not supported, this returns kUnknown_GrPixelConfig, and + * ignores outStartOfDataToUpload. + */ GrPixelConfig GrIsCompressedTextureDataSupported(GrContext* ctx, SkData* data, int expectedW, int expectedH, const void** outStartOfDataToUpload); -GrTexture* GrCreateTextureForPixels(GrContext*, const GrUniqueKey& optionalKey, GrSurfaceDesc, - SkPixelRef* pixelRefForInvalidationNotificationOrNull, - const void* pixels, size_t rowBytesOrZero); +/** + * Creates a new texture for the bitmap. Does not concern itself with cache keys or texture params. + * The bitmap must have CPU-accessible pixels. Attempts to take advantage of faster paths for + * compressed textures and yuv planes. + */ +GrTexture* GrUploadBitmapToTexture(GrContext*, const SkBitmap&); ////////////////////////////////////////////////////////////////////////////// |