| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 * Once we have made SkImages handle all lazy/deferred/generated content, the Y
UV apis will | 171 * Once we have made SkImages handle all lazy/deferred/generated content, the Y
UV apis will |
| 172 * be gone from SkPixelRef, and we can remove this subclass entirely. | 172 * be gone from SkPixelRef, and we can remove this subclass entirely. |
| 173 */ | 173 */ |
| 174 class PixelRef_GrYUVProvider : public GrYUVProvider { | 174 class PixelRef_GrYUVProvider : public GrYUVProvider { |
| 175 SkPixelRef* fPR; | 175 SkPixelRef* fPR; |
| 176 | 176 |
| 177 public: | 177 public: |
| 178 PixelRef_GrYUVProvider(SkPixelRef* pr) : fPR(pr) {} | 178 PixelRef_GrYUVProvider(SkPixelRef* pr) : fPR(pr) {} |
| 179 | 179 |
| 180 uint32_t onGetID() override { return fPR->getGenerationID(); } | 180 uint32_t onGetID() override { return fPR->getGenerationID(); } |
| 181 bool onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const
override { | 181 bool onGetYUVSizes(SkISize sizes[3]) override { |
| 182 return fPR->queryYUV8(sizeInfo, colorSpace); | 182 return fPR->getYUV8Planes(sizes, nullptr, nullptr, nullptr); |
| 183 } | 183 } |
| 184 bool onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) overrid
e { | 184 bool onGetYUVPlanes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], |
| 185 return fPR->getYUV8Planes(sizeInfo, planes); | 185 SkYUVColorSpace* space) override { |
| 186 return fPR->getYUV8Planes(sizes, planes, rowBytes, space); |
| 186 } | 187 } |
| 187 }; | 188 }; |
| 188 | 189 |
| 189 static GrTexture* create_texture_from_yuv(GrContext* ctx, const SkBitmap& bm, | 190 static GrTexture* create_texture_from_yuv(GrContext* ctx, const SkBitmap& bm, |
| 190 const GrSurfaceDesc& desc) { | 191 const GrSurfaceDesc& desc) { |
| 191 // Subsets are not supported, the whole pixelRef is loaded when using YUV de
coding | 192 // Subsets are not supported, the whole pixelRef is loaded when using YUV de
coding |
| 192 SkPixelRef* pixelRef = bm.pixelRef(); | 193 SkPixelRef* pixelRef = bm.pixelRef(); |
| 193 if ((nullptr == pixelRef) || | 194 if ((nullptr == pixelRef) || |
| 194 (pixelRef->info().width() != bm.info().width()) || | 195 (pixelRef->info().width() != bm.info().width()) || |
| 195 (pixelRef->info().height() != bm.info().height())) { | 196 (pixelRef->info().height() != bm.info().height())) { |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 SkErrorInternals::SetError( kInvalidPaint_SkError, | 696 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 696 "Sorry, I don't understand the filtering
" | 697 "Sorry, I don't understand the filtering
" |
| 697 "mode you asked for. Falling back to " | 698 "mode you asked for. Falling back to " |
| 698 "MIPMaps."); | 699 "MIPMaps."); |
| 699 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 700 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 700 break; | 701 break; |
| 701 | 702 |
| 702 } | 703 } |
| 703 return textureFilterMode; | 704 return textureFilterMode; |
| 704 } | 705 } |
| OLD | NEW |