| 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 "SkSpecialImage.h" | 8 #include "SkSpecialImage.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkImage.h" | 10 #include "SkImage.h" |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 408 |
| 409 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { | 409 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { |
| 410 if (!fTexture->getContext()) { | 410 if (!fTexture->getContext()) { |
| 411 return nullptr; | 411 return nullptr; |
| 412 } | 412 } |
| 413 | 413 |
| 414 GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *fTexture->getCon
text()->caps()); | 414 GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *fTexture->getCon
text()->caps()); |
| 415 | 415 |
| 416 return SkSpecialSurface::MakeRenderTarget(fTexture->getContext(), | 416 return SkSpecialSurface::MakeRenderTarget(fTexture->getContext(), |
| 417 info.width(), info.height(), | 417 info.width(), info.height(), |
| 418 config); | 418 config, sk_ref_sp(info.colorSp
ace())); |
| 419 } | 419 } |
| 420 | 420 |
| 421 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { | 421 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { |
| 422 return SkSpecialImage::MakeFromGpu(subset, | 422 return SkSpecialImage::MakeFromGpu(subset, |
| 423 this->uniqueID(), | 423 this->uniqueID(), |
| 424 fTexture, | 424 fTexture, |
| 425 fColorSpace, | 425 fColorSpace, |
| 426 &this->props(), | 426 &this->props(), |
| 427 fAlphaType); | 427 fAlphaType); |
| 428 } | 428 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 sk_sp<GrTexture> tex, | 470 sk_sp<GrTexture> tex, |
| 471 sk_sp<SkColorSpace> colorSpace
, | 471 sk_sp<SkColorSpace> colorSpace
, |
| 472 const SkSurfaceProps* props, | 472 const SkSurfaceProps* props, |
| 473 SkAlphaType at) { | 473 SkAlphaType at) { |
| 474 SkASSERT(rect_fits(subset, tex->width(), tex->height())); | 474 SkASSERT(rect_fits(subset, tex->width(), tex->height())); |
| 475 return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at, | 475 return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at, |
| 476 std::move(colorSpace), props); | 476 std::move(colorSpace), props); |
| 477 } | 477 } |
| 478 | 478 |
| 479 #endif | 479 #endif |
| OLD | NEW |