| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2011 Google Inc. | 2  * Copyright 2011 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 "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" | 
| 9 | 9 | 
| 10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" | 
| 11 #include "effects/GrTextureDomain.h" | 11 #include "effects/GrTextureDomain.h" | 
| 12 #include "effects/GrSimpleTextureEffect.h" | 12 #include "effects/GrSimpleTextureEffect.h" | 
| 13 | 13 | 
| 14 #include "GrContext.h" | 14 #include "GrContext.h" | 
| 15 #include "GrBitmapTextContext.h" | 15 #include "GrBitmapTextContext.h" | 
| 16 #include "GrDistanceFieldTextContext.h" | 16 #include "GrDistanceFieldTextContext.h" | 
| 17 | 17 | 
| 18 #include "SkGrTexturePixelRef.h" | 18 #include "SkGrTexturePixelRef.h" | 
| 19 | 19 | 
| 20 #include "SkBounder.h" | 20 #include "SkBounder.h" | 
| 21 #include "SkColorFilter.h" | 21 #include "SkColorFilter.h" | 
| 22 #include "SkDeviceImageFilterProxy.h" | 22 #include "SkDeviceImageFilterProxy.h" | 
| 23 #include "SkDrawProcs.h" | 23 #include "SkDrawProcs.h" | 
| 24 #include "SkGlyphCache.h" | 24 #include "SkGlyphCache.h" | 
| 25 #include "SkImageFilter.h" | 25 #include "SkImageFilter.h" | 
| 26 #include "SkMaskFilter.h" | 26 #include "SkMaskFilter.h" | 
| 27 #include "SkPathEffect.h" | 27 #include "SkPathEffect.h" | 
|  | 28 #include "SkPicture.h" | 
| 28 #include "SkRRect.h" | 29 #include "SkRRect.h" | 
| 29 #include "SkStroke.h" | 30 #include "SkStroke.h" | 
| 30 #include "SkSurface.h" | 31 #include "SkSurface.h" | 
| 31 #include "SkTLazy.h" | 32 #include "SkTLazy.h" | 
| 32 #include "SkUtils.h" | 33 #include "SkUtils.h" | 
| 33 #include "SkErrorInternals.h" | 34 #include "SkErrorInternals.h" | 
| 34 | 35 | 
| 35 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 | 36 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 | 
| 36 | 37 | 
| 37 #if 0 | 38 #if 0 | 
| (...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1996                          GrTexture* texture, | 1997                          GrTexture* texture, | 
| 1997                          bool needClear) | 1998                          bool needClear) | 
| 1998     : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1999     : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 
| 1999 | 2000 | 
| 2000     SkASSERT(texture && texture->asRenderTarget()); | 2001     SkASSERT(texture && texture->asRenderTarget()); | 
| 2001     // This constructor is called from onCreateDevice. It has locked the RT in t
      he texture | 2002     // This constructor is called from onCreateDevice. It has locked the RT in t
      he texture | 
| 2002     // cache. We pass true for the third argument so that it will get unlocked. | 2003     // cache. We pass true for the third argument so that it will get unlocked. | 
| 2003     this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 2004     this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 
| 2004     fNeedClear = needClear; | 2005     fNeedClear = needClear; | 
| 2005 } | 2006 } | 
|  | 2007 | 
|  | 2008 class GPUAccelData : public SkPicture::AccelData { | 
|  | 2009 public: | 
|  | 2010     GPUAccelData(Key key) : INHERITED(key) { } | 
|  | 2011 | 
|  | 2012 protected: | 
|  | 2013 | 
|  | 2014 private: | 
|  | 2015     typedef SkPicture::AccelData INHERITED; | 
|  | 2016 }; | 
|  | 2017 | 
|  | 2018 // In the future this may not be a static method if we need to incorporate the | 
|  | 2019 // clip and matrix state into the key | 
|  | 2020 SkPicture::AccelData::Key SkGpuDevice::ComputeAccelDataKey() { | 
|  | 2021     static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::Genera
      teDomain(); | 
|  | 2022 | 
|  | 2023     return gGPUID; | 
|  | 2024 } | 
|  | 2025 | 
|  | 2026 void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) { | 
|  | 2027     SkPicture::AccelData::Key key = ComputeAccelDataKey(); | 
|  | 2028 | 
|  | 2029     GPUAccelData* data = SkNEW_ARGS(GPUAccelData, (key)); | 
|  | 2030 | 
|  | 2031     picture->EXPERIMENTAL_addAccelData(data); | 
|  | 2032 } | 
|  | 2033 | 
|  | 2034 bool SkGpuDevice::EXPERIMENTAL_drawPicture(const SkPicture& picture) { | 
|  | 2035     SkPicture::AccelData::Key key = ComputeAccelDataKey(); | 
|  | 2036 | 
|  | 2037     const SkPicture::AccelData* data = picture.EXPERIMENTAL_getAccelData(key); | 
|  | 2038     if (NULL == data) { | 
|  | 2039         return false; | 
|  | 2040     } | 
|  | 2041 | 
|  | 2042 #if 0 | 
|  | 2043     const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data); | 
|  | 2044 #endif | 
|  | 2045 | 
|  | 2046     return false; | 
|  | 2047 } | 
| OLD | NEW | 
|---|