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 #include "SkGr.h" | 8 #include "SkGr.h" |
9 | 9 |
10 #include "GrDrawTargetCaps.h" | 10 #include "GrDrawTargetCaps.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 (pixelRef->info().width() != bm.info().width()) || | 228 (pixelRef->info().width() != bm.info().width()) || |
229 (pixelRef->info().height() != bm.info().height())) { | 229 (pixelRef->info().height() != bm.info().height())) { |
230 return NULL; | 230 return NULL; |
231 } | 231 } |
232 | 232 |
233 SkYUVPlanesCache::Info yuvInfo; | 233 SkYUVPlanesCache::Info yuvInfo; |
234 SkAutoTUnref<SkCachedData> cachedData( | 234 SkAutoTUnref<SkCachedData> cachedData( |
235 SkYUVPlanesCache::FindAndRef(pixelRef->getGenerationID(), &yuvInfo)); | 235 SkYUVPlanesCache::FindAndRef(pixelRef->getGenerationID(), &yuvInfo)); |
236 | 236 |
237 void* planes[3]; | 237 void* planes[3]; |
238 if (cachedData->data()) { | 238 if (cachedData && cachedData->data()) { |
239 planes[0] = (void*)cachedData->data(); | 239 planes[0] = (void*)cachedData->data(); |
240 planes[1] = (uint8_t*)planes[0] + yuvInfo.fSizeInMemory[0]; | 240 planes[1] = (uint8_t*)planes[0] + yuvInfo.fSizeInMemory[0]; |
241 planes[2] = (uint8_t*)planes[1] + yuvInfo.fSizeInMemory[1]; | 241 planes[2] = (uint8_t*)planes[1] + yuvInfo.fSizeInMemory[1]; |
242 } else { | 242 } else { |
243 // Fetch yuv plane sizes for memory allocation. Here, width and height c
an be | 243 // Fetch yuv plane sizes for memory allocation. Here, width and height c
an be |
244 // rounded up to JPEG block size and be larger than the image's width an
d height. | 244 // rounded up to JPEG block size and be larger than the image's width an
d height. |
245 if (!pixelRef->getYUV8Planes(yuvInfo.fSize, NULL, NULL, NULL)) { | 245 if (!pixelRef->getYUV8Planes(yuvInfo.fSize, NULL, NULL, NULL)) { |
246 return NULL; | 246 return NULL; |
247 } | 247 } |
248 | 248 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { | 597 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { |
598 grPaint->addColorProcessor(fp)->unref(); | 598 grPaint->addColorProcessor(fp)->unref(); |
599 constantColor = false; | 599 constantColor = false; |
600 } | 600 } |
601 } | 601 } |
602 | 602 |
603 // The grcolor is automatically set when calling asFragmentProcessor. | 603 // The grcolor is automatically set when calling asFragmentProcessor. |
604 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 604 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
605 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); | 605 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); |
606 } | 606 } |
OLD | NEW |