| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 384 |
| 385 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { | 385 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { |
| 386 if (!fTexture->getContext()) { | 386 if (!fTexture->getContext()) { |
| 387 return nullptr; | 387 return nullptr; |
| 388 } | 388 } |
| 389 | 389 |
| 390 GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *fTexture->getCon
text()->caps()); | 390 GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *fTexture->getCon
text()->caps()); |
| 391 | 391 |
| 392 return SkSpecialSurface::MakeRenderTarget(fTexture->getContext(), | 392 return SkSpecialSurface::MakeRenderTarget(fTexture->getContext(), |
| 393 info.width(), info.height(), | 393 info.width(), info.height(), |
| 394 config); | 394 config, sk_ref_sp(info.colorSp
ace())); |
| 395 } | 395 } |
| 396 | 396 |
| 397 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { | 397 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { |
| 398 return SkSpecialImage::MakeFromGpu(subset, | 398 return SkSpecialImage::MakeFromGpu(subset, |
| 399 this->uniqueID(), | 399 this->uniqueID(), |
| 400 fTexture, | 400 fTexture, |
| 401 fColorSpace, | 401 fColorSpace, |
| 402 &this->props(), | 402 &this->props(), |
| 403 fAlphaType); | 403 fAlphaType); |
| 404 } | 404 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 sk_sp<GrTexture> tex, | 446 sk_sp<GrTexture> tex, |
| 447 sk_sp<SkColorSpace> colorSpace
, | 447 sk_sp<SkColorSpace> colorSpace
, |
| 448 const SkSurfaceProps* props, | 448 const SkSurfaceProps* props, |
| 449 SkAlphaType at) { | 449 SkAlphaType at) { |
| 450 SkASSERT(rect_fits(subset, tex->width(), tex->height())); | 450 SkASSERT(rect_fits(subset, tex->width(), tex->height())); |
| 451 return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at, | 451 return sk_make_sp<SkSpecialImage_Gpu>(subset, uniqueID, std::move(tex), at, |
| 452 std::move(colorSpace), props); | 452 std::move(colorSpace), props); |
| 453 } | 453 } |
| 454 | 454 |
| 455 #endif | 455 #endif |
| OLD | NEW |