| 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 "GrCaps.h" | 10 #include "GrCaps.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return as_IB(fImage)->getROPixels(bitmap); | 102 return as_IB(fImage)->getROPixels(bitmap); |
| 103 } | 103 } |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 const SkImage* fImage; | 106 const SkImage* fImage; |
| 107 GrTexture* fUnstretched; | 107 GrTexture* fUnstretched; |
| 108 | 108 |
| 109 typedef GrTextureMaker INHERITED; | 109 typedef GrTextureMaker INHERITED; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, SkImageUsageType usage) con
st { | 112 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrTextureParams& para
ms) const { |
| 113 return Texture_GrTextureMaker(this, fTexture).refCachedTexture(ctx, usage); | 113 return Texture_GrTextureMaker(this, fTexture).refCachedTexture(ctx, params); |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool SkImage_Gpu::isOpaque() const { | 116 bool SkImage_Gpu::isOpaque() const { |
| 117 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk
AlphaType; | 117 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk
AlphaType; |
| 118 } | 118 } |
| 119 | 119 |
| 120 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ | 120 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
{ |
| 121 switch (info.colorType()) { | 121 switch (info.colorType()) { |
| 122 case kRGBA_8888_SkColorType: | 122 case kRGBA_8888_SkColorType: |
| 123 case kBGRA_8888_SkColorType: | 123 case kBGRA_8888_SkColorType: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 if (!dst) { | 323 if (!dst) { |
| 324 return nullptr; | 324 return nullptr; |
| 325 } | 325 } |
| 326 | 326 |
| 327 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 327 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
| 328 const SkIPoint dstP = SkIPoint::Make(0, 0); | 328 const SkIPoint dstP = SkIPoint::Make(0, 0); |
| 329 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); | 329 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); |
| 330 return dst; | 330 return dst; |
| 331 } | 331 } |
| 332 | 332 |
| OLD | NEW |