| 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" |
| 18 |
| 19 class GrContext; |
| 17 class GrTexture; | 20 class GrTexture; |
| 18 class SkBitmap; | 21 class SkBitmap; |
| 19 class SkCanvas; | 22 class SkCanvas; |
| 20 class SkImage; | 23 class SkImage; |
| 21 struct SkImageInfo; | 24 struct SkImageInfo; |
| 22 class SkPaint; | 25 class SkPaint; |
| 26 class SkPixmap; |
| 23 class SkSpecialSurface; | 27 class SkSpecialSurface; |
| 24 | 28 |
| 25 enum { | 29 enum { |
| 26 kNeedNewImageUniqueID_SpecialImage = 0 | 30 kNeedNewImageUniqueID_SpecialImage = 0 |
| 27 }; | 31 }; |
| 28 | 32 |
| 29 /** | 33 /** |
| 30 * This is a restricted form of SkImage solely intended for internal use. It | 34 * This is a restricted form of SkImage solely intended for internal use. It |
| 31 * differs from SkImage in that: | 35 * differs from SkImage in that: |
| 32 * - it can only be backed by raster or gpu (no generators) | 36 * - it can only be backed by raster or gpu (no generators) |
| 33 * - it can be backed by a GrTexture larger than its nominal bounds | 37 * - it can be backed by a GrTexture larger than its nominal bounds |
| 34 * - it can't be drawn tiled | 38 * - it can't be drawn tiled |
| 35 * - it can't be drawn with MIPMAPs | 39 * - it can't be drawn with MIPMAPs |
| 36 * It is similar to SkImage in that it abstracts how the pixels are stored/repre
sented. | 40 * It is similar to SkImage in that it abstracts how the pixels are stored/repre
sented. |
| 37 * | 41 * |
| 38 * Note: the contents of the backing storage outside of the subset rect are unde
fined. | 42 * Note: the contents of the backing storage outside of the subset rect are unde
fined. |
| 39 */ | 43 */ |
| 40 class SkSpecialImage : public SkRefCnt { | 44 class SkSpecialImage : public SkRefCnt { |
| 41 public: | 45 public: |
| 42 int width() const { return fSubset.width(); } | 46 int width() const { return fSubset.width(); } |
| 43 int height() const { return fSubset.height(); } | 47 int height() const { return fSubset.height(); } |
| 44 const SkIRect& subset() const { return fSubset; } | 48 const SkIRect& subset() const { return fSubset; } |
| 45 | 49 |
| 46 uint32_t uniqueID() const { return fUniqueID; } | 50 uint32_t uniqueID() const { return fUniqueID; } |
| 47 virtual bool isOpaque() const { return false; } | 51 virtual bool isOpaque() const { return false; } |
| 48 virtual size_t getSize() const = 0; | 52 virtual size_t getSize() const = 0; |
| 49 | 53 |
| 50 /** | 54 /** |
| 55 * Ensures that a special image is backed by a texture (when GrContext is n
on-null). If no |
| 56 * transformation is required, the returned image may be the same as this s
pecial image. |
| 57 * If the this special image is from a different GrContext, this will fail. |
| 58 */ |
| 59 SkSpecialImage* makeTextureImage(SkImageFilter::Proxy*, GrContext*); |
| 60 |
| 61 /** |
| 51 * Draw this SpecialImage into the canvas. | 62 * Draw this SpecialImage into the canvas. |
| 52 */ | 63 */ |
| 53 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; | 64 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; |
| 54 | 65 |
| 55 static SkSpecialImage* NewFromImage(SkImageFilter::Proxy*, | 66 static SkSpecialImage* NewFromImage(SkImageFilter::Proxy*, |
| 56 const SkIRect& subset, | 67 const SkIRect& subset, |
| 57 const SkImage*); | 68 const SkImage*); |
| 58 static SkSpecialImage* NewFromRaster(SkImageFilter::Proxy*, | 69 static SkSpecialImage* NewFromRaster(SkImageFilter::Proxy*, |
| 59 const SkIRect& subset, | 70 const SkIRect& subset, |
| 60 const SkBitmap&); | 71 const SkBitmap&); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const uint32_t fUniqueID; | 141 const uint32_t fUniqueID; |
| 131 | 142 |
| 132 // TODO: remove this ASAP (see skbug.com/4965) | 143 // TODO: remove this ASAP (see skbug.com/4965) |
| 133 SkImageFilter::Proxy* fProxy; | 144 SkImageFilter::Proxy* fProxy; |
| 134 | 145 |
| 135 typedef SkRefCnt INHERITED; | 146 typedef SkRefCnt INHERITED; |
| 136 }; | 147 }; |
| 137 | 148 |
| 138 #endif | 149 #endif |
| 139 | 150 |
| OLD | NEW |