| 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" |
| 11 #include "SkBitmapCache.h" | 11 #include "SkBitmapCache.h" |
| 12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
| 13 #include "SkImage_Base.h" | 13 #include "SkImage_Base.h" |
| 14 #include "SkSpecialSurface.h" | 14 #include "SkSpecialSurface.h" |
| 15 #include "SkSurfacePriv.h" | 15 #include "SkSurfacePriv.h" |
| 16 #include "SkPixelRef.h" | 16 #include "SkPixelRef.h" |
| 17 | 17 |
| 18 #if SK_SUPPORT_GPU | 18 #if SK_SUPPORT_GPU |
| 19 #include "GrContext.h" | 19 #include "GrContext.h" |
| 20 #include "GrTexture.h" | 20 #include "GrTexture.h" |
| 21 #include "GrTextureProxy.h" |
| 21 #include "GrTextureParams.h" | 22 #include "GrTextureParams.h" |
| 22 #include "GrTextureProxy.h" | 23 #include "GrTextureProxy.h" |
| 23 #include "SkGr.h" | 24 #include "SkGr.h" |
| 24 #include "SkGrPriv.h" | 25 #include "SkGrPriv.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 // Currently the raster imagefilters can only handle certain imageinfos. Call th
is to know if | 28 // Currently the raster imagefilters can only handle certain imageinfos. Call th
is to know if |
| 28 // a given info is supported. | 29 // a given info is supported. |
| 29 static bool valid_for_imagefilters(const SkImageInfo& info) { | 30 static bool valid_for_imagefilters(const SkImageInfo& info) { |
| 30 // no support for other swizzles/depths yet | 31 // no support for other swizzles/depths yet |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 uint32_t uniqueID, sk_sp<GrTextureProxy> proxy, SkAlphaTy
pe at, | 369 uint32_t uniqueID, sk_sp<GrTextureProxy> proxy, SkAlphaTy
pe at, |
| 369 sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* pro
ps) | 370 sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* pro
ps) |
| 370 : INHERITED(subset, uniqueID, props) | 371 : INHERITED(subset, uniqueID, props) |
| 371 , fContext(context) | 372 , fContext(context) |
| 372 , fTextureProxy(std::move(proxy)) | 373 , fTextureProxy(std::move(proxy)) |
| 373 , fAlphaType(at) | 374 , fAlphaType(at) |
| 374 , fColorSpace(std::move(colorSpace)) | 375 , fColorSpace(std::move(colorSpace)) |
| 375 , fAddedRasterVersionToCache(false) { | 376 , fAddedRasterVersionToCache(false) { |
| 376 } | 377 } |
| 377 | 378 |
| 379 SkSpecialImage_Gpu(const SkIRect& subset, |
| 380 uint32_t uniqueID, sk_sp<GrTextureProxy> tex, SkAlphaType
at, |
| 381 sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* pro
ps) |
| 382 : INHERITED(subset, uniqueID, props) |
| 383 //, fTexture(std::move(tex)) |
| 384 , fAlphaType(at) |
| 385 , fColorSpace(std::move(colorSpace)) |
| 386 , fAddedRasterVersionToCache(false) { |
| 387 } |
| 388 |
| 378 ~SkSpecialImage_Gpu() override { | 389 ~SkSpecialImage_Gpu() override { |
| 379 if (fAddedRasterVersionToCache.load()) { | 390 if (fAddedRasterVersionToCache.load()) { |
| 380 SkNotifyBitmapGenIDIsStale(this->uniqueID()); | 391 SkNotifyBitmapGenIDIsStale(this->uniqueID()); |
| 381 } | 392 } |
| 382 } | 393 } |
| 383 | 394 |
| 384 SkAlphaType alphaType() const override { return fAlphaType; } | 395 SkAlphaType alphaType() const override { return fAlphaType; } |
| 385 | 396 |
| 386 size_t getSize() const override { return fTextureProxy->gpuMemorySize(); } | 397 size_t getSize() const override { return fTextureProxy->gpuMemorySize(); } |
| 387 | 398 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 uint32_t uniqueID, | 540 uint32_t uniqueID, |
| 530 sk_sp<GrTextureProxy>
proxy, | 541 sk_sp<GrTextureProxy>
proxy, |
| 531 sk_sp<SkColorSpace> co
lorSpace, | 542 sk_sp<SkColorSpace> co
lorSpace, |
| 532 const SkSurfaceProps*
props, | 543 const SkSurfaceProps*
props, |
| 533 SkAlphaType at) { | 544 SkAlphaType at) { |
| 534 SkASSERT(rect_fits(subset, proxy->width(), proxy->height())); | 545 SkASSERT(rect_fits(subset, proxy->width(), proxy->height())); |
| 535 return sk_make_sp<SkSpecialImage_Gpu>(context, subset, uniqueID, std::move(p
roxy), at, | 546 return sk_make_sp<SkSpecialImage_Gpu>(context, subset, uniqueID, std::move(p
roxy), at, |
| 536 std::move(colorSpace), props); | 547 std::move(colorSpace), props); |
| 537 } | 548 } |
| 538 #endif | 549 #endif |
| OLD | NEW |