| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 SkSpecialImage_DEFINED | 8 #ifndef SkSpecialImage_DEFINED |
| 9 #define SkSpecialImage_DEFINED | 9 #define SkSpecialImage_DEFINED |
| 10 | 10 |
| 11 #include "SkNextID.h" | 11 #include "SkNextID.h" |
| 12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
| 13 | 13 |
| 14 // remove this when internal_getProxy goes away (see skbug.com/4965) | 14 // remove this when internal_getProxy goes away (see skbug.com/4965) |
| 15 #include "SkImageFilter.h" | 15 #include "SkImageFilter.h" |
| 16 | 16 |
| 17 #include "SkImageInfo.h" // for SkAlphaType | |
| 18 | |
| 19 class GrContext; | |
| 20 class GrTexture; | 17 class GrTexture; |
| 21 class SkBitmap; | 18 class SkBitmap; |
| 22 class SkCanvas; | 19 class SkCanvas; |
| 23 class SkImage; | 20 class SkImage; |
| 24 struct SkImageInfo; | 21 struct SkImageInfo; |
| 25 class SkPaint; | 22 class SkPaint; |
| 26 class SkPixmap; | |
| 27 class SkSpecialSurface; | 23 class SkSpecialSurface; |
| 28 | 24 |
| 29 enum { | 25 enum { |
| 30 kNeedNewImageUniqueID_SpecialImage = 0 | 26 kNeedNewImageUniqueID_SpecialImage = 0 |
| 31 }; | 27 }; |
| 32 | 28 |
| 33 /** | 29 /** |
| 34 * This is a restricted form of SkImage solely intended for internal use. It | 30 * This is a restricted form of SkImage solely intended for internal use. It |
| 35 * differs from SkImage in that: | 31 * differs from SkImage in that: |
| 36 * - it can only be backed by raster or gpu (no generators) | 32 * - it can only be backed by raster or gpu (no generators) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 | 44 |
| 49 int width() const { return fSubset.width(); } | 45 int width() const { return fSubset.width(); } |
| 50 int height() const { return fSubset.height(); } | 46 int height() const { return fSubset.height(); } |
| 51 const SkIRect& subset() const { return fSubset; } | 47 const SkIRect& subset() const { return fSubset; } |
| 52 | 48 |
| 53 uint32_t uniqueID() const { return fUniqueID; } | 49 uint32_t uniqueID() const { return fUniqueID; } |
| 54 virtual bool isOpaque() const { return false; } | 50 virtual bool isOpaque() const { return false; } |
| 55 virtual size_t getSize() const = 0; | 51 virtual size_t getSize() const = 0; |
| 56 | 52 |
| 57 /** | 53 /** |
| 58 * Ensures that a special image is backed by a texture (when GrContext is n
on-null). If no | |
| 59 * transformation is required, the returned image may be the same as this s
pecial image. | |
| 60 * If this special image is from a different GrContext, this will fail. | |
| 61 */ | |
| 62 sk_sp<SkSpecialImage> makeTextureImage(SkImageFilter::Proxy*, GrContext*); | |
| 63 | |
| 64 /** | |
| 65 * Draw this SpecialImage into the canvas. | 54 * Draw this SpecialImage into the canvas. |
| 66 */ | 55 */ |
| 67 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; | 56 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; |
| 68 | 57 |
| 69 static sk_sp<SkSpecialImage> MakeFromImage(SkImageFilter::Proxy*, | 58 static sk_sp<SkSpecialImage> MakeFromImage(SkImageFilter::Proxy*, |
| 70 const SkIRect& subset, | 59 const SkIRect& subset, |
| 71 sk_sp<SkImage>); | 60 sk_sp<SkImage>); |
| 72 static sk_sp<SkSpecialImage> MakeFromRaster(SkImageFilter::Proxy*, | 61 static sk_sp<SkSpecialImage> MakeFromRaster(SkImageFilter::Proxy*, |
| 73 const SkIRect& subset, | 62 const SkIRect& subset, |
| 74 const SkBitmap&); | 63 const SkBitmap&); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const uint32_t fUniqueID; | 133 const uint32_t fUniqueID; |
| 145 | 134 |
| 146 // TODO: remove this ASAP (see skbug.com/4965) | 135 // TODO: remove this ASAP (see skbug.com/4965) |
| 147 SkImageFilter::Proxy* fProxy; | 136 SkImageFilter::Proxy* fProxy; |
| 148 | 137 |
| 149 typedef SkRefCnt INHERITED; | 138 typedef SkRefCnt INHERITED; |
| 150 }; | 139 }; |
| 151 | 140 |
| 152 #endif | 141 #endif |
| 153 | 142 |
| OLD | NEW |