| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright 2014 Google Inc. |    2  * Copyright 2014 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 "GrContext.h" |    8 #include "GrContext.h" | 
|    9 #include "GrLayerCache.h" |    9 #include "GrLayerCache.h" | 
|   10 #include "GrLayerHoister.h" |   10 #include "GrLayerHoister.h" | 
|   11 #include "GrRecordReplaceDraw.h" |   11 #include "GrRecordReplaceDraw.h" | 
|   12  |   12  | 
|   13 #include "SkBigPicture.h" |   13 #include "SkBigPicture.h" | 
|   14 #include "SkCanvas.h" |   14 #include "SkCanvas.h" | 
 |   15 #include "SkImageFilterCache.h" | 
|   15 #include "SkLayerInfo.h" |   16 #include "SkLayerInfo.h" | 
|   16 #include "SkRecordDraw.h" |   17 #include "SkRecordDraw.h" | 
|   17 #include "SkSpecialImage.h" |   18 #include "SkSpecialImage.h" | 
|   18 #include "SkSurface.h" |   19 #include "SkSurface.h" | 
|   19  |   20  | 
|   20 // Create the layer information for the hoisted layer and secure the |   21 // Create the layer information for the hoisted layer and secure the | 
|   21 // required texture/render target resources. |   22 // required texture/render target resources. | 
|   22 static void prepare_for_hoisting(GrLayerCache* layerCache, |   23 static void prepare_for_hoisting(GrLayerCache* layerCache, | 
|   23                                  const SkPicture* topLevelPicture, |   24                                  const SkPicture* topLevelPicture, | 
|   24                                  const SkMatrix& initialMat, |   25                                  const SkMatrix& initialMat, | 
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  289  |  290  | 
|  290     SkMatrix totMat(info.fPreMat); |  291     SkMatrix totMat(info.fPreMat); | 
|  291     totMat.preConcat(info.fLocalMat); |  292     totMat.preConcat(info.fLocalMat); | 
|  292     totMat.postTranslate(-SkIntToScalar(filterOffset.fX), -SkIntToScalar(filterO
     ffset.fY)); |  293     totMat.postTranslate(-SkIntToScalar(filterOffset.fX), -SkIntToScalar(filterO
     ffset.fY)); | 
|  293  |  294  | 
|  294     SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop); |  295     SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop); | 
|  295     const SkIRect& clipBounds = layer->rect(); |  296     const SkIRect& clipBounds = layer->rect(); | 
|  296  |  297  | 
|  297     // This cache is transient, and is freed (along with all its contained |  298     // This cache is transient, and is freed (along with all its contained | 
|  298     // textures) when it goes out of scope. |  299     // textures) when it goes out of scope. | 
|  299     SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau
     ltCacheSize)); |  300     SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kDefaultCa
     cheSize)); | 
|  300     SkImageFilter::Context filterContext(totMat, clipBounds, cache); |  301     SkImageFilter::Context filterContext(totMat, clipBounds, cache); | 
|  301  |  302  | 
|  302     // TODO: should the layer hoister store stand alone layers as SkSpecialImage
     s internally? |  303     // TODO: should the layer hoister store stand alone layers as SkSpecialImage
     s internally? | 
|  303     const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->tex
     ture()->height()); |  304     const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->tex
     ture()->height()); | 
|  304     sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(subset, |  305     sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(subset, | 
|  305                                                           kNeedNewImageUniqueID_
     SpecialImage, |  306                                                           kNeedNewImageUniqueID_
     SpecialImage, | 
|  306                                                           sk_ref_sp(layer->textu
     re()), |  307                                                           sk_ref_sp(layer->textu
     re()), | 
|  307                                                           props)); |  308                                                           props)); | 
|  308  |  309  | 
|  309     SkIPoint offset = SkIPoint::Make(0, 0); |  310     SkIPoint offset = SkIPoint::Make(0, 0); | 
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  385 #if !GR_CACHE_HOISTED_LAYERS |  386 #if !GR_CACHE_HOISTED_LAYERS | 
|  386  |  387  | 
|  387     // This code completely clears out the atlas. It is required when |  388     // This code completely clears out the atlas. It is required when | 
|  388     // caching is disabled so the atlas doesn't fill up and force more |  389     // caching is disabled so the atlas doesn't fill up and force more | 
|  389     // free floating layers |  390     // free floating layers | 
|  390     layerCache->purgeAll(); |  391     layerCache->purgeAll(); | 
|  391 #endif |  392 #endif | 
|  392  |  393  | 
|  393     layerCache->end(); |  394     layerCache->end(); | 
|  394 } |  395 } | 
| OLD | NEW |