| 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 20 matching lines...) Expand all Loading... |
| 31 #include "SkPicture.h" | 31 #include "SkPicture.h" |
| 32 #include "SkPictureData.h" | 32 #include "SkPictureData.h" |
| 33 #include "SkPictureRangePlayback.h" | 33 #include "SkPictureRangePlayback.h" |
| 34 #include "SkPictureReplacementPlayback.h" | 34 #include "SkPictureReplacementPlayback.h" |
| 35 #include "SkRRect.h" | 35 #include "SkRRect.h" |
| 36 #include "SkStroke.h" | 36 #include "SkStroke.h" |
| 37 #include "SkSurface.h" | 37 #include "SkSurface.h" |
| 38 #include "SkTLazy.h" | 38 #include "SkTLazy.h" |
| 39 #include "SkUtils.h" | 39 #include "SkUtils.h" |
| 40 #include "SkVertState.h" | 40 #include "SkVertState.h" |
| 41 #include "SkXfermode.h" |
| 41 #include "SkErrorInternals.h" | 42 #include "SkErrorInternals.h" |
| 42 | 43 |
| 43 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 | 44 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 |
| 44 | 45 |
| 45 #if 0 | 46 #if 0 |
| 46 extern bool (*gShouldDrawProc)(); | 47 extern bool (*gShouldDrawProc)(); |
| 47 #define CHECK_SHOULD_DRAW(draw, forceI) \ | 48 #define CHECK_SHOULD_DRAW(draw, forceI) \ |
| 48 do { \ | 49 do { \ |
| 49 if (gShouldDrawProc && !gShouldDrawProc()) return; \ | 50 if (gShouldDrawProc && !gShouldDrawProc()) return; \ |
| 50 this->prepareDraw(draw, forceI); \ | 51 this->prepareDraw(draw, forceI); \ |
| (...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 // Add a rect clip to make sure the rendering doesn't | 2017 // Add a rect clip to make sure the rendering doesn't |
| 2017 // extend beyond the boundaries of the atlased sub-rect | 2018 // extend beyond the boundaries of the atlased sub-rect |
| 2018 SkRect bound = SkRect::Make(layerInfo->fSrcRect); | 2019 SkRect bound = SkRect::Make(layerInfo->fSrcRect); |
| 2019 canvas->clipRect(bound); | 2020 canvas->clipRect(bound); |
| 2020 | 2021 |
| 2021 if (layer->isAtlased()) { | 2022 if (layer->isAtlased()) { |
| 2022 // Since 'clear' doesn't respect the clip we need to draw a
rect | 2023 // Since 'clear' doesn't respect the clip we need to draw a
rect |
| 2023 // TODO: ensure none of the atlased layers contain a clear c
all! | 2024 // TODO: ensure none of the atlased layers contain a clear c
all! |
| 2024 SkPaint paint; | 2025 SkPaint paint; |
| 2025 paint.setColor(SK_ColorTRANSPARENT); | 2026 paint.setColor(SK_ColorTRANSPARENT); |
| 2027 paint.setXfermode(SkXfermode::Create(SkXfermode::kSrc_Mode))
->unref(); |
| 2026 canvas->drawRect(bound, paint); | 2028 canvas->drawRect(bound, paint); |
| 2027 } else { | 2029 } else { |
| 2028 canvas->clear(SK_ColorTRANSPARENT); | 2030 canvas->clear(SK_ColorTRANSPARENT); |
| 2029 } | 2031 } |
| 2030 | 2032 |
| 2031 // info.fCTM maps the layer's top/left to the origin. | 2033 // info.fCTM maps the layer's top/left to the origin. |
| 2032 // If this layer is atlased the top/left corner needs | 2034 // If this layer is atlased the top/left corner needs |
| 2033 // to be offset to some arbitrary location in the backing | 2035 // to be offset to some arbitrary location in the backing |
| 2034 // texture. | 2036 // texture. |
| 2035 canvas->translate(bound.fLeft, bound.fTop); | 2037 canvas->translate(bound.fLeft, bound.fTop); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2051 playback.draw(canvas, NULL); | 2053 playback.draw(canvas, NULL); |
| 2052 | 2054 |
| 2053 // unlock the layers | 2055 // unlock the layers |
| 2054 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { | 2056 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { |
| 2055 GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture, i); | 2057 GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture, i); |
| 2056 fContext->getLayerCache()->unlock(layer); | 2058 fContext->getLayerCache()->unlock(layer); |
| 2057 } | 2059 } |
| 2058 | 2060 |
| 2059 return true; | 2061 return true; |
| 2060 } | 2062 } |
| OLD | NEW |