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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 return sk_make_sp<SkImage_Gpu>(fTexture->width(), fTexture->height()
, | 495 return sk_make_sp<SkImage_Gpu>(fTexture->width(), fTexture->height()
, |
496 kNeedNewImageUniqueID, | 496 kNeedNewImageUniqueID, |
497 fAlphaType, fTexture, SkBudgeted::kYe
s); | 497 fAlphaType, fTexture, SkBudgeted::kYe
s); |
498 } | 498 } |
499 | 499 |
500 GrContext* ctx = fTexture->getContext(); | 500 GrContext* ctx = fTexture->getContext(); |
501 GrSurfaceDesc desc = fTexture->desc(); | 501 GrSurfaceDesc desc = fTexture->desc(); |
502 desc.fWidth = subset.width(); | 502 desc.fWidth = subset.width(); |
503 desc.fHeight = subset.height(); | 503 desc.fHeight = subset.height(); |
504 | 504 |
505 GrTexture* subTx = ctx->textureProvider()->createTexture(desc, SkBudgete
d::kYes); | 505 SkAutoTUnref<GrTexture> subTx(ctx->textureProvider()->createTexture(desc
, |
| 506 SkBu
dgeted::kYes)); |
506 if (!subTx) { | 507 if (!subTx) { |
507 return nullptr; | 508 return nullptr; |
508 } | 509 } |
509 ctx->copySurface(subTx, fTexture, subset, SkIPoint::Make(0, 0)); | 510 ctx->copySurface(subTx, fTexture, subset, SkIPoint::Make(0, 0)); |
510 return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageU
niqueID, | 511 return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageU
niqueID, |
511 fAlphaType, subTx, SkBudgeted::kYes); | 512 fAlphaType, subTx, SkBudgeted::kYes); |
512 } | 513 } |
513 | 514 |
514 SkSurface* onMakeTightSurface(const SkImageInfo& info) const override { | 515 SkSurface* onMakeTightSurface(const SkImageInfo& info) const override { |
515 return SkSurface::NewRenderTarget(fTexture->getContext(), SkBudgeted::kY
es, info); | 516 return SkSurface::NewRenderTarget(fTexture->getContext(), SkBudgeted::kY
es, info); |
(...skipping 19 matching lines...) Expand all Loading... |
535 | 536 |
536 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, | 537 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, |
537 const SkIRect& subset, | 538 const SkIRect& subset, |
538 uint32_t uniqueID, | 539 uint32_t uniqueID, |
539 GrTexture* tex, | 540 GrTexture* tex, |
540 SkAlphaType at) { | 541 SkAlphaType at) { |
541 return nullptr; | 542 return nullptr; |
542 } | 543 } |
543 | 544 |
544 #endif | 545 #endif |
OLD | NEW |