| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 | 7 |
| 8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 // can decide to just make it a field in the device (rather than a ptr) | 805 // can decide to just make it a field in the device (rather than a ptr) |
| 806 if (nullptr == fMetaData) { | 806 if (nullptr == fMetaData) { |
| 807 fMetaData = new SkMetaData; | 807 fMetaData = new SkMetaData; |
| 808 } | 808 } |
| 809 return *fMetaData; | 809 return *fMetaData; |
| 810 } | 810 } |
| 811 | 811 |
| 812 /////////////////////////////////////////////////////////////////////////////// | 812 /////////////////////////////////////////////////////////////////////////////// |
| 813 | 813 |
| 814 void SkCanvas::flush() { | 814 void SkCanvas::flush() { |
| 815 this->onFlush(); |
| 816 } |
| 817 |
| 818 void SkCanvas::onFlush() { |
| 815 SkBaseDevice* device = this->getDevice(); | 819 SkBaseDevice* device = this->getDevice(); |
| 816 if (device) { | 820 if (device) { |
| 817 device->flush(); | 821 device->flush(); |
| 818 } | 822 } |
| 819 } | 823 } |
| 820 | 824 |
| 821 SkISize SkCanvas::getBaseLayerSize() const { | 825 SkISize SkCanvas::getBaseLayerSize() const { |
| 822 SkBaseDevice* d = this->getDevice(); | 826 SkBaseDevice* d = this->getDevice(); |
| 823 return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0); | 827 return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0); |
| 824 } | 828 } |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 } | 1368 } |
| 1365 return this->onNewSurface(info, *props); | 1369 return this->onNewSurface(info, *props); |
| 1366 } | 1370 } |
| 1367 | 1371 |
| 1368 sk_sp<SkSurface> SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurface
Props& props) { | 1372 sk_sp<SkSurface> SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurface
Props& props) { |
| 1369 SkBaseDevice* dev = this->getDevice(); | 1373 SkBaseDevice* dev = this->getDevice(); |
| 1370 return dev ? dev->makeSurface(info, props) : nullptr; | 1374 return dev ? dev->makeSurface(info, props) : nullptr; |
| 1371 } | 1375 } |
| 1372 | 1376 |
| 1373 SkImageInfo SkCanvas::imageInfo() const { | 1377 SkImageInfo SkCanvas::imageInfo() const { |
| 1378 return this->onImageInfo(); |
| 1379 } |
| 1380 |
| 1381 SkImageInfo SkCanvas::onImageInfo() const { |
| 1374 SkBaseDevice* dev = this->getDevice(); | 1382 SkBaseDevice* dev = this->getDevice(); |
| 1375 if (dev) { | 1383 if (dev) { |
| 1376 return dev->imageInfo(); | 1384 return dev->imageInfo(); |
| 1377 } else { | 1385 } else { |
| 1378 return SkImageInfo::MakeUnknown(0, 0); | 1386 return SkImageInfo::MakeUnknown(0, 0); |
| 1379 } | 1387 } |
| 1380 } | 1388 } |
| 1381 | 1389 |
| 1382 bool SkCanvas::getProps(SkSurfaceProps* props) const { | 1390 bool SkCanvas::getProps(SkSurfaceProps* props) const { |
| 1391 return this->onGetProps(props); |
| 1392 } |
| 1393 |
| 1394 bool SkCanvas::onGetProps(SkSurfaceProps* props) const { |
| 1383 SkBaseDevice* dev = this->getDevice(); | 1395 SkBaseDevice* dev = this->getDevice(); |
| 1384 if (dev) { | 1396 if (dev) { |
| 1385 if (props) { | 1397 if (props) { |
| 1386 *props = fProps; | 1398 *props = fProps; |
| 1387 } | 1399 } |
| 1388 return true; | 1400 return true; |
| 1389 } else { | 1401 } else { |
| 1390 return false; | 1402 return false; |
| 1391 } | 1403 } |
| 1392 } | 1404 } |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2909 | 2921 |
| 2910 SkRect r; | 2922 SkRect r; |
| 2911 r.set(cx - radius, cy - radius, cx + radius, cy + radius); | 2923 r.set(cx - radius, cy - radius, cx + radius, cy + radius); |
| 2912 this->drawOval(r, paint); | 2924 this->drawOval(r, paint); |
| 2913 } | 2925 } |
| 2914 | 2926 |
| 2915 void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry, | 2927 void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry, |
| 2916 const SkPaint& paint) { | 2928 const SkPaint& paint) { |
| 2917 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRoundRect()"); | 2929 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRoundRect()"); |
| 2918 if (rx > 0 && ry > 0) { | 2930 if (rx > 0 && ry > 0) { |
| 2919 if (paint.canComputeFastBounds()) { | |
| 2920 SkRect storage; | |
| 2921 if (this->quickReject(paint.computeFastBounds(r, &storage))) { | |
| 2922 return; | |
| 2923 } | |
| 2924 } | |
| 2925 SkRRect rrect; | 2931 SkRRect rrect; |
| 2926 rrect.setRectXY(r, rx, ry); | 2932 rrect.setRectXY(r, rx, ry); |
| 2927 this->drawRRect(rrect, paint); | 2933 this->drawRRect(rrect, paint); |
| 2928 } else { | 2934 } else { |
| 2929 this->drawRect(r, paint); | 2935 this->drawRect(r, paint); |
| 2930 } | 2936 } |
| 2931 } | 2937 } |
| 2932 | 2938 |
| 2933 void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle, | 2939 void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle, |
| 2934 SkScalar sweepAngle, bool useCenter, | 2940 SkScalar sweepAngle, bool useCenter, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3116 | 3122 |
| 3117 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3123 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
| 3118 fCanvas->restoreToCount(fSaveCount); | 3124 fCanvas->restoreToCount(fSaveCount); |
| 3119 } | 3125 } |
| 3120 | 3126 |
| 3121 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3127 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
| 3122 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3128 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
| 3123 return this->makeSurface(info, props).release(); | 3129 return this->makeSurface(info, props).release(); |
| 3124 } | 3130 } |
| 3125 #endif | 3131 #endif |
| OLD | NEW |