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 12 matching lines...) Expand all Loading... |
23 #include "SkGrTexturePixelRef.h" | 23 #include "SkGrTexturePixelRef.h" |
24 | 24 |
25 #include "SkDeviceImageFilterProxy.h" | 25 #include "SkDeviceImageFilterProxy.h" |
26 #include "SkDrawProcs.h" | 26 #include "SkDrawProcs.h" |
27 #include "SkGlyphCache.h" | 27 #include "SkGlyphCache.h" |
28 #include "SkImageFilter.h" | 28 #include "SkImageFilter.h" |
29 #include "SkMaskFilter.h" | 29 #include "SkMaskFilter.h" |
30 #include "SkPathEffect.h" | 30 #include "SkPathEffect.h" |
31 #include "SkPicture.h" | 31 #include "SkPicture.h" |
32 #include "SkPictureData.h" | 32 #include "SkPictureData.h" |
33 #include "SkPicturePlayback.h" | |
34 #include "SkPictureRangePlayback.h" | 33 #include "SkPictureRangePlayback.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 "SkErrorInternals.h" | 41 #include "SkErrorInternals.h" |
42 | 42 |
43 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 | 43 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 |
44 | 44 |
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 kSaveLayerMaxSize < info.fSize.fWidth || | 1931 kSaveLayerMaxSize < info.fSize.fWidth || |
1932 kSaveLayerMaxSize < info.fSize.fHeight || | 1932 kSaveLayerMaxSize < info.fSize.fHeight || |
1933 info.fIsNested) { | 1933 info.fIsNested) { |
1934 continue; | 1934 continue; |
1935 } | 1935 } |
1936 | 1936 |
1937 pullForward[j] = true; | 1937 pullForward[j] = true; |
1938 } | 1938 } |
1939 } | 1939 } |
1940 | 1940 |
1941 SkPicturePlayback::PlaybackReplacements replacements; | 1941 SkPictureReplacementPlayback::PlaybackReplacements replacements; |
1942 | 1942 |
1943 // Generate the layer and/or ensure it is locked | 1943 // Generate the layer and/or ensure it is locked |
1944 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { | 1944 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { |
1945 if (pullForward[i]) { | 1945 if (pullForward[i]) { |
1946 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(
picture, i); | 1946 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(
picture, i); |
1947 | 1947 |
1948 const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); | 1948 const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); |
1949 | 1949 |
1950 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* layerInfo
= | 1950 SkPictureReplacementPlayback::PlaybackReplacements::ReplacementInfo*
layerInfo = |
1951 replacem
ents.push(); | 1951 replacem
ents.push(); |
1952 layerInfo->fStart = info.fSaveLayerOpID; | 1952 layerInfo->fStart = info.fSaveLayerOpID; |
1953 layerInfo->fStop = info.fRestoreOpID; | 1953 layerInfo->fStop = info.fRestoreOpID; |
1954 layerInfo->fPos = info.fOffset; | 1954 layerInfo->fPos = info.fOffset; |
1955 | 1955 |
1956 GrTextureDesc desc; | 1956 GrTextureDesc desc; |
1957 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 1957 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
1958 desc.fWidth = info.fSize.fWidth; | 1958 desc.fWidth = info.fSize.fWidth; |
1959 desc.fHeight = info.fSize.fHeight; | 1959 desc.fHeight = info.fSize.fHeight; |
1960 desc.fConfig = kSkia8888_GrPixelConfig; | 1960 desc.fConfig = kSkia8888_GrPixelConfig; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 info.fSaveLayerOpID, | 2023 info.fSaveLayerOpID, |
2024 info.fRestoreOpID); | 2024 info.fRestoreOpID); |
2025 rangePlayback.draw(canvas, NULL); | 2025 rangePlayback.draw(canvas, NULL); |
2026 | 2026 |
2027 canvas->flush(); | 2027 canvas->flush(); |
2028 } | 2028 } |
2029 } | 2029 } |
2030 } | 2030 } |
2031 | 2031 |
2032 // Playback using new layers | 2032 // Playback using new layers |
2033 SkPicturePlayback playback(picture); | 2033 SkPictureReplacementPlayback playback(picture, &replacements, ops.get()); |
2034 | 2034 |
2035 playback.setReplacements(&replacements); | |
2036 playback.draw(canvas, NULL); | 2035 playback.draw(canvas, NULL); |
2037 | 2036 |
2038 // unlock the layers | 2037 // unlock the layers |
2039 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { | 2038 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { |
2040 GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture, i); | 2039 GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture, i); |
2041 fContext->getLayerCache()->unlock(layer); | 2040 fContext->getLayerCache()->unlock(layer); |
2042 } | 2041 } |
2043 | 2042 |
2044 return true; | 2043 return true; |
2045 } | 2044 } |
OLD | NEW |