| 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" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 const SkBitmap& SkGpuDevice::onAccessBitmap() { | 274 const SkBitmap& SkGpuDevice::onAccessBitmap() { |
| 275 DO_DEFERRED_CLEAR(); | 275 DO_DEFERRED_CLEAR(); |
| 276 return fLegacyBitmap; | 276 return fLegacyBitmap; |
| 277 } | 277 } |
| 278 | 278 |
| 279 void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) { | 279 void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) { |
| 280 INHERITED::onAttachToCanvas(canvas); | 280 INHERITED::onAttachToCanvas(canvas); |
| 281 | 281 |
| 282 // Canvas promises that this ptr is valid until onDetachFromCanvas is called | 282 // Canvas promises that this ptr is valid until onDetachFromCanvas is called |
| 283 fClipData.fClipStack = canvas->getClipStack(); | 283 fClipData.fClipStack.reset(SkRef(canvas->getClipStack())); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void SkGpuDevice::onDetachFromCanvas() { | 286 void SkGpuDevice::onDetachFromCanvas() { |
| 287 INHERITED::onDetachFromCanvas(); | 287 INHERITED::onDetachFromCanvas(); |
| 288 fClipData.fClipStack = NULL; | 288 fClipData.fClipStack.reset(NULL); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // call this every draw call, to ensure that the context reflects our state, | 291 // call this every draw call, to ensure that the context reflects our state, |
| 292 // and not the state from some other canvas/device | 292 // and not the state from some other canvas/device |
| 293 void SkGpuDevice::prepareDraw(const SkDraw& draw) { | 293 void SkGpuDevice::prepareDraw(const SkDraw& draw) { |
| 294 SkASSERT(fClipData.fClipStack); | 294 SkASSERT(fClipData.fClipStack); |
| 295 | 295 |
| 296 fContext->setRenderTarget(fRenderTarget); | 296 fContext->setRenderTarget(fRenderTarget); |
| 297 | 297 |
| 298 SkASSERT(draw.fClipStack && draw.fClipStack == fClipData.fClipStack); | 298 SkASSERT(draw.fClipStack && draw.fClipStack == fClipData.fClipStack); |
| (...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 #endif | 1910 #endif |
| 1911 } | 1911 } |
| 1912 | 1912 |
| 1913 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1913 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 1914 // We always return a transient cache, so it is freed after each | 1914 // We always return a transient cache, so it is freed after each |
| 1915 // filter traversal. | 1915 // filter traversal. |
| 1916 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1916 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 1917 } | 1917 } |
| 1918 | 1918 |
| 1919 #endif | 1919 #endif |
| OLD | NEW |