| 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 "SkColorFilter.h" | 8 #include "SkColorFilter.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
| 11 #include "SkDrawFilter.h" | 11 #include "SkDrawFilter.h" |
| 12 #include "SkImage_Base.h" | 12 #include "SkImage_Base.h" |
| 13 #include "SkImageFilter.h" | 13 #include "SkImageFilter.h" |
| 14 #include "SkImageFilterCache.h" | 14 #include "SkImageFilterCache.h" |
| 15 #include "SkMetaData.h" | 15 #include "SkMetaData.h" |
| 16 #include "SkNinePatchIter.h" | 16 #include "SkNinePatchIter.h" |
| 17 #include "SkPatchUtils.h" | 17 #include "SkPatchUtils.h" |
| 18 #include "SkPathMeasure.h" | 18 #include "SkPathMeasure.h" |
| 19 #include "SkRasterClip.h" | 19 #include "SkRasterClip.h" |
| 20 #include "SkRSXform.h" | 20 #include "SkRSXform.h" |
| 21 #include "SkShader.h" | 21 #include "SkShader.h" |
| 22 #include "SkSpecialImage.h" | 22 #include "SkSpecialImage.h" |
| 23 #include "SkTextBlobRunIterator.h" | 23 #include "SkTextBlobRunIterator.h" |
| 24 #include "SkTextToPathIter.h" | 24 #include "SkTextToPathIter.h" |
| 25 | 25 |
| 26 void SkBaseDevice::drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, con
st SkPaint&) { | |
| 27 } | |
| 28 | |
| 29 sk_sp<SkSpecialImage> SkBaseDevice::makeSpecial(const SkBitmap&) { | |
| 30 return nullptr; | |
| 31 } | |
| 32 | |
| 33 sk_sp<SkSpecialImage> SkBaseDevice::makeSpecial(SkImage*) { | |
| 34 return nullptr; | |
| 35 } | |
| 36 | |
| 37 sk_sp<SkSpecialImage> SkBaseDevice::snapSpecial() { | |
| 38 return nullptr; | |
| 39 } | |
| 40 | |
| 41 SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps) | 26 SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps) |
| 42 : fSurfaceProps(surfaceProps) | 27 : fSurfaceProps(surfaceProps) |
| 43 #ifdef SK_DEBUG | 28 #ifdef SK_DEBUG |
| 44 , fAttachedToCanvas(false) | 29 , fAttachedToCanvas(false) |
| 45 #endif | 30 #endif |
| 46 { | 31 { |
| 47 fOrigin.setZero(); | 32 fOrigin.setZero(); |
| 48 fMetaData = nullptr; | 33 fMetaData = nullptr; |
| 49 } | 34 } |
| 50 | 35 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 214 |
| 230 path.rewind(); | 215 path.rewind(); |
| 231 path.addPoly(quad, 4, true); | 216 path.addPoly(quad, 4, true); |
| 232 path.setConvexity(SkPath::kConvex_Convexity); | 217 path.setConvexity(SkPath::kConvex_Convexity); |
| 233 this->drawPath(draw, path, pnt, nullptr, true); | 218 this->drawPath(draw, path, pnt, nullptr, true); |
| 234 } | 219 } |
| 235 } | 220 } |
| 236 | 221 |
| 237 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 222 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 238 | 223 |
| 224 void SkBaseDevice::drawSpecial(const SkDraw&, SkSpecialImage*, int x, int y, con
st SkPaint&) {} |
| 225 sk_sp<SkSpecialImage> SkBaseDevice::makeSpecial(const SkBitmap&) { return nullpt
r; } |
| 226 sk_sp<SkSpecialImage> SkBaseDevice::makeSpecial(const SkImage*) { return nullptr
; } |
| 227 sk_sp<SkSpecialImage> SkBaseDevice::snapSpecial() { return nullptr; } |
| 228 |
| 229 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 230 |
| 239 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { | 231 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { |
| 240 #ifdef SK_DEBUG | 232 #ifdef SK_DEBUG |
| 241 SkASSERT(info.width() > 0 && info.height() > 0); | 233 SkASSERT(info.width() > 0 && info.height() > 0); |
| 242 SkASSERT(dstP); | 234 SkASSERT(dstP); |
| 243 SkASSERT(rowBytes >= info.minRowBytes()); | 235 SkASSERT(rowBytes >= info.minRowBytes()); |
| 244 SkASSERT(x >= 0 && y >= 0); | 236 SkASSERT(x >= 0 && y >= 0); |
| 245 | 237 |
| 246 const SkImageInfo& srcInfo = this->imageInfo(); | 238 const SkImageInfo& srcInfo = this->imageInfo(); |
| 247 SkASSERT(x + info.width() <= srcInfo.width()); | 239 SkASSERT(x + info.width() <= srcInfo.width()); |
| 248 SkASSERT(y + info.height() <= srcInfo.height()); | 240 SkASSERT(y + info.height() <= srcInfo.height()); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 545 |
| 554 // Also log filter quality independent scale factor. | 546 // Also log filter quality independent scale factor. |
| 555 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, | 547 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, |
| 556 kLast_ScaleFactor + 1); | 548 kLast_ScaleFactor + 1); |
| 557 | 549 |
| 558 // Also log an overall histogram of filter quality. | 550 // Also log an overall histogram of filter quality. |
| 559 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali
ty + 1); | 551 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali
ty + 1); |
| 560 #endif | 552 #endif |
| 561 } | 553 } |
| 562 | 554 |
| OLD | NEW |