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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia
8888_GrPixelConfig, | 474 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia
8888_GrPixelConfig, |
475 result->getPixels(), result->rowBytes())) { | 475 result->getPixels(), result->rowBytes())) { |
476 return false; | 476 return false; |
477 } | 477 } |
478 | 478 |
479 result->pixelRef()->setImmutable(); | 479 result->pixelRef()->setImmutable(); |
480 return true; | 480 return true; |
481 } | 481 } |
482 | 482 |
483 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { | 483 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { |
| 484 if (!fTexture->getContext()) { |
| 485 return nullptr; |
| 486 } |
| 487 |
484 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *fTexture->getContex
t()->caps()); | 488 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *fTexture->getContex
t()->caps()); |
485 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 489 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
486 | 490 |
487 return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getCo
ntext(), desc); | 491 return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getCo
ntext(), desc); |
488 } | 492 } |
489 | 493 |
490 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { | 494 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { |
491 return SkSpecialImage::MakeFromGpu(this->internal_getProxy(), | 495 return SkSpecialImage::MakeFromGpu(this->internal_getProxy(), |
492 subset, | 496 subset, |
493 this->uniqueID(), | 497 this->uniqueID(), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 548 |
545 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, | 549 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, |
546 const SkIRect& subset, | 550 const SkIRect& subset, |
547 uint32_t uniqueID, | 551 uint32_t uniqueID, |
548 GrTexture* tex, | 552 GrTexture* tex, |
549 SkAlphaType at) { | 553 SkAlphaType at) { |
550 return nullptr; | 554 return nullptr; |
551 } | 555 } |
552 | 556 |
553 #endif | 557 #endif |
OLD | NEW |