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 "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
11 #include "GrContext.h" | 11 #include "GrContext.h" |
12 #include "SkDraw.h" | 12 #include "SkDraw.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrGpuResourcePriv.h" | 14 #include "GrGpuResourcePriv.h" |
15 #include "GrImageIDTextureAdjuster.h" | 15 #include "GrImageIDTextureAdjuster.h" |
16 #include "GrLayerHoister.h" | 16 #include "GrLayerHoister.h" |
17 #include "GrRecordReplaceDraw.h" | 17 #include "GrRecordReplaceDraw.h" |
18 #include "GrStrokeInfo.h" | 18 #include "GrStrokeInfo.h" |
19 #include "GrTracing.h" | 19 #include "GrTracing.h" |
20 #include "SkCanvasPriv.h" | 20 #include "SkCanvasPriv.h" |
21 #include "SkErrorInternals.h" | 21 #include "SkErrorInternals.h" |
22 #include "SkGlyphCache.h" | 22 #include "SkGlyphCache.h" |
23 #include "SkGrTexturePixelRef.h" | 23 #include "SkGrTexturePixelRef.h" |
24 #include "SkGr.h" | 24 #include "SkGr.h" |
25 #include "SkGrPriv.h" | 25 #include "SkGrPriv.h" |
| 26 #include "SkHistogramLogging.h" |
26 #include "SkImage_Base.h" | 27 #include "SkImage_Base.h" |
27 #include "SkImageCacherator.h" | 28 #include "SkImageCacherator.h" |
28 #include "SkImageFilter.h" | 29 #include "SkImageFilter.h" |
29 #include "SkLayerInfo.h" | 30 #include "SkLayerInfo.h" |
30 #include "SkMaskFilter.h" | 31 #include "SkMaskFilter.h" |
31 #include "SkNinePatchIter.h" | 32 #include "SkNinePatchIter.h" |
32 #include "SkPathEffect.h" | 33 #include "SkPathEffect.h" |
33 #include "SkPicture.h" | 34 #include "SkPicture.h" |
34 #include "SkPictureData.h" | 35 #include "SkPictureData.h" |
35 #include "SkRRect.h" | 36 #include "SkRRect.h" |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, | 928 void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, |
928 const SkMatrix& viewMatrix, | 929 const SkMatrix& viewMatrix, |
929 const SkRect& srcRect, | 930 const SkRect& srcRect, |
930 const SkIRect& clippedSrcIRect, | 931 const SkIRect& clippedSrcIRect, |
931 const GrTextureParams& params, | 932 const GrTextureParams& params, |
932 const SkPaint& origPaint, | 933 const SkPaint& origPaint, |
933 SkCanvas::SrcRectConstraint constraint, | 934 SkCanvas::SrcRectConstraint constraint, |
934 int tileSize, | 935 int tileSize, |
935 bool bicubic) { | 936 bool bicubic) { |
936 ASSERT_SINGLE_OWNER | 937 ASSERT_SINGLE_OWNER |
| 938 |
| 939 // This is the funnel for all paths that draw tiled bitmaps/images. Log a |
| 940 // histogram entry. |
| 941 SK_HISTOGRAM_BOOLEAN("DrawTiled", true); |
| 942 |
937 // The following pixel lock is technically redundant, but it is desirable | 943 // The following pixel lock is technically redundant, but it is desirable |
938 // to lock outside of the tile loop to prevent redecoding the whole image | 944 // to lock outside of the tile loop to prevent redecoding the whole image |
939 // at each tile in cases where 'bitmap' holds an SkDiscardablePixelRef that | 945 // at each tile in cases where 'bitmap' holds an SkDiscardablePixelRef that |
940 // is larger than the limit of the discardable memory pool. | 946 // is larger than the limit of the discardable memory pool. |
941 SkAutoLockPixels alp(bitmap); | 947 SkAutoLockPixels alp(bitmap); |
942 | 948 |
943 const SkPaint* paint = &origPaint; | 949 const SkPaint* paint = &origPaint; |
944 SkPaint tempPaint; | 950 SkPaint tempPaint; |
945 if (origPaint.isAntiAlias() && !fRenderTarget->isUnifiedMultisampled()) { | 951 if (origPaint.isAntiAlias() && !fRenderTarget->isUnifiedMultisampled()) { |
946 // Drop antialiasing to avoid seams at tile boundaries. | 952 // Drop antialiasing to avoid seams at tile boundaries. |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 } | 1906 } |
1901 | 1907 |
1902 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1908 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1903 ASSERT_SINGLE_OWNER | 1909 ASSERT_SINGLE_OWNER |
1904 // We always return a transient cache, so it is freed after each | 1910 // We always return a transient cache, so it is freed after each |
1905 // filter traversal. | 1911 // filter traversal. |
1906 return SkGpuDevice::NewImageFilterCache(); | 1912 return SkGpuDevice::NewImageFilterCache(); |
1907 } | 1913 } |
1908 | 1914 |
1909 #endif | 1915 #endif |
OLD | NEW |