| 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 "SkPoint.h" | 12 #include "SkImageInfo.h" |
| 13 #include "SkXfermode.h" |
| 13 | 14 |
| 14 class GrCaps; | 15 class GrCaps; |
| 16 class GrContext; |
| 17 class GrFragmentProcessor; |
| 18 class GrPaint; |
| 15 class GrUniqueKey; | 19 class GrUniqueKey; |
| 20 class SkPaint; |
| 21 class SkMatrix; |
| 22 struct SkIRect; |
| 16 | 23 |
| 17 /** | 24 /** |
| 18 * Our key includes the offset, width, and height so that bitmaps created by ex
tractSubset() | 25 * Our key includes the offset, width, and height so that bitmaps created by ex
tractSubset() |
| 19 * are unique. | 26 * are unique. |
| 20 * | 27 * |
| 21 * The imageID is in the shared namespace (see SkNextID::ImageID() | 28 * The imageID is in the shared namespace (see SkNextID::ImageID() |
| 22 * - SkBitmap/SkPixelRef | 29 * - SkBitmap/SkPixelRef |
| 23 * - SkImage | 30 * - SkImage |
| 24 * - SkImageGenerator | 31 * - SkImageGenerator |
| 25 * | 32 * |
| 26 * Note: width/height must fit in 16bits for this impl. | 33 * Note: width/height must fit in 16bits for this impl. |
| 27 */ | 34 */ |
| 28 void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima
geBounds, | 35 void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima
geBounds, |
| 29 const GrCaps&, SkImageUsageType); | 36 const GrCaps&, SkImageUsageType); |
| 30 | 37 |
| 38 /** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is requir
ed in order |
| 39 to convert the SkShader (if any) on the SkPaint. */ |
| 40 bool SkPaintToGrPaint(GrContext*, |
| 41 const SkPaint& skPaint, |
| 42 const SkMatrix& viewM, |
| 43 GrPaint* grPaint); |
| 44 |
| 45 /** Ignores the SkShader (if any) on skPaint. */ |
| 46 bool SkPaintToGrPaintNoShader(GrContext* context, |
| 47 const SkPaint& skPaint, |
| 48 GrPaint* grPaint); |
| 49 |
| 50 /** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProce
ssor. The processor |
| 51 should expect an unpremul input color and produce a premultiplied output col
or. */ |
| 52 bool SkPaintToGrPaintReplaceShader(GrContext*, |
| 53 const SkPaint& skPaint, |
| 54 const GrFragmentProcessor* shaderFP, |
| 55 GrPaint* grPaint); |
| 56 |
| 57 /** Blends the SkPaint's shader (or color if no shader) with the color which spe
cified via a |
| 58 GrBatch's GrPrimitiveProcesssor. Currently there is a bool param to indicate
whether the |
| 59 primitive color is the dst or src color to the blend in order to work around
differences between |
| 60 drawVertices and drawAtlas. |
| 61 */ |
| 62 bool SkPaintToGrPaintWithXfermode(GrContext* context, |
| 63 const SkPaint& skPaint, |
| 64 const SkMatrix& viewM, |
| 65 SkXfermode::Mode primColorMode, |
| 66 bool primitiveIsSrc, |
| 67 GrPaint* grPaint); |
| 68 |
| 31 #endif | 69 #endif |
| OLD | NEW |