| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
| 9 #include "SkGr.h" | 9 #include "SkGr.h" |
| 10 | 10 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 * Once we have made SkImages handle all lazy/deferred/generated content, the Y
UV apis will | 168 * Once we have made SkImages handle all lazy/deferred/generated content, the Y
UV apis will |
| 169 * be gone from SkPixelRef, and we can remove this subclass entirely. | 169 * be gone from SkPixelRef, and we can remove this subclass entirely. |
| 170 */ | 170 */ |
| 171 class PixelRef_GrYUVProvider : public GrYUVProvider { | 171 class PixelRef_GrYUVProvider : public GrYUVProvider { |
| 172 SkPixelRef* fPR; | 172 SkPixelRef* fPR; |
| 173 | 173 |
| 174 public: | 174 public: |
| 175 PixelRef_GrYUVProvider(SkPixelRef* pr) : fPR(pr) {} | 175 PixelRef_GrYUVProvider(SkPixelRef* pr) : fPR(pr) {} |
| 176 | 176 |
| 177 uint32_t onGetID() override { return fPR->getGenerationID(); } | 177 uint32_t onGetID() override { return fPR->getGenerationID(); } |
| 178 bool onGetYUVSizes(SkISize sizes[3]) override { | 178 bool onQueryYUV8(YUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const o
verride { |
| 179 return fPR->getYUV8Planes(sizes, nullptr, nullptr, nullptr); | 179 return fPR->queryYUV8(sizeInfo, colorSpace); |
| 180 } | 180 } |
| 181 bool onGetYUVPlanes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], | 181 bool onGetYUV8Planes(const YUVSizeInfo& sizeInfo, void* planes[3]) override
{ |
| 182 SkYUVColorSpace* space) override { | 182 return fPR->getYUV8Planes(sizeInfo, planes); |
| 183 return fPR->getYUV8Planes(sizes, planes, rowBytes, space); | |
| 184 } | 183 } |
| 185 }; | 184 }; |
| 186 | 185 |
| 187 static GrTexture* create_texture_from_yuv(GrContext* ctx, const SkBitmap& bm, | 186 static GrTexture* create_texture_from_yuv(GrContext* ctx, const SkBitmap& bm, |
| 188 const GrSurfaceDesc& desc) { | 187 const GrSurfaceDesc& desc) { |
| 189 // Subsets are not supported, the whole pixelRef is loaded when using YUV de
coding | 188 // Subsets are not supported, the whole pixelRef is loaded when using YUV de
coding |
| 190 SkPixelRef* pixelRef = bm.pixelRef(); | 189 SkPixelRef* pixelRef = bm.pixelRef(); |
| 191 if ((nullptr == pixelRef) || | 190 if ((nullptr == pixelRef) || |
| 192 (pixelRef->info().width() != bm.info().width()) || | 191 (pixelRef->info().width() != bm.info().width()) || |
| 193 (pixelRef->info().height() != bm.info().height())) { | 192 (pixelRef->info().height() != bm.info().height())) { |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 SkErrorInternals::SetError( kInvalidPaint_SkError, | 633 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 635 "Sorry, I don't understand the filtering
" | 634 "Sorry, I don't understand the filtering
" |
| 636 "mode you asked for. Falling back to " | 635 "mode you asked for. Falling back to " |
| 637 "MIPMaps."); | 636 "MIPMaps."); |
| 638 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 637 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 639 break; | 638 break; |
| 640 | 639 |
| 641 } | 640 } |
| 642 return textureFilterMode; | 641 return textureFilterMode; |
| 643 } | 642 } |
| OLD | NEW |