| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBitmapCache.h" | 8 #include "SkBitmapCache.h" |
| 9 #include "SkImage_Gpu.h" | 9 #include "SkImage_Gpu.h" |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 dst->getPixels(), dst->rowBytes())) { | 72 dst->getPixels(), dst->rowBytes())) { |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 dst->pixelRef()->setImmutableWithID(this->uniqueID()); | 76 dst->pixelRef()->setImmutableWithID(this->uniqueID()); |
| 77 SkBitmapCache::Add(this->uniqueID(), *dst); | 77 SkBitmapCache::Add(this->uniqueID(), *dst); |
| 78 fAddedRasterVersionToCache.store(true); | 78 fAddedRasterVersionToCache.store(true); |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, SkImageUsageType usage) con
st { |
| 83 fTexture->ref(); |
| 84 return fTexture; |
| 85 } |
| 86 |
| 82 bool SkImage_Gpu::isOpaque() const { | 87 bool SkImage_Gpu::isOpaque() const { |
| 83 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk
AlphaType; | 88 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk
AlphaType; |
| 84 } | 89 } |
| 85 | 90 |
| 86 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ | 91 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ |
| 87 switch (info.colorType()) { | 92 switch (info.colorType()) { |
| 88 case kRGBA_8888_SkColorType: | 93 case kRGBA_8888_SkColorType: |
| 89 case kBGRA_8888_SkColorType: | 94 case kBGRA_8888_SkColorType: |
| 90 break; | 95 break; |
| 91 default: | 96 default: |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 if (!dst) { | 280 if (!dst) { |
| 276 return nullptr; | 281 return nullptr; |
| 277 } | 282 } |
| 278 | 283 |
| 279 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 284 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
| 280 const SkIPoint dstP = SkIPoint::Make(0, 0); | 285 const SkIPoint dstP = SkIPoint::Make(0, 0); |
| 281 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); | 286 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); |
| 282 return dst; | 287 return dst; |
| 283 } | 288 } |
| 284 | 289 |
| OLD | NEW |