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 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkImage_Base.h" | 9 #include "SkImage_Base.h" |
10 #include "SkSpecialImage.h" | 10 #include "SkSpecialImage.h" |
11 #include "SkSpecialSurface.h" | 11 #include "SkSpecialSurface.h" |
12 | 12 |
13 /////////////////////////////////////////////////////////////////////////////// | 13 /////////////////////////////////////////////////////////////////////////////// |
14 class SkSpecialImage_Base : public SkSpecialImage { | 14 class SkSpecialImage_Base : public SkSpecialImage { |
15 public: | 15 public: |
16 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint
32_t uniqueID) | 16 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint
32_t uniqueID) |
17 : INHERITED(proxy, subset, uniqueID) { | 17 : INHERITED(proxy, subset, uniqueID) { |
18 } | 18 } |
19 virtual ~SkSpecialImage_Base() { } | 19 virtual ~SkSpecialImage_Base() { } |
20 | 20 |
21 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const
= 0; | 21 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const
= 0; |
22 | 22 |
23 virtual bool testingOnlyOnPeekPixels(SkPixmap*) const { return false; } | 23 virtual bool onPeekPixels(SkPixmap*) const { return false; } |
24 | 24 |
25 virtual GrTexture* onPeekTexture() const { return nullptr; } | 25 virtual GrTexture* onPeekTexture() const { return nullptr; } |
26 | 26 |
27 virtual bool testingOnlyOnGetROPixels(SkBitmap*) const = 0; | 27 virtual bool testingOnlyOnGetROPixels(SkBitmap*) const = 0; |
28 | 28 |
29 // Delete this entry point ASAP (see skbug.com/4965) | 29 // Delete this entry point ASAP (see skbug.com/4965) |
30 virtual bool getBitmapDeprecated(SkBitmap* result) const = 0; | 30 virtual bool getBitmapDeprecated(SkBitmap* result) const = 0; |
31 | 31 |
32 virtual SkSpecialSurface* onNewSurface(const SkImageInfo& info) const { retu
rn nullptr; } | 32 virtual SkSpecialSurface* onNewSurface(const SkImageInfo& info) const = 0; |
| 33 |
| 34 virtual SkSpecialImage* onExtractSubset(const SkIRect& subset) const = 0; |
33 | 35 |
34 private: | 36 private: |
35 typedef SkSpecialImage INHERITED; | 37 typedef SkSpecialImage INHERITED; |
36 }; | 38 }; |
37 | 39 |
38 /////////////////////////////////////////////////////////////////////////////// | 40 /////////////////////////////////////////////////////////////////////////////// |
39 static inline const SkSpecialImage_Base* as_SIB(const SkSpecialImage* image) { | 41 static inline const SkSpecialImage_Base* as_SIB(const SkSpecialImage* image) { |
40 return static_cast<const SkSpecialImage_Base*>(image); | 42 return static_cast<const SkSpecialImage_Base*>(image); |
41 } | 43 } |
42 | 44 |
43 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain
t* paint) const { | 45 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain
t* paint) const { |
44 return as_SIB(this)->onDraw(canvas, x, y, paint); | 46 return as_SIB(this)->onDraw(canvas, x, y, paint); |
45 } | 47 } |
46 | 48 |
47 bool SkSpecialImage::testingOnlyPeekPixels(SkPixmap* pixmap) const { | 49 bool SkSpecialImage::peekPixels(SkPixmap* pixmap) const { |
48 return as_SIB(this)->testingOnlyOnPeekPixels(pixmap); | 50 return as_SIB(this)->onPeekPixels(pixmap); |
49 } | 51 } |
50 | 52 |
51 GrTexture* SkSpecialImage::peekTexture() const { | 53 GrTexture* SkSpecialImage::peekTexture() const { |
52 return as_SIB(this)->onPeekTexture(); | 54 return as_SIB(this)->onPeekTexture(); |
53 } | 55 } |
54 | 56 |
55 bool SkSpecialImage::testingOnlyGetROPixels(SkBitmap* result) const { | 57 bool SkSpecialImage::testingOnlyGetROPixels(SkBitmap* result) const { |
56 return as_SIB(this)->testingOnlyOnGetROPixels(result); | 58 return as_SIB(this)->testingOnlyOnGetROPixels(result); |
57 } | 59 } |
58 | 60 |
59 SkSpecialSurface* SkSpecialImage::newSurface(const SkImageInfo& info) const { | 61 SkSpecialSurface* SkSpecialImage::newSurface(const SkImageInfo& info) const { |
60 return as_SIB(this)->onNewSurface(info); | 62 return as_SIB(this)->onNewSurface(info); |
61 } | 63 } |
62 | 64 |
| 65 SkSpecialImage* SkSpecialImage::extractSubset(const SkIRect& subset) const { |
| 66 return as_SIB(this)->onExtractSubset(subset); |
| 67 } |
| 68 |
63 #if SK_SUPPORT_GPU | 69 #if SK_SUPPORT_GPU |
64 #include "SkGr.h" | 70 #include "SkGr.h" |
65 #include "SkGrPixelRef.h" | 71 #include "SkGrPixelRef.h" |
66 #endif | 72 #endif |
67 | 73 |
68 SkSpecialImage* SkSpecialImage::internal_fromBM(SkImageFilter::Proxy* proxy, | 74 SkSpecialImage* SkSpecialImage::internal_fromBM(SkImageFilter::Proxy* proxy, |
69 const SkBitmap& src) { | 75 const SkBitmap& src) { |
70 // Need to test offset case! (see skbug.com/4967) | 76 // Need to test offset case! (see skbug.com/4967) |
71 if (src.getTexture()) { | 77 if (src.getTexture()) { |
72 return SkSpecialImage::NewFromGpu(proxy, | 78 return SkSpecialImage::NewFromGpu(proxy, |
73 src.bounds(), | 79 src.bounds(), |
74 src.getGenerationID(), | 80 src.getGenerationID(), |
75 src.getTexture()); | 81 src.getTexture()); |
76 } | 82 } |
77 | 83 |
78 return SkSpecialImage::NewFromRaster(proxy, src.bounds(), src); | 84 return SkSpecialImage::NewFromRaster(proxy, src.bounds(), src); |
79 } | 85 } |
80 | 86 |
81 bool SkSpecialImage::internal_getBM(SkBitmap* result) { | 87 bool SkSpecialImage::internal_getBM(SkBitmap* result) { |
82 const SkSpecialImage_Base* ib = as_SIB(this); | 88 const SkSpecialImage_Base* ib = as_SIB(this); |
83 | 89 |
84 // TODO: need to test offset case! (see skbug.com/4967) | 90 // TODO: need to test offset case! (see skbug.com/4967) |
85 return ib->getBitmapDeprecated(result); | 91 return ib->getBitmapDeprecated(result); |
86 } | 92 } |
87 | 93 |
88 SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() { | 94 SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() const { |
89 SkASSERT(fProxy); | |
90 return fProxy; | 95 return fProxy; |
91 } | 96 } |
92 | 97 |
93 /////////////////////////////////////////////////////////////////////////////// | 98 /////////////////////////////////////////////////////////////////////////////// |
94 #include "SkImage.h" | 99 #include "SkImage.h" |
95 #if SK_SUPPORT_GPU | 100 #if SK_SUPPORT_GPU |
96 #include "SkGrPriv.h" | 101 #include "SkGrPriv.h" |
97 #endif | 102 #endif |
98 | 103 |
99 class SkSpecialImage_Image : public SkSpecialImage_Base { | 104 class SkSpecialImage_Image : public SkSpecialImage_Base { |
(...skipping 22 matching lines...) Expand all Loading... |
122 return 0; | 127 return 0; |
123 } | 128 } |
124 | 129 |
125 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { | 130 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { |
126 SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset
().height()); | 131 SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset
().height()); |
127 | 132 |
128 canvas->drawImageRect(fImage, this->subset(), | 133 canvas->drawImageRect(fImage, this->subset(), |
129 dst, paint, SkCanvas::kStrict_SrcRectConstraint); | 134 dst, paint, SkCanvas::kStrict_SrcRectConstraint); |
130 } | 135 } |
131 | 136 |
132 bool testingOnlyOnPeekPixels(SkPixmap* pixmap) const override { | 137 bool onPeekPixels(SkPixmap* pixmap) const override { |
133 return fImage->peekPixels(pixmap); | 138 return fImage->peekPixels(pixmap); |
134 } | 139 } |
135 | 140 |
136 GrTexture* onPeekTexture() const override { return as_IB(fImage.get())->peek
Texture(); } | 141 GrTexture* onPeekTexture() const override { return as_IB(fImage.get())->peek
Texture(); } |
137 | 142 |
138 bool getBitmapDeprecated(SkBitmap* result) const override { | 143 bool getBitmapDeprecated(SkBitmap* result) const override { |
139 #if SK_SUPPORT_GPU | 144 #if SK_SUPPORT_GPU |
140 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) { | 145 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) { |
141 const SkImageInfo info = GrMakeInfoFromTexture(texture, | 146 const SkImageInfo info = GrMakeInfoFromTexture(texture, |
142 fImage->width(), fIma
ge->height(), | 147 fImage->width(), fIma
ge->height(), |
(...skipping 20 matching lines...) Expand all Loading... |
163 if (texture) { | 168 if (texture) { |
164 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); | 169 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); |
165 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 170 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
166 | 171 |
167 return SkSpecialSurface::NewRenderTarget(this->proxy(), texture->get
Context(), desc); | 172 return SkSpecialSurface::NewRenderTarget(this->proxy(), texture->get
Context(), desc); |
168 } | 173 } |
169 #endif | 174 #endif |
170 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); | 175 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); |
171 } | 176 } |
172 | 177 |
| 178 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override { |
| 179 SkAutoTUnref<SkImage> subsetImg(fImage->newSubset(subset)); |
| 180 if (!subsetImg) { |
| 181 return nullptr; |
| 182 } |
| 183 |
| 184 return SkSpecialImage::NewFromImage(this->internal_getProxy(), |
| 185 SkIRect::MakeWH(subset.width(), subs
et.height()), |
| 186 subsetImg); |
| 187 } |
| 188 |
173 private: | 189 private: |
174 SkAutoTUnref<const SkImage> fImage; | 190 SkAutoTUnref<const SkImage> fImage; |
175 | 191 |
176 typedef SkSpecialImage_Base INHERITED; | 192 typedef SkSpecialImage_Base INHERITED; |
177 }; | 193 }; |
178 | 194 |
179 #ifdef SK_DEBUG | 195 #ifdef SK_DEBUG |
180 static bool rect_fits(const SkIRect& rect, int width, int height) { | 196 static bool rect_fits(const SkIRect& rect, int width, int height) { |
181 if (0 == width && 0 == height) { | 197 if (0 == width && 0 == height) { |
182 SkASSERT(0 == rect.fLeft && 0 == rect.fRight && 0 == rect.fTop && 0 == r
ect.fBottom); | 198 SkASSERT(0 == rect.fLeft && 0 == rect.fRight && 0 == rect.fTop && 0 == r
ect.fBottom); |
(...skipping 24 matching lines...) Expand all Loading... |
207 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, const SkIRect& subset, co
nst SkBitmap& bm) | 223 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, const SkIRect& subset, co
nst SkBitmap& bm) |
208 : INHERITED(proxy, subset, bm.getGenerationID()) | 224 : INHERITED(proxy, subset, bm.getGenerationID()) |
209 , fBitmap(bm) { | 225 , fBitmap(bm) { |
210 if (bm.pixelRef() && bm.pixelRef()->isPreLocked()) { | 226 if (bm.pixelRef() && bm.pixelRef()->isPreLocked()) { |
211 // we only preemptively lock if there is no chance of triggering som
ething expensive | 227 // we only preemptively lock if there is no chance of triggering som
ething expensive |
212 // like a lazy decode or imagegenerator. PreLocked means it is flat
pixels already. | 228 // like a lazy decode or imagegenerator. PreLocked means it is flat
pixels already. |
213 fBitmap.lockPixels(); | 229 fBitmap.lockPixels(); |
214 } | 230 } |
215 } | 231 } |
216 | 232 |
| 233 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, |
| 234 const SkIRect& subset, |
| 235 const SkPixmap& pixmap, |
| 236 void (*releaseProc)(void* addr, void* context), |
| 237 void* context) |
| 238 : INHERITED(proxy, subset, kNeedNewImageUniqueID_SpecialImage) { |
| 239 fBitmap.installPixels(pixmap.info(), pixmap.writable_addr(), |
| 240 pixmap.rowBytes(), pixmap.ctable(), |
| 241 releaseProc, context); |
| 242 } |
| 243 |
217 ~SkSpecialImage_Raster() override { } | 244 ~SkSpecialImage_Raster() override { } |
218 | 245 |
219 bool isOpaque() const override { return fBitmap.isOpaque(); } | 246 bool isOpaque() const override { return fBitmap.isOpaque(); } |
220 | 247 |
221 size_t getSize() const override { return fBitmap.getSize(); } | 248 size_t getSize() const override { return fBitmap.getSize(); } |
222 | 249 |
223 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { | 250 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { |
224 SkRect dst = SkRect::MakeXYWH(x, y, | 251 SkRect dst = SkRect::MakeXYWH(x, y, |
225 this->subset().width(), this->subset().hei
ght()); | 252 this->subset().width(), this->subset().hei
ght()); |
226 | 253 |
227 canvas->drawBitmapRect(fBitmap, this->subset(), | 254 canvas->drawBitmapRect(fBitmap, this->subset(), |
228 dst, paint, SkCanvas::kStrict_SrcRectConstraint); | 255 dst, paint, SkCanvas::kStrict_SrcRectConstraint); |
229 } | 256 } |
230 | 257 |
231 bool testingOnlyOnPeekPixels(SkPixmap* pixmap) const override { | 258 bool onPeekPixels(SkPixmap* pixmap) const override { |
232 const SkImageInfo info = fBitmap.info(); | 259 const SkImageInfo info = fBitmap.info(); |
233 if ((kUnknown_SkColorType == info.colorType()) || !fBitmap.getPixels())
{ | 260 if ((kUnknown_SkColorType == info.colorType()) || !fBitmap.getPixels())
{ |
234 return false; | 261 return false; |
235 } | 262 } |
236 const void* pixels = fBitmap.getPixels(); | 263 |
237 if (pixels) { | 264 return fBitmap.peekPixels(pixmap); |
238 if (pixmap) { | |
239 pixmap->reset(info, pixels, fBitmap.rowBytes()); | |
240 } | |
241 return true; | |
242 } | |
243 return false; | |
244 } | 265 } |
245 | 266 |
246 bool getBitmapDeprecated(SkBitmap* result) const override { | 267 bool getBitmapDeprecated(SkBitmap* result) const override { |
247 *result = fBitmap; | 268 *result = fBitmap; |
248 return true; | 269 return true; |
249 } | 270 } |
250 | 271 |
251 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { | 272 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { |
252 *result = fBitmap; | 273 *result = fBitmap; |
253 return true; | 274 return true; |
254 } | 275 } |
255 | 276 |
256 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { | 277 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { |
257 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); | 278 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); |
258 } | 279 } |
259 | 280 |
| 281 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override { |
| 282 SkBitmap subsetBM; |
| 283 |
| 284 if (!fBitmap.extractSubset(&subsetBM, subset)) { |
| 285 return nullptr; |
| 286 } |
| 287 |
| 288 return SkSpecialImage::NewFromRaster(this->internal_getProxy(), |
| 289 SkIRect::MakeWH(subset.width(), sub
set.height()), |
| 290 subsetBM); |
| 291 } |
| 292 |
260 private: | 293 private: |
261 SkBitmap fBitmap; | 294 SkBitmap fBitmap; |
262 | 295 |
263 typedef SkSpecialImage_Base INHERITED; | 296 typedef SkSpecialImage_Base INHERITED; |
264 }; | 297 }; |
265 | 298 |
266 SkSpecialImage* SkSpecialImage::NewFromRaster(SkImageFilter::Proxy* proxy, | 299 SkSpecialImage* SkSpecialImage::NewFromRaster(SkImageFilter::Proxy* proxy, |
267 const SkIRect& subset, | 300 const SkIRect& subset, |
268 const SkBitmap& bm) { | 301 const SkBitmap& bm) { |
269 SkASSERT(nullptr == bm.getTexture()); | 302 SkASSERT(nullptr == bm.getTexture()); |
270 SkASSERT(rect_fits(subset, bm.width(), bm.height())); | 303 SkASSERT(rect_fits(subset, bm.width(), bm.height())); |
271 return new SkSpecialImage_Raster(proxy, subset, bm); | 304 return new SkSpecialImage_Raster(proxy, subset, bm); |
272 } | 305 } |
273 | 306 |
| 307 SkSpecialImage* SkSpecialImage::NewFromPixmap(SkImageFilter::Proxy* proxy, |
| 308 const SkIRect& subset, |
| 309 const SkPixmap& src, |
| 310 void (*releaseProc)(void* addr, vo
id* context), |
| 311 void* context) { |
| 312 return new SkSpecialImage_Raster(proxy, subset, src, releaseProc, context); |
| 313 } |
| 314 |
| 315 |
274 #if SK_SUPPORT_GPU | 316 #if SK_SUPPORT_GPU |
275 /////////////////////////////////////////////////////////////////////////////// | 317 /////////////////////////////////////////////////////////////////////////////// |
276 #include "GrTexture.h" | 318 #include "GrTexture.h" |
277 | 319 |
278 class SkSpecialImage_Gpu : public SkSpecialImage_Base { | 320 class SkSpecialImage_Gpu : public SkSpecialImage_Base { |
279 public: | 321 public: |
280 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, | 322 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, |
281 uint32_t uniqueID, GrTexture* tex, SkAlphaType at) | 323 uint32_t uniqueID, GrTexture* tex, SkAlphaType at) |
282 : INHERITED(proxy, subset, uniqueID) | 324 : INHERITED(proxy, subset, uniqueID) |
283 , fTexture(SkRef(tex)) | 325 , fTexture(SkRef(tex)) |
(...skipping 24 matching lines...) Expand all Loading... |
308 GrTexture* onPeekTexture() const override { return fTexture; } | 350 GrTexture* onPeekTexture() const override { return fTexture; } |
309 | 351 |
310 bool getBitmapDeprecated(SkBitmap* result) const override { | 352 bool getBitmapDeprecated(SkBitmap* result) const override { |
311 const SkImageInfo info = GrMakeInfoFromTexture(fTexture, | 353 const SkImageInfo info = GrMakeInfoFromTexture(fTexture, |
312 this->width(), this->heig
ht(), | 354 this->width(), this->heig
ht(), |
313 this->isOpaque()); | 355 this->isOpaque()); |
314 if (!result->setInfo(info)) { | 356 if (!result->setInfo(info)) { |
315 return false; | 357 return false; |
316 } | 358 } |
317 | 359 |
318 result->setPixelRef(new SkGrPixelRef(info, fTexture))->unref(); | 360 const SkImageInfo prInfo = info.makeWH(fTexture->width(), fTexture->heig
ht()); |
| 361 |
| 362 SkAutoTUnref<SkGrPixelRef> pixelRef(new SkGrPixelRef(prInfo, fTexture)); |
| 363 result->setPixelRef(pixelRef, this->subset().fLeft, this->subset().fTop)
; |
319 return true; | 364 return true; |
320 } | 365 } |
321 | 366 |
322 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { | 367 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { |
323 | 368 |
324 const SkImageInfo info = SkImageInfo::MakeN32(this->width(), | 369 const SkImageInfo info = SkImageInfo::MakeN32(this->width(), |
325 this->height(), | 370 this->height(), |
326 this->isOpaque() ? kOpaque
_SkAlphaType | 371 this->isOpaque() ? kOpaque
_SkAlphaType |
327 : kPremul
_SkAlphaType); | 372 : kPremul
_SkAlphaType); |
328 if (!result->tryAllocPixels(info)) { | 373 if (!result->tryAllocPixels(info)) { |
329 return false; | 374 return false; |
330 } | 375 } |
331 | 376 |
332 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia
8888_GrPixelConfig, | 377 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia
8888_GrPixelConfig, |
333 result->getPixels(), result->rowBytes())) { | 378 result->getPixels(), result->rowBytes())) { |
334 return false; | 379 return false; |
335 } | 380 } |
336 | 381 |
337 result->pixelRef()->setImmutable(); | 382 result->pixelRef()->setImmutable(); |
338 return true; | 383 return true; |
339 } | 384 } |
340 | 385 |
341 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { | 386 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { |
342 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); | 387 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); |
343 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 388 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
344 | 389 |
345 return SkSpecialSurface::NewRenderTarget(this->proxy(), fTexture->getCon
text(), desc); | 390 return SkSpecialSurface::NewRenderTarget(this->proxy(), fTexture->getCon
text(), desc); |
346 } | 391 } |
347 | 392 |
| 393 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override { |
| 394 return SkSpecialImage::NewFromGpu(this->internal_getProxy(), |
| 395 subset, |
| 396 this->uniqueID(), |
| 397 fTexture, |
| 398 fAlphaType); |
| 399 } |
| 400 |
348 private: | 401 private: |
349 SkAutoTUnref<GrTexture> fTexture; | 402 SkAutoTUnref<GrTexture> fTexture; |
350 const SkAlphaType fAlphaType; | 403 const SkAlphaType fAlphaType; |
351 | 404 |
352 typedef SkSpecialImage_Base INHERITED; | 405 typedef SkSpecialImage_Base INHERITED; |
353 }; | 406 }; |
354 | 407 |
355 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, | 408 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, |
356 const SkIRect& subset, | 409 const SkIRect& subset, |
357 uint32_t uniqueID, | 410 uint32_t uniqueID, |
358 GrTexture* tex, | 411 GrTexture* tex, |
359 SkAlphaType at) { | 412 SkAlphaType at) { |
360 SkASSERT(rect_fits(subset, tex->width(), tex->height())); | 413 SkASSERT(rect_fits(subset, tex->width(), tex->height())); |
361 return new SkSpecialImage_Gpu(proxy, subset, uniqueID, tex, at); | 414 return new SkSpecialImage_Gpu(proxy, subset, uniqueID, tex, at); |
362 } | 415 } |
363 | 416 |
364 #else | 417 #else |
365 | 418 |
366 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, | 419 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, |
367 const SkIRect& subset, | 420 const SkIRect& subset, |
368 uint32_t uniqueID, | 421 uint32_t uniqueID, |
369 GrTexture* tex, | 422 GrTexture* tex, |
370 SkAlphaType at) { | 423 SkAlphaType at) { |
371 return nullptr; | 424 return nullptr; |
372 } | 425 } |
373 | 426 |
374 #endif | 427 #endif |
OLD | NEW |