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 onGetYUVSizes(SkISize sizes[3]) override { | 181 bool onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const
override { |
182 return fPR->getYUV8Planes(sizes, nullptr, nullptr, nullptr); | 182 return fPR->queryYUV8(sizeInfo, colorSpace); |
183 } | 183 } |
184 bool onGetYUVPlanes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], | 184 bool onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) overrid
e { |
185 SkYUVColorSpace* space) override { | 185 return fPR->getYUV8Planes(sizeInfo, planes); |
186 return fPR->getYUV8Planes(sizes, planes, rowBytes, space); | |
187 } | 186 } |
188 }; | 187 }; |
189 | 188 |
190 static GrTexture* create_texture_from_yuv(GrContext* ctx, const SkBitmap& bm, | 189 static GrTexture* create_texture_from_yuv(GrContext* ctx, const SkBitmap& bm, |
191 const GrSurfaceDesc& desc) { | 190 const GrSurfaceDesc& desc) { |
192 // Subsets are not supported, the whole pixelRef is loaded when using YUV de
coding | 191 // Subsets are not supported, the whole pixelRef is loaded when using YUV de
coding |
193 SkPixelRef* pixelRef = bm.pixelRef(); | 192 SkPixelRef* pixelRef = bm.pixelRef(); |
194 if ((nullptr == pixelRef) || | 193 if ((nullptr == pixelRef) || |
195 (pixelRef->info().width() != bm.info().width()) || | 194 (pixelRef->info().width() != bm.info().width()) || |
196 (pixelRef->info().height() != bm.info().height())) { | 195 (pixelRef->info().height() != bm.info().height())) { |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 SkErrorInternals::SetError( kInvalidPaint_SkError, | 695 SkErrorInternals::SetError( kInvalidPaint_SkError, |
697 "Sorry, I don't understand the filtering
" | 696 "Sorry, I don't understand the filtering
" |
698 "mode you asked for. Falling back to " | 697 "mode you asked for. Falling back to " |
699 "MIPMaps."); | 698 "MIPMaps."); |
700 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 699 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
701 break; | 700 break; |
702 | 701 |
703 } | 702 } |
704 return textureFilterMode; | 703 return textureFilterMode; |
705 } | 704 } |
OLD | NEW |