| 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 "GrBitmapTextContext.h" | 10 #include "GrBitmapTextContext.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } while (0) | 55 } while (0) |
| 56 #else | 56 #else |
| 57 #define CHECK_SHOULD_DRAW(draw) this->prepareDraw(draw) | 57 #define CHECK_SHOULD_DRAW(draw) this->prepareDraw(draw) |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 // This constant represents the screen alignment criterion in texels for | 60 // This constant represents the screen alignment criterion in texels for |
| 61 // requiring texture domain clamping to prevent color bleeding when drawing | 61 // requiring texture domain clamping to prevent color bleeding when drawing |
| 62 // a sub region of a larger source image. | 62 // a sub region of a larger source image. |
| 63 #define COLOR_BLEED_TOLERANCE 0.001f | 63 #define COLOR_BLEED_TOLERANCE 0.001f |
| 64 | 64 |
| 65 // Do deferred clear just before any draw call |
| 65 #define DO_DEFERRED_CLEAR() \ | 66 #define DO_DEFERRED_CLEAR() \ |
| 66 do { \ | 67 do { \ |
| 67 if (fNeedClear) { \ | 68 if (fNeedClear) { \ |
| 68 this->clearAll(); \ | 69 this->clearAll(); \ |
| 69 } \ | 70 } \ |
| 70 } while (false) \ | 71 } while (false) \ |
| 71 | 72 |
| 72 /////////////////////////////////////////////////////////////////////////////// | 73 /////////////////////////////////////////////////////////////////////////////// |
| 73 | 74 |
| 74 #define CHECK_FOR_ANNOTATION(paint) \ | 75 #define CHECK_FOR_ANNOTATION(paint) \ |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 SkASSERT(fClipStack.get()); | 295 SkASSERT(fClipStack.get()); |
| 295 | 296 |
| 296 SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack); | 297 SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack); |
| 297 | 298 |
| 298 fClip.setClipStack(fClipStack, &this->getOrigin()); | 299 fClip.setClipStack(fClipStack, &this->getOrigin()); |
| 299 | 300 |
| 300 DO_DEFERRED_CLEAR(); | 301 DO_DEFERRED_CLEAR(); |
| 301 } | 302 } |
| 302 | 303 |
| 303 GrRenderTarget* SkGpuDevice::accessRenderTarget() { | 304 GrRenderTarget* SkGpuDevice::accessRenderTarget() { |
| 304 DO_DEFERRED_CLEAR(); | |
| 305 return fRenderTarget; | 305 return fRenderTarget; |
| 306 } | 306 } |
| 307 | 307 |
| 308 void SkGpuDevice::clearAll() { | 308 void SkGpuDevice::clearAll() { |
| 309 GrColor color = 0; | 309 GrColor color = 0; |
| 310 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::clearAll", fContext); | 310 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::clearAll", fContext); |
| 311 SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); | 311 SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); |
| 312 fContext->clear(&rect, color, true, fRenderTarget); | 312 fContext->clear(&rect, color, true, fRenderTarget); |
| 313 fNeedClear = false; | 313 fNeedClear = false; |
| 314 } | 314 } |
| (...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 #endif | 2033 #endif |
| 2034 } | 2034 } |
| 2035 | 2035 |
| 2036 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 2036 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 2037 // We always return a transient cache, so it is freed after each | 2037 // We always return a transient cache, so it is freed after each |
| 2038 // filter traversal. | 2038 // filter traversal. |
| 2039 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 2039 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 2040 } | 2040 } |
| 2041 | 2041 |
| 2042 #endif | 2042 #endif |
| OLD | NEW |