Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkGrPriv_DEFINED | 8 #ifndef SkGrPriv_DEFINED |
| 9 #define SkGrPriv_DEFINED | 9 #define SkGrPriv_DEFINED |
| 10 | 10 |
| 11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
| 12 #include "GrTextureAccess.h" | |
| 12 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 13 #include "SkXfermode.h" | 14 #include "SkXfermode.h" |
| 14 | 15 |
| 15 class GrCaps; | 16 class GrCaps; |
| 16 class GrContext; | 17 class GrContext; |
| 17 class GrFragmentProcessor; | 18 class GrFragmentProcessor; |
| 18 class GrPaint; | 19 class GrPaint; |
| 19 class GrUniqueKey; | 20 class GrUniqueKey; |
| 20 class SkPaint; | 21 class SkPaint; |
| 21 class SkMatrix; | 22 class SkMatrix; |
| 22 struct SkIRect; | 23 struct SkIRect; |
| 23 | 24 |
| 24 struct SkGrStretch { | 25 struct SkGrStretch { |
| 25 enum Type { | 26 enum Type { |
| 26 kNone_Type, | 27 kNone_Type, |
| 27 kBilerp_Type, | 28 kBilerp_Type, |
| 28 kNearest_Type | 29 kNearest_Type |
| 29 } fType; | 30 } fType; |
| 30 int fWidth; | 31 int fWidth; |
| 31 int fHeight; | 32 int fHeight; |
| 32 }; | 33 }; |
| 33 | 34 |
| 35 GrTextureParams GrImageUsageToTextureParams(SkImageUsageType); | |
| 36 | |
| 34 /** | 37 /** |
| 35 * Our key includes the offset, width, and height so that bitmaps created by ex tractSubset() | 38 * Our key includes the offset, width, and height so that bitmaps created by ex tractSubset() |
| 36 * are unique. | 39 * are unique. |
| 37 * | 40 * |
| 38 * The imageID is in the shared namespace (see SkNextID::ImageID() | 41 * The imageID is in the shared namespace (see SkNextID::ImageID() |
| 39 * - SkBitmap/SkPixelRef | 42 * - SkBitmap/SkPixelRef |
| 40 * - SkImage | 43 * - SkImage |
| 41 * - SkImageGenerator | 44 * - SkImageGenerator |
| 42 * | 45 * |
| 43 * Note: width/height must fit in 16bits for this impl. | 46 * Note: width/height must fit in 16bits for this impl. |
| 44 */ | 47 */ |
| 45 void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima geBounds, | 48 void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima geBounds, |
| 46 const GrCaps&, SkImageUsageType); | 49 const GrCaps&, SkImageUsageType); |
| 47 | 50 |
| 51 /** | |
| 52 * Given an "unstretched" key, and a stretch rec, produce a stretched key. | |
|
robertphillips
2015/09/30 19:25:56
Returns false if the stretched key cannot be creat
| |
| 53 */ | |
| 54 bool GrMakeStretchedKey(const GrUniqueKey& origKey, const SkGrStretch&, GrUnique Key* stretchedKey); | |
| 55 | |
| 48 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir ed in order | 56 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir ed in order |
| 49 to convert the SkShader (if any) on the SkPaint. */ | 57 to convert the SkShader (if any) on the SkPaint. */ |
| 50 bool SkPaintToGrPaint(GrContext*, | 58 bool SkPaintToGrPaint(GrContext*, |
| 51 const SkPaint& skPaint, | 59 const SkPaint& skPaint, |
| 52 const SkMatrix& viewM, | 60 const SkMatrix& viewM, |
| 53 GrPaint* grPaint); | 61 GrPaint* grPaint); |
| 54 | 62 |
| 55 /** Ignores the SkShader (if any) on skPaint. */ | 63 /** Ignores the SkShader (if any) on skPaint. */ |
| 56 bool SkPaintToGrPaintNoShader(GrContext* context, | 64 bool SkPaintToGrPaintNoShader(GrContext* context, |
| 57 const SkPaint& skPaint, | 65 const SkPaint& skPaint, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 69 primitive color is the dst or src color to the blend in order to work around differences between | 77 primitive color is the dst or src color to the blend in order to work around differences between |
| 70 drawVertices and drawAtlas. | 78 drawVertices and drawAtlas. |
| 71 */ | 79 */ |
| 72 bool SkPaintToGrPaintWithXfermode(GrContext* context, | 80 bool SkPaintToGrPaintWithXfermode(GrContext* context, |
| 73 const SkPaint& skPaint, | 81 const SkPaint& skPaint, |
| 74 const SkMatrix& viewM, | 82 const SkMatrix& viewM, |
| 75 SkXfermode::Mode primColorMode, | 83 SkXfermode::Mode primColorMode, |
| 76 bool primitiveIsSrc, | 84 bool primitiveIsSrc, |
| 77 GrPaint* grPaint); | 85 GrPaint* grPaint); |
| 78 | 86 |
| 87 bool GrTextureUsageSupported(const GrCaps&, int width, int height, SkImageUsageT ype); | |
| 88 | |
| 79 #endif | 89 #endif |
| OLD | NEW |