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 #include "SkSpecialImage.h" | 7 #include "SkSpecialImage.h" |
8 | 8 |
9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 #include "GrTexture.h" | 10 #include "GrTexture.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 if (GrTexture* peek = as_SIB(this)->peekTexture()) { | 61 if (GrTexture* peek = as_SIB(this)->peekTexture()) { |
62 return peek->getContext() == context ? sk_sp<SkSpecialImage>(SkRef(this)
) : nullptr; | 62 return peek->getContext() == context ? sk_sp<SkSpecialImage>(SkRef(this)
) : nullptr; |
63 } | 63 } |
64 | 64 |
65 SkBitmap bmp; | 65 SkBitmap bmp; |
66 if (!this->internal_getBM(&bmp)) { | 66 if (!this->internal_getBM(&bmp)) { |
67 return nullptr; | 67 return nullptr; |
68 } | 68 } |
69 | 69 |
| 70 if (bmp.empty()) { |
| 71 return SkSpecialImage::MakeFromRaster(proxy, SkIRect::MakeEmpty(), bmp); |
| 72 } |
| 73 |
70 SkAutoTUnref<GrTexture> resultTex( | 74 SkAutoTUnref<GrTexture> resultTex( |
71 GrRefCachedBitmapTexture(context, bmp, GrTextureParams::ClampNoFilter())
); | 75 GrRefCachedBitmapTexture(context, bmp, GrTextureParams::ClampNoFilter())
); |
72 if (!resultTex) { | 76 if (!resultTex) { |
73 return nullptr; | 77 return nullptr; |
74 } | 78 } |
75 | 79 |
76 SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaTyp
e; | 80 SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaTyp
e; |
77 | 81 |
78 return SkSpecialImage::MakeFromGpu(proxy, | 82 return SkSpecialImage::MakeFromGpu(proxy, |
79 SkIRect::MakeWH(resultTex->width(), resul
tTex->height()), | 83 SkIRect::MakeWH(resultTex->width(), resul
tTex->height()), |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 539 |
536 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, | 540 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, |
537 const SkIRect& subset, | 541 const SkIRect& subset, |
538 uint32_t uniqueID, | 542 uint32_t uniqueID, |
539 GrTexture* tex, | 543 GrTexture* tex, |
540 SkAlphaType at) { | 544 SkAlphaType at) { |
541 return nullptr; | 545 return nullptr; |
542 } | 546 } |
543 | 547 |
544 #endif | 548 #endif |
OLD | NEW |