OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 #define __STDC_LIMIT_MACROS | 7 #define __STDC_LIMIT_MACROS |
8 | 8 |
9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 } | 1958 } |
1959 } | 1959 } |
1960 | 1960 |
1961 /////////////////////////////////////////////////////////////////////////////// | 1961 /////////////////////////////////////////////////////////////////////////////// |
1962 /////////////////////////////////////////////////////////////////////////////// | 1962 /////////////////////////////////////////////////////////////////////////////// |
1963 | 1963 |
1964 #ifdef SK_DEBUG | 1964 #ifdef SK_DEBUG |
1965 | 1965 |
1966 void SkDraw::validate() const { | 1966 void SkDraw::validate() const { |
1967 SkASSERT(fMatrix != nullptr); | 1967 SkASSERT(fMatrix != nullptr); |
1968 SkASSERT(fClip != nullptr); | |
1969 SkASSERT(fRC != nullptr); | 1968 SkASSERT(fRC != nullptr); |
1970 | 1969 |
1971 const SkIRect& cr = fRC->getBounds(); | 1970 const SkIRect& cr = fRC->getBounds(); |
1972 SkIRect br; | 1971 SkIRect br; |
1973 | 1972 |
1974 br.set(0, 0, fDst.width(), fDst.height()); | 1973 br.set(0, 0, fDst.width(), fDst.height()); |
1975 SkASSERT(cr.isEmpty() || br.contains(cr)); | 1974 SkASSERT(cr.isEmpty() || br.contains(cr)); |
1976 } | 1975 } |
1977 | 1976 |
1978 #endif | 1977 #endif |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 | 2033 |
2035 SkRasterClip clip; | 2034 SkRasterClip clip; |
2036 SkMatrix matrix; | 2035 SkMatrix matrix; |
2037 SkPaint paint; | 2036 SkPaint paint; |
2038 | 2037 |
2039 clip.setRect(SkIRect::MakeWH(mask.fBounds.width(), mask.fBounds.height())); | 2038 clip.setRect(SkIRect::MakeWH(mask.fBounds.width(), mask.fBounds.height())); |
2040 matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft), | 2039 matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft), |
2041 -SkIntToScalar(mask.fBounds.fTop)); | 2040 -SkIntToScalar(mask.fBounds.fTop)); |
2042 | 2041 |
2043 draw.fRC = &clip; | 2042 draw.fRC = &clip; |
2044 draw.fClip = &clip.bwRgn(); | |
2045 draw.fMatrix = &matrix; | 2043 draw.fMatrix = &matrix; |
2046 paint.setAntiAlias(true); | 2044 paint.setAntiAlias(true); |
2047 paint.setStyle(style); | 2045 paint.setStyle(style); |
2048 draw.drawPath(devPath, paint); | 2046 draw.drawPath(devPath, paint); |
2049 } | 2047 } |
2050 | 2048 |
2051 bool SkDraw::DrawToMask(const SkPath& devPath, const SkIRect* clipBounds, | 2049 bool SkDraw::DrawToMask(const SkPath& devPath, const SkIRect* clipBounds, |
2052 const SkMaskFilter* filter, const SkMatrix* filterMatrix
, | 2050 const SkMaskFilter* filter, const SkMatrix* filterMatrix
, |
2053 SkMask* mask, SkMask::CreateMode mode, | 2051 SkMask* mask, SkMask::CreateMode mode, |
2054 SkPaint::Style style) { | 2052 SkPaint::Style style) { |
(...skipping 13 matching lines...) Expand all Loading... |
2068 mask->fImage = SkMask::AllocImage(size); | 2066 mask->fImage = SkMask::AllocImage(size); |
2069 memset(mask->fImage, 0, mask->computeImageSize()); | 2067 memset(mask->fImage, 0, mask->computeImageSize()); |
2070 } | 2068 } |
2071 | 2069 |
2072 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2070 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
2073 draw_into_mask(*mask, devPath, style); | 2071 draw_into_mask(*mask, devPath, style); |
2074 } | 2072 } |
2075 | 2073 |
2076 return true; | 2074 return true; |
2077 } | 2075 } |
OLD | NEW |